diff --git a/warehost-client-web/defaults/main.yml b/warehost-client-web/defaults/main.yml index 4f18011..3f0cb11 100644 --- a/warehost-client-web/defaults/main.yml +++ b/warehost-client-web/defaults/main.yml @@ -1,3 +1,3 @@ warehost_webclient_domain: warehost.de -warehost_webclient_repo: git@dev.sum7.eu:sum7/warehost-client-web.git +warehost_webclient_repo: https://dev.sum7.eu/sum7/warehost-client-web.git warehost_webclient_version: master diff --git a/warehost-client-web/tasks/main.yml b/warehost-client-web/tasks/main.yml index 9a0d28a..e96f17c 100644 --- a/warehost-client-web/tasks/main.yml +++ b/warehost-client-web/tasks/main.yml @@ -1,7 +1,55 @@ --- +- name: Install packages + apt: name={{ item }} + with_items: + - git + - npm + +- name: Install global node packages + npm: name={{item}} global=yes + with_items: + - grunt-cli + - bower + +- name: Clone repository + git: repo={{ warehost_webclient_repo }} + dest=/usr/src/warehost-client-web/ + version={{warehost_webclient_version}} + force=yes + +- name: Install node dependencies + npm: path=/usr/src/warehost-client-web + +- name: Install bower dependencies + command: nodejs /usr/local/bin/bower install --allow-root + args: + chdir: "/usr/src/warehost-client-web" + +- name: Build warehost-client-web + command: nodejs /usr/local/bin/grunt build + args: + chdir: "/usr/src/warehost-client-web" + +- name: Create destination directory + file: path=/srv/http/domain/{{warehost_webclient_domain}} state=directory mode=0755 owner={{http_usr}} group={{http_grp}} + +- name: Install rsync + apt: name=rsync + +# does not work (https://github.com/ansible/ansible/issues/11873) +#- name: Copy generated files +# delegate_to: "{{ inventory_hostname }}" +# synchronize: +# src: /usr/src/warehost-client-web/build/ +# dest: /srv/http/domain/{{warehost_webclient_domain}}/ +# delete: True + +- name: Copy files + command: > + rsync -a --delete + /usr/src/warehost-client-web/build/ + /srv/http/domain/{{warehost_webclient_domain}}/ + - name: Configurate caddy for warehost client web template: src=caddy.conf dest=/etc/caddy/hosts/79-warehost_client_web.act owner={{http_usr}} mode=0644 notify: reload caddy - -- name: Create domain folder for warehost client web - file: path=/srv/http/domain/{{warehost_webclient_domain}} state=directory mode=0755 owner={{http_usr}} group={{http_grp}}