From f7ef9cb79f3713b49786f4eccf22f2326d3b6062 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Sun, 19 Jan 2020 03:55:02 -0500 Subject: roles/isso/main: Syntax cleanup --- roles/isso/main.yml | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/roles/isso/main.yml b/roles/isso/main.yml index b31a4b3..9072bf8 100644 --- a/roles/isso/main.yml +++ b/roles/isso/main.yml @@ -2,22 +2,27 @@ # Target: alpine3.10 - name: Install Isso Commenting Server hosts: isso + vars: - username: isso - deploy_path: "/opt/{{ username }}" + user: isso + home: "/opt/{{ user }}" version: 7eed747e7a94ca1a19c01c67de7ed6b16d2bbe3d + tasks: + - name: Ensuring group exists group: - name: "{{ username }}" + name: "{{ user }}" state: present + - name: Creating user and making home directory user: system: yes state: present - name: "{{ username }}" - groups: "{{ username }}" - home: "{{ deploy_path }}" + name: "{{ user }}" + groups: "{{ user }}" + home: "{{ home }}" + - name: Installing the required dependencies apk: state: present @@ -32,81 +37,98 @@ - npm - make - supervisor + - block: + - name: Cloning repository git: repo: https://github.com/posativ/isso - dest: "{{ deploy_path }}" + dest: "{{ home }}" version: "{{ version }}" + - name: Setting up python virtual environment shell: python3 -m venv . args: - chdir: "{{ deploy_path }}" + chdir: "{{ home }}" creates: bin/activate + - name: Setting up build environment shell: | . bin/activate python setup.py develop args: - chdir: "{{ deploy_path }}" + chdir: "{{ home }}" creates: isso.egg-info + - name: Installing JavaScript dependencies shell: npm install bower requirejs jade args: - chdir: "{{ deploy_path }}" + chdir: "{{ home }}" creates: node_modules/.bin + - name: Building JavaScript assets shell: | - PATH=$PATH:"{{ deploy_path }}"/node_modules/.bin + PATH=$PATH:"{{ home }}"/node_modules/.bin make init make js args: - chdir: "{{ deploy_path }}" + chdir: "{{ home }}" creates: isso/js/embed.min.js + - name: Copying config file copy: src: isso.conf - dest: "{{ deploy_path }}/isso.conf" + dest: "{{ home }}/isso.conf" mode: '0644' register: issoConfig + become: true - become_user: "{{ username }}" + become_user: "{{ user }}" + - name: Copying supervisord config file copy: src: supervisord.conf dest: /etc/supervisord.conf mode: '0644' register: supervisorConfig + - name: Ensuring supervisord has been started and enabled service: name: supervisord state: started enabled: yes + - name: Waiting for supervisor to become active wait_for: port: 9100 + - name: Restarting supervisord due to config change service: name: supervisord state: restarted when: supervisorConfig.changed + - name: Ensuring isso has been started supervisorctl: name: isso state: started + - name: Waiting for application to become active wait_for: port: 8100 + - name: Restarting application due to config change supervisorctl: name: isso state: restarted when: issoConfig.changed + - name: Testing if isso admin page exists uri: url: http://0.0.0.0:8100/admin return_content: yes + - name: Testing if isso JavaScript exists uri: url: http://0.0.0.0:8100/js/embed.min.js - return_content: yes \ No newline at end of file + return_content: yes -- cgit v1.2.3