From 53cec13591f4914ea78d4a5f8d5429a965bd9a61 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 17 Oct 2018 12:18:50 -0400 Subject: [PATCH] JBAS-1839 Ansible separate localhost ('single') target 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 --- KCLS/admin-scripts/ansible/clusters/localhost.ini | 13 +----- KCLS/admin-scripts/ansible/playbook.yml | 57 ++++++++++++++--------- KCLS/admin-scripts/ansible/plays/deploy.yml | 4 +- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/KCLS/admin-scripts/ansible/clusters/localhost.ini b/KCLS/admin-scripts/ansible/clusters/localhost.ini index e84b20b03d..dcbf5ea101 100644 --- a/KCLS/admin-scripts/ansible/clusters/localhost.ini +++ b/KCLS/admin-scripts/ansible/clusters/localhost.ini @@ -1,15 +1,4 @@ # Localhost inventory -[bricks] +[single] localhost - -[sips] -localhost - -[utils] -localhost - -[all:children] -bricks -sips -utils diff --git a/KCLS/admin-scripts/ansible/playbook.yml b/KCLS/admin-scripts/ansible/playbook.yml index a0242f7027..56140fc82b 100644 --- a/KCLS/admin-scripts/ansible/playbook.yml +++ b/KCLS/admin-scripts/ansible/playbook.yml @@ -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: @@ -37,19 +65,11 @@ - 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 @@ -63,20 +83,11 @@ - 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 diff --git a/KCLS/admin-scripts/ansible/plays/deploy.yml b/KCLS/admin-scripts/ansible/plays/deploy.yml index ace7e3accd..2cf1350abb 100644 --- a/KCLS/admin-scripts/ansible/plays/deploy.yml +++ b/KCLS/admin-scripts/ansible/plays/deploy.yml @@ -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: -- 2.11.0