From d71bab9d45bd29c42f78c77aa482f9d51e581634 Mon Sep 17 00:00:00 2001 From: Gabriele Cerami Date: Mon, 4 Dec 2017 16:54:42 +0000 Subject: [PATCH] split multinode playbook Separate quickstart multinode playbooks into smaller playbooks that follow the same breakpoints as the libvirt playbook in tripleo-quickstart-extras. This is part of the preparations to convert CI to follow the step by step workflow the users will follow to reproduce CI Change-Id: I6fdde6eaebae4a624234e67d9d6e195f0092fc78 --- .../playbooks/multinode-overcloud-prep.yml | 47 +++++ .../playbooks/multinode-overcloud-upgrade.yml | 18 ++ .../playbooks/multinode-overcloud.yml | 33 +++ .../playbooks/multinode-undercloud.yml | 81 ++++++++ .../playbooks/multinode-validate.yml | 10 + toci-quickstart/playbooks/multinode.yml | 193 +----------------- 6 files changed, 194 insertions(+), 188 deletions(-) create mode 100644 toci-quickstart/playbooks/multinode-overcloud-prep.yml create mode 100644 toci-quickstart/playbooks/multinode-overcloud-upgrade.yml create mode 100644 toci-quickstart/playbooks/multinode-overcloud.yml create mode 100644 toci-quickstart/playbooks/multinode-undercloud.yml create mode 100644 toci-quickstart/playbooks/multinode-validate.yml diff --git a/toci-quickstart/playbooks/multinode-overcloud-prep.yml b/toci-quickstart/playbooks/multinode-overcloud-prep.yml new file mode 100644 index 000000000..ee0e483da --- /dev/null +++ b/toci-quickstart/playbooks/multinode-overcloud-prep.yml @@ -0,0 +1,47 @@ +--- +- name: Run overcloud prep config + hosts: undercloud + gather_facts: no + roles: + - role: overcloud-prep-config + # only run when we know we have to, save time otherwise + when: mixed_upgrade|default(false)|bool + tags: + - overcloud-prep-config + +- name: Run overcloud prep roles + hosts: undercloud + gather_facts: no + roles: + - { role: overcloud-prep-images, step_overcloud_image: false, step_glance_upload: true, step_register: false } + +- name: Run tripleo-validations pre-introspection tests + hosts: undercloud + gather_facts: no + tags: + - tripleo-validations + vars: + validations_group: ['pre-introspection'] + roles: + - { role: tripleo-validations, + when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} + +- name: Prepare for containerized deployment + hosts: undercloud + gather_facts: no + tags: + - overcloud-prep-containers + roles: + - role: overcloud-prep-containers + when: containerized_overcloud|bool or containerized_overcloud_upgrade|bool + +- name: Run tripleo-validations pre-deployment tests + hosts: undercloud + gather_facts: no + tags: + - tripleo-validations + vars: + validations_group: ['pre-deployment'] + roles: + - { role: tripleo-validations, + when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} diff --git a/toci-quickstart/playbooks/multinode-overcloud-upgrade.yml b/toci-quickstart/playbooks/multinode-overcloud-upgrade.yml new file mode 100644 index 000000000..bad0bfe43 --- /dev/null +++ b/toci-quickstart/playbooks/multinode-overcloud-upgrade.yml @@ -0,0 +1,18 @@ +- name: Set up repos on subnodes for upgrading + hosts: overcloud + vars: + ib_repo_host: undercloud + roles: + - role: repo-setup + when: mixed_upgrade|default(false)|bool + - role: install-built-repo + when: hostvars['undercloud']['compressed_gating_repo'] is defined and mixed_upgrade|default(false)|bool + +- name: Upgrade Tripleo + hosts: undercloud + tags: + - overcloud-upgrade + gather_facts: no + roles: + - role: overcloud-upgrade + when: containerized_overcloud_upgrade|bool diff --git a/toci-quickstart/playbooks/multinode-overcloud.yml b/toci-quickstart/playbooks/multinode-overcloud.yml new file mode 100644 index 000000000..796ade9f1 --- /dev/null +++ b/toci-quickstart/playbooks/multinode-overcloud.yml @@ -0,0 +1,33 @@ +--- +- name: Deploy the overcloud + hosts: undercloud + gather_facts: no + roles: + - overcloud-deploy + environment: + TRIPLEO_ROOT: "{{ lookup('env','TRIPLEO_ROOT') }}" + +- 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" + +- name: Run tripleo-validations post-deployment tests + hosts: undercloud + gather_facts: no + tags: + - tripleo-validations + vars: + validations_group: ['post-deployment'] + roles: + - { role: tripleo-validations, + when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} + diff --git a/toci-quickstart/playbooks/multinode-undercloud.yml b/toci-quickstart/playbooks/multinode-undercloud.yml new file mode 100644 index 000000000..f442fdef2 --- /dev/null +++ b/toci-quickstart/playbooks/multinode-undercloud.yml @@ -0,0 +1,81 @@ +--- +- name: Add the overcloud nodes to the generated inventory + hosts: undercloud + gather_facts: yes + tags: + - overcloud-deploy + vars: + inventory: multinode + roles: + - tripleo-inventory + +- name: Create configs on subnodes + hosts: overcloud + roles: + # When doing mixed upgrade, we need different repos on undercloud + # vs. overcloud. Rely on $UPGRADE_RELEASE together with + # bootstrap-overcloud-full-minimal.sh to setup overcloud. + - role: repo-setup + when: not mixed_upgrade|default(false)|bool + tasks: + - name: Create a clean hosts file on subnodes + copy: + dest: /etc/hosts + content: | + 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 + ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 + become: true + tags: + - undercloud-setup + +- name: Prepare the undercloud for installation + hosts: undercloud + roles: + - undercloud-setup + tags: + - undercloud-setup + +- name: Run DLRN gate role and install repo + hosts: undercloud + vars: + artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz" + roles: + - build-test-packages + - { role: install-built-repo, when: compressed_gating_repo is defined } + tags: + - build + +- name: Install built packages on subnodes + hosts: overcloud + vars: + ib_repo_host: undercloud + roles: + - role: repo-setup + when: not mixed_upgrade|default(false)|bool + - role: install-built-repo + when: hostvars['undercloud']['compressed_gating_repo'] is defined and not mixed_upgrade|default(false)|bool + + tags: + - build + +- name: Install the undercloud + hosts: undercloud + roles: + - undercloud-deploy + +- name: Configure tripleo-validations + hosts: undercloud + gather_facts: no + tags: + - tripleo-validations + vars: + run_tripleo_validations_setup: True + roles: + - { role: tripleo-validations, + when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} + +- name: Validate the undercloud + hosts: undercloud + roles: + - validate-undercloud + diff --git a/toci-quickstart/playbooks/multinode-validate.yml b/toci-quickstart/playbooks/multinode-validate.yml new file mode 100644 index 000000000..95310c436 --- /dev/null +++ b/toci-quickstart/playbooks/multinode-validate.yml @@ -0,0 +1,10 @@ +--- +# Validate the deployment +- name: validate the overcloud + hosts: undercloud + tags: + - overcloud-validate + gather_facts: no + roles: + - { role: validate-simple, when: test_ping|bool } + - { role: validate-tempest, when: run_tempest|bool } diff --git a/toci-quickstart/playbooks/multinode.yml b/toci-quickstart/playbooks/multinode.yml index 3aadc8599..f4fef39e7 100644 --- a/toci-quickstart/playbooks/multinode.yml +++ b/toci-quickstart/playbooks/multinode.yml @@ -1,190 +1,7 @@ --- - include: quickstart.yml - -- name: Add the overcloud nodes to the generated inventory - hosts: undercloud - gather_facts: yes - tags: - - overcloud-deploy - vars: - inventory: multinode - roles: - - tripleo-inventory - -- name: Create configs on subnodes - hosts: overcloud - roles: - # When doing mixed upgrade, we need different repos on undercloud - # vs. overcloud. Rely on $UPGRADE_RELEASE together with - # bootstrap-overcloud-full-minimal.sh to setup overcloud. - - role: repo-setup - when: not mixed_upgrade|default(false)|bool - tasks: - - name: Create a clean hosts file on subnodes - copy: - dest: /etc/hosts - content: | - 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 - ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 - become: true - tags: - - undercloud-setup - -- name: Prepare the undercloud for installation - hosts: undercloud - roles: - - undercloud-setup - tags: - - undercloud-setup - -- name: Run DLRN gate role and install repo - hosts: undercloud - vars: - artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz" - roles: - - build-test-packages - - { role: install-built-repo, when: compressed_gating_repo is defined } - tags: - - build - -- name: Install built packages on subnodes - hosts: overcloud - vars: - ib_repo_host: undercloud - roles: - - role: repo-setup - when: not mixed_upgrade|default(false)|bool - - role: install-built-repo - when: hostvars['undercloud']['compressed_gating_repo'] is defined and not mixed_upgrade|default(false)|bool - - tags: - - build - -- name: Install the undercloud - hosts: undercloud - roles: - - undercloud-deploy - -- name: Configure tripleo-validations - hosts: undercloud - gather_facts: no - tags: - - tripleo-validations - vars: - run_tripleo_validations_setup: True - roles: - - { role: tripleo-validations, - when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} - -- name: Validate the undercloud - hosts: undercloud - roles: - - validate-undercloud - -- name: Run overcloud prep config - hosts: undercloud - gather_facts: no - roles: - - role: overcloud-prep-config - # only run when we know we have to, save time otherwise - when: mixed_upgrade|default(false)|bool - tags: - - overcloud-prep-config - -- name: Run overcloud prep roles - hosts: undercloud - gather_facts: no - roles: - - { role: overcloud-prep-images, step_overcloud_image: false, step_glance_upload: true, step_register: false } - -- name: Run tripleo-validations pre-introspection tests - hosts: undercloud - gather_facts: no - tags: - - tripleo-validations - vars: - validations_group: ['pre-introspection'] - roles: - - { role: tripleo-validations, - when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} - -- name: Prepare for containerized deployment - hosts: undercloud - gather_facts: no - tags: - - overcloud-prep-containers - roles: - - role: overcloud-prep-containers - when: containerized_overcloud|bool or containerized_overcloud_upgrade|bool - -- name: Run tripleo-validations pre-deployment tests - hosts: undercloud - gather_facts: no - tags: - - tripleo-validations - vars: - validations_group: ['pre-deployment'] - roles: - - { role: tripleo-validations, - when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} - -- name: Deploy the overcloud - hosts: undercloud - gather_facts: no - roles: - - overcloud-deploy - environment: - TRIPLEO_ROOT: "{{ lookup('env','TRIPLEO_ROOT') }}" - -- 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" - -- name: Run tripleo-validations post-deployment tests - hosts: undercloud - gather_facts: no - tags: - - tripleo-validations - vars: - validations_group: ['post-deployment'] - roles: - - { role: tripleo-validations, - when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool} - -- name: Set up repos on subnodes for upgrading - hosts: overcloud - vars: - ib_repo_host: undercloud - roles: - - role: repo-setup - when: mixed_upgrade|default(false)|bool - - role: install-built-repo - when: hostvars['undercloud']['compressed_gating_repo'] is defined and mixed_upgrade|default(false)|bool - -- name: Upgrade Tripleo - hosts: undercloud - tags: - - overcloud-upgrade - gather_facts: no - roles: - - role: overcloud-upgrade - when: containerized_overcloud_upgrade|bool - -# Validate the deployment -- name: validate the overcloud - hosts: undercloud - tags: - - overcloud-validate - gather_facts: no - roles: - - { role: validate-simple, when: test_ping|bool } - - { role: validate-tempest, when: run_tempest|bool } +- include: multinode-undercloud.yml +- include: multinode-overcloud-prep.yml +- include: multinode-overcloud.yml +- include: multinode-overcloud-upgrade.yml +- include: multinode-validate.yml