From 30ce59c49e2f4f825109d9cecd0b50416013f91e Mon Sep 17 00:00:00 2001 From: Jiri Stransky Date: Tue, 20 Jun 2017 16:11:29 +0200 Subject: [PATCH] Split quickstart-extras.yml into sub-playbooks This should allow easier composition of custom playbooks from bits and pieces of quickstart-extras.yml. It will be especially useful when one wants to reuse existing environment (e.g. deployed undercloud) and perform additional automated actions on it. (The current solution has been to use ansible tags, which has been quite error prone for me, and i've sometimes ended up ruining my dev environment. Composing custom playbooks is both safer and more straightforward to reason about.) Depends-On: I513149a9de524dd3f017c583d06c35a165581715 Change-Id: Ie40da10fb96265340b243fff9b48fd18640de978 --- .../quickstart-extras-overcloud-prep.yml | 40 ++++++ playbooks/quickstart-extras-overcloud.yml | 33 +++++ playbooks/quickstart-extras-undercloud.yml | 22 ++++ playbooks/quickstart-extras-validate.yml | 17 +++ playbooks/quickstart-extras.yml | 121 +----------------- 5 files changed, 116 insertions(+), 117 deletions(-) create mode 100644 playbooks/quickstart-extras-overcloud-prep.yml create mode 100644 playbooks/quickstart-extras-overcloud.yml create mode 100644 playbooks/quickstart-extras-undercloud.yml create mode 100644 playbooks/quickstart-extras-validate.yml diff --git a/playbooks/quickstart-extras-overcloud-prep.yml b/playbooks/quickstart-extras-overcloud-prep.yml new file mode 100644 index 000000000..418928ea9 --- /dev/null +++ b/playbooks/quickstart-extras-overcloud-prep.yml @@ -0,0 +1,40 @@ +# Prepare any additional configuration files required by the overcloud +- name: Prepare configuration files for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-config + +# Prepare the overcloud for a containerized deployment +- name: Prepare overcloud containers + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-containers + +# Prepare the overcloud images for deployment +- name: Prepare the overcloud images for deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-images + +# Prepare the overcloud flavor configuration +- name: Prepare overcloud flavors + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-flavors + +# Prepare the undercloud networks for the overcloud deployment +- name: Prepare the undercloud networks for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - overcloud-prep-network + +- name: Prepare the SSL Configuration for the overcloud deployment + hosts: undercloud + gather_facts: no + roles: + - { role: overcloud-ssl, when: ssl_overcloud|bool } diff --git a/playbooks/quickstart-extras-overcloud.yml b/playbooks/quickstart-extras-overcloud.yml new file mode 100644 index 000000000..050f16bf9 --- /dev/null +++ b/playbooks/quickstart-extras-overcloud.yml @@ -0,0 +1,33 @@ +# Deploy the overcloud +- name: Deploy the overcloud + hosts: undercloud + gather_facts: yes + tags: + - overcloud-deploy + roles: + - overcloud-deploy + +- name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes + tags: + - overcloud-deploy + vars: + inventory: all + roles: + - tripleo-inventory + +# Check the results of the deployment, note after inventory has executed +- name: Check the result of the deployment + hosts: localhost + tags: + - overcloud-deploy + tasks: + - name: ensure the deployment result has been read into memory + include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" + + # overcloud_deploy_result = ["failed", "passed"] + - name: did the deployment pass or fail? + debug: + var: overcloud_deploy_result + failed_when: overcloud_deploy_result == "failed" diff --git a/playbooks/quickstart-extras-undercloud.yml b/playbooks/quickstart-extras-undercloud.yml new file mode 100644 index 000000000..857c054e6 --- /dev/null +++ b/playbooks/quickstart-extras-undercloud.yml @@ -0,0 +1,22 @@ +# Deploy the FreeIPA server +- name: Deploy the FreeIPA server + hosts: supplemental + gather_facts: no + roles: + - { role: freeipa-setup, when: deploy_supplemental_node|bool and enable_tls_everywhere|bool } + +# setup for the undercloud +- name: Setup the undercloud + hosts: undercloud + gather_facts: no + vars: + ansible_user: root + roles: + - { role: undercloud-setup, when: undercloud_setup|bool } + +# Deploy the undercloud +- name: Deploy the undercloud + hosts: undercloud + gather_facts: no + roles: + - undercloud-deploy diff --git a/playbooks/quickstart-extras-validate.yml b/playbooks/quickstart-extras-validate.yml new file mode 100644 index 000000000..c26aee594 --- /dev/null +++ b/playbooks/quickstart-extras-validate.yml @@ -0,0 +1,17 @@ +# Validate the deployment +- name: validate the overcloud + hosts: undercloud + tags: + - overcloud-validate + gather_facts: no + roles: + - { role: validate-simple, when: test_ping|bool } + +# Execute tempest against the overcloud deployment +- name: Execute tempest against the overcloud + hosts: undercloud + tags: + - overcloud-validate + gather_facts: no + roles: + - { role: validate-tempest, when: run_tempest|bool } diff --git a/playbooks/quickstart-extras.yml b/playbooks/quickstart-extras.yml index 0132a94a5..ade2ae044 100644 --- a/playbooks/quickstart-extras.yml +++ b/playbooks/quickstart-extras.yml @@ -1,120 +1,7 @@ # This is the playbook used by the `quickstart.sh` script. - include: quickstart.yml - -# Deploy the FreeIPA server -- name: Deploy the FreeIPA server - hosts: supplemental - gather_facts: no - roles: - - { role: freeipa-setup, when: deploy_supplemental_node|bool and enable_tls_everywhere|bool } - -# setup for the undercloud -- name: Setup the undercloud - hosts: undercloud - gather_facts: no - vars: - ansible_user: root - roles: - - { role: undercloud-setup, when: undercloud_setup|bool } - -# Deploy the undercloud -- name: Deploy the undercloud - hosts: undercloud - gather_facts: no - roles: - - undercloud-deploy - -# Prepare any additional configuration files required by the overcloud -- name: Prepare configuration files for the overcloud deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-config - -# Prepare the overcloud for a containerized deployment -- name: Prepare overcloud containers - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-containers - -# Prepare the overcloud images for deployment -- name: Prepare the overcloud images for deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-images - -# Prepare the overcloud flavor configuration -- name: Prepare overcloud flavors - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-flavors - -# Prepare the undercloud networks for the overcloud deployment -- name: Prepare the undercloud networks for the overcloud deployment - hosts: undercloud - gather_facts: no - roles: - - overcloud-prep-network - -- name: Prepare the SSL Configuration for the overcloud deployment - hosts: undercloud - gather_facts: no - roles: - - { role: overcloud-ssl, when: ssl_overcloud|bool } - -# Deploy the overcloud -- name: Deploy the overcloud - hosts: undercloud - gather_facts: yes - tags: - - overcloud-deploy - roles: - - overcloud-deploy - -- name: Add the overcloud nodes to the generated inventory - hosts: undercloud - gather_facts: yes - tags: - - overcloud-deploy - vars: - inventory: all - roles: - - tripleo-inventory - -# Check the results of the deployment, note after inventory has executed -- name: Check the result of the deployment - hosts: localhost - tags: - - overcloud-deploy - tasks: - - name: ensure the deployment result has been read into memory - include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json" - - # overcloud_deploy_result = ["failed", "passed"] - - name: did the deployment pass or fail? - debug: - var: overcloud_deploy_result - failed_when: overcloud_deploy_result == "failed" - -# Validate the deployment -- name: validate the overcloud - hosts: undercloud - tags: - - overcloud-validate - gather_facts: no - roles: - - { role: validate-simple, when: test_ping|bool } - -# Execute tempest against the overcloud deployment -- name: Execute tempest against the overcloud - hosts: undercloud - tags: - - overcloud-validate - gather_facts: no - roles: - - { role: validate-tempest, when: run_tempest|bool } - +- include: quickstart-extras-undercloud.yml +- include: quickstart-extras-overcloud-prep.yml +- include: quickstart-extras-overcloud.yml +- include: quickstart-extras-validate.yml