JBAS-1839 Ansible separate localhost ('single') target
authorBill Erickson <berickxx@gmail.com>
Wed, 17 Oct 2018 16:18:50 +0000 (12:18 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Create a separate ansible build target for single-server hosts, e.g.
'localhost'.  This simplifies the plays by not requiring special
handling for single-server instances.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/admin-scripts/ansible/clusters/localhost.ini
KCLS/admin-scripts/ansible/playbook.yml
KCLS/admin-scripts/ansible/plays/deploy.yml

index e84b20b..dcbf5ea 100644 (file)
@@ -1,15 +1,4 @@
 # Localhost inventory
 
-[bricks]
+[single]
 localhost
-
-[sips]
-localhost
-
-[utils]
-localhost
-
-[all:children]
-bricks
-sips
-utils
index a0242f7..56140fc 100644 (file)
@@ -3,6 +3,34 @@
 #
 # KCLS Evergreen Deployment Ansible Playbook
 
+# single-server instances (e.g. 'localhost') perform all actions.
+# and are assumed to not require attach/detach
+- hosts: 'single'
+  vars_files:
+    - vars.yml
+    - credentials.yml
+  tasks:
+    - include: plays/pinghost.yml
+      when: ping_host
+    - include: plays/stopweb.yml
+      when: stop_web or stop_all
+    - include: plays/stopsip.yml
+      when: stop_sip or stop_all
+    - include: plays/stoputil.yml
+      when: stop_util or stop_all
+    - include: plays/stopeg.yml
+      when: stop_eg or stop_all
+    - include: plays/deploy.yml
+      when: deploy
+    - include: plays/starteg.yml
+      when: start_eg or start_all
+    - include: plays/startweb.yml
+      when: start_web or start_all
+    - include: plays/startsip.yml
+      when: start_sip or start_all
+    - include: plays/startutil.yml
+      when: start_util or start_all
+
 - hosts: 'bricks'
   serial: '{{serial}}'
   vars_files:
     - include: plays/stopsip.yml
       when: stop_sip or stop_all
     - include: plays/stopeg.yml
-      when: 
-        - stop_eg or stop_all
-        # Avoid running duplicate commands on single-server setups.
-        # e.g. dev servers
-        - "'bricks' not in group_names"
+      when: stop_eg or stop_all
     - include: plays/deploy.yml
-      when: 
-        - deploy
-        - "'bricks' not in group_names"
+      when: deploy
     - include: plays/starteg.yml
-      when: 
-        - start_eg or start_all
-        - "'bricks' not in group_names"
+      when: start_eg or start_all
     - include: plays/startsip.yml
       when: start_sip or start_all
 
     - include: plays/stoputil.yml
       when: stop_util or stop_all
     - include: plays/stopeg.yml
-      when: 
-        - stop_eg or stop_all
-        - "'bricks' not in group_names"
-        - "'sips' not in group_names"
+      when: stop_eg or stop_all
     - include: plays/deploy.yml
-      when: 
-        - deploy
-        - "'bricks' not in group_names"
-        - "'sips' not in group_names"
+      when: deploy
     - include: plays/starteg.yml
-      when: 
-        - start_eg or start_all
-        - "'bricks' not in group_names"
-        - "'sips' not in group_names"
+      when: start_eg or start_all
     - include: plays/startutil.yml
       when: start_util or start_all
 
index ace7e3a..2cf1350 100644 (file)
@@ -54,7 +54,7 @@
       cd {{repo_base}}/Evergreen/Open-ILS/web/js/ui/default/staff 
       && npm run build-prod
     when:
-      - "'bricks' in group_names"
+      - "'bricks' in group_names or 'single' in group_names"
   - name: Angular build
     become: true
     become_user: '{{opensrf_user}}'
@@ -62,7 +62,7 @@
       cd {{repo_base}}/Evergreen/Open-ILS/src/eg2
       && ng build --prod
     when:
-      - "'bricks' in group_names"
+      - "'bricks' in group_names or 'single' in group_names"
   - name: Install Evergreen
     become: true
     environment: