diff --git a/warehost-client-web/tasks/archlinux.yml b/warehost-client-web/tasks/archlinux.yml new file mode 100644 index 0000000..0cdbe53 --- /dev/null +++ b/warehost-client-web/tasks/archlinux.yml @@ -0,0 +1,32 @@ +--- +- name: Install packages + pacman: name={{ item }} + with_items: + - git + - npm + - rsync + +- 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: node /bin/bower install --allow-root -s -q --config.interactive=false + args: + chdir: "/usr/src/warehost-client-web" + +- name: Build warehost-client-web + command: node /bin/grunt build + args: + chdir: "/usr/src/warehost-client-web" diff --git a/warehost-client-web/tasks/main.yml b/warehost-client-web/tasks/main.yml index e96f17c..26d191b 100644 --- a/warehost-client-web/tasks/main.yml +++ b/warehost-client-web/tasks/main.yml @@ -1,41 +1,16 @@ --- -- name: Install packages - apt: name={{ item }} - with_items: - - git - - npm +- name: Archlinux + include: archlinux.yml + when: (ansible_distribution == "Antergos") or (ansible_os_family == "Archlinux") -- name: Install global node packages - npm: name={{item}} global=yes - with_items: - - grunt-cli - - bower +- name: Ubuntu + include: ubuntu.yml + when: (ansible_distribution == "Debian") or (ansible_distribution == "Ubuntu") -- 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 }}" diff --git a/warehost-client-web/tasks/ubuntu.yml b/warehost-client-web/tasks/ubuntu.yml new file mode 100644 index 0000000..b2f5b22 --- /dev/null +++ b/warehost-client-web/tasks/ubuntu.yml @@ -0,0 +1,32 @@ +--- +- name: Install packages + apt: name={{ item }} + with_items: + - git + - npm + - rsync + +- 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" diff --git a/warehost-client-web/templates/caddy.conf b/warehost-client-web/templates/caddy.conf index f794549..87f36e7 100644 --- a/warehost-client-web/templates/caddy.conf +++ b/warehost-client-web/templates/caddy.conf @@ -1,4 +1,7 @@ -http://{{warehost_webclient_domain}}, https://{{warehost_webclient_domain}} { +http://{{warehost_webclient_domain}} { + redir https://{{warehost_webclient_domain}}{uri} +} +https://{{warehost_webclient_domain}} { tls {{caddy_ssl_mail}} gzip root /srv/http/domain/{{warehost_webclient_domain}}