summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2020-01-19 03:55:02 -0500
committerThedro Neely <thedroneely@gmail.com>2020-01-19 03:55:02 -0500
commitf7ef9cb79f3713b49786f4eccf22f2326d3b6062 (patch)
treedaf703236654609a71bd3ac7e41bdc373c82ff36
parent0c330063fa043f47b3b68055af6f098c5ee51df5 (diff)
downloadplaybooks-f7ef9cb79f3713b49786f4eccf22f2326d3b6062.tar.gz
playbooks-f7ef9cb79f3713b49786f4eccf22f2326d3b6062.tar.bz2
playbooks-f7ef9cb79f3713b49786f4eccf22f2326d3b6062.zip
roles/isso/main: Syntax cleanup
-rw-r--r--roles/isso/main.yml52
1 files 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