From 4fe66070041fb8df49f4608e1ab1f8a402ecfd3f Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 10:16:09 -0600 Subject: [PATCH 1/6] purge-cluster: do not set group name vars at playbook level This has the behavior of overriding custom values set in group_vars. I've added defaults to the rest of the group names so that if they are not overridden in group_vars then defaults will be used. See: https://bugzilla.redhat.com/show_bug.cgi?id=1354700 Signed-off-by: Andrew Schoen --- infrastructure-playbooks/purge-cluster.yml | 66 +++++++--------------- 1 file changed, 20 insertions(+), 46 deletions(-) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 8bd1471eb..df68836b1 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -33,23 +33,14 @@ - name: gather facts on all hosts - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - client_group_name: clients - hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" - - "{{ rbdmirror_group_name }}" - - "{{ nfs_group_name }}" - - "{{ client_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" + - "{{ nfs_group_name|default('nfss') }}" + - "{{ client_group_name|default('clients') }}" become: true @@ -62,7 +53,7 @@ mds_group_name: mdss hosts: - - "{{ mds_group_name }}" + - "{{ mds_group_name|default('mdss') }}" gather_facts: false # Already gathered previously @@ -93,7 +84,7 @@ rgw_group_name: rgws hosts: - - "{{ rgw_group_name }}" + - "{{ rgw_group_name|default('rgws') }}" gather_facts: false # Already gathered previously @@ -124,7 +115,7 @@ rbdmirror_group_name: rbd-mirrors hosts: - - "{{ rbdmirror_group_name }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" gather_facts: false # Already gathered previously @@ -150,7 +141,7 @@ nfs_group_name: nfss hosts: - - "{{ nfs_group_name }}" + - "{{ nfs_group_name|default('nfss') }}" gather_facts: false # Already gathered previously @@ -180,7 +171,7 @@ osd_group_name: osds hosts: - - "{{ osd_group_name }}" + - "{{ osd_group_name|default('osds') }}" gather_facts: false # Already gathered previously @@ -358,7 +349,7 @@ restapi_group_name: restapis hosts: - - "{{ mon_group_name }}" + - "{{ mon_group_name|default('mons') }}" gather_facts: false # Already gathered previously @@ -390,14 +381,6 @@ - name: final cleanup - check any running ceph, purge ceph packages, purge config and remove data vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - client_group_name: clients - # When set to true both groups of packages are purged. # This can cause problem with qemu-kvm purge_all_packages: true @@ -423,13 +406,13 @@ - python-rbd hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" - - "{{ rbdmirror_group_name }}" - - "{{ nfs_group_name }}" - - "{{ client_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" + - "{{ nfs_group_name|default('nfss') }}" + - "{{ client_group_name|default('clients') }}" gather_facts: false # Already gathered previously @@ -554,15 +537,6 @@ - name: purge fetch directory - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbdmirrors - nfs_group_name: nfss - restapi_group_name: restapis - hosts: - localhost From 46f26bec1374ab957bec88e0b44878a95ac15248 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 13:16:12 -0600 Subject: [PATCH 2/6] rolling-update: do not set group name vars at playbook level Signed-off-by: Andrew Schoen --- infrastructure-playbooks/rolling_update.yml | 25 +++++++-------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/infrastructure-playbooks/rolling_update.yml b/infrastructure-playbooks/rolling_update.yml index d258020af..1d3c9f281 100644 --- a/infrastructure-playbooks/rolling_update.yml +++ b/infrastructure-playbooks/rolling_update.yml @@ -34,17 +34,12 @@ - name: gather facts and check the init system - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" become: True tasks: @@ -55,13 +50,12 @@ - name: upgrade ceph mon cluster vars: - mon_group_name: mons health_mon_check_retries: 5 health_mon_check_delay: 10 upgrade_ceph_packages: True hosts: - - "{{ mon_group_name }}" + - "{{ mon_group_name|default('mons') }}" serial: 1 become: True @@ -170,13 +164,12 @@ - name: upgrade ceph osds cluster vars: - osd_group_name: osds health_osd_check_retries: 40 health_osd_check_delay: 30 upgrade_ceph_packages: True hosts: - - "{{ osd_group_name }}" + - "{{ osd_group_name|default('osds') }}" serial: 1 become: True @@ -314,11 +307,10 @@ - name: upgrade ceph mdss cluster vars: - mds_group_name: mdss upgrade_ceph_packages: True hosts: - - "{{ mds_group_name }}" + - "{{ mds_group_name|default('mdss') }}" serial: 1 become: True @@ -387,11 +379,10 @@ - name: upgrade ceph rgws cluster vars: - rgw_group_name: rgws upgrade_ceph_packages: True hosts: - - "{{ rgw_group_name }}" + - "{{ rgw_group_name|default('rgws') }}" serial: 1 become: True From 7289acb6b35c7e28593f67982aa6bdb88ed6477e Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 13:23:40 -0600 Subject: [PATCH 3/6] purge-docker-cluster: do not set group names vars at playbook level Signed-off-by: Andrew Schoen --- .../purge-docker-cluster.yml | 80 +++++-------------- 1 file changed, 18 insertions(+), 62 deletions(-) diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index 66cb1d768..bd5469f6d 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -46,11 +46,8 @@ - name: purge ceph mds cluster - vars: - mds_group_name: mdss - hosts: - - "{{ mds_group_name }}" + - "{{ mds_group_name|default('mdss') }}" become: true @@ -93,11 +90,8 @@ - name: purge ceph rgw cluster - vars: - rgw_group_name: rgws - hosts: - - "{{ rgw_group_name }}" + - "{{ rgw_group_name|default('rgws') }}" become: true @@ -140,11 +134,8 @@ - name: purge ceph rbd-mirror cluster - vars: - rbdmirror_group_name: rbd-mirrors - hosts: - - "{{ rbdmirror_group_name }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" become: true @@ -187,11 +178,8 @@ - name: purge ceph nfs cluster - vars: - nfs_group_name: nfss - hosts: - - "{{ nfs_group_name }}" + - "{{ nfs_group_name|default('nfss') }}" become: true @@ -243,11 +231,8 @@ - name: purge ceph osd cluster - vars: - osd_group_name: osds - hosts: - - "{{ osd_group_name }}" + - "{{ osd_group_name|default('osds') }}" become: true @@ -331,12 +316,8 @@ - name: purge ceph mon cluster - vars: - mon_group_name: mons - restapi_group_name: restapis - hosts: - - "{{ mon_group_name }}" + - "{{ mon_group_name|default('mons') }}" become: true @@ -389,21 +370,13 @@ - name: remove installed packages - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" - - "{{ rbdmirror_group_name }}" - - "{{ nfs_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" + - "{{ nfs_group_name|default('nfss') }}" become: true @@ -559,21 +532,13 @@ - name: purge ceph directories - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" - - "{{ rbdmirror_group_name }}" - - "{{ nfs_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" + - "{{ nfs_group_name|default('nfss') }}" gather_facts: false # Already gathered previously @@ -592,15 +557,6 @@ - name: purge fetch directory - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - restapi_group_name: restapis - hosts: - localhost From aef54d89d998b714d1b8f14f998c4271b8664bf5 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 13:32:57 -0600 Subject: [PATCH 4/6] switch-to-containers: do not set group name vars at playbook level Signed-off-by: Andrew Schoen --- ...inerized-to-containerized-ceph-daemons.yml | 44 +++++-------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index 26edb8866..b9df8bd4a 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -28,21 +28,13 @@ - name: make sure docker is present and started - vars: - mon_group_name: mons - osd_group_name: osds - mds_group_name: mdss - rgw_group_name: rgws - rbdmirror_group_name: rbd-mirrors - nfs_group_name: nfss - hosts: - - "{{ mon_group_name }}" - - "{{ osd_group_name }}" - - "{{ mds_group_name }}" - - "{{ rgw_group_name }}" - - "{{ rbdmirror_group_name }}" - - "{{ nfs_group_name }}" + - "{{ mon_group_name|default('mons') }}" + - "{{ osd_group_name|default('osds') }}" + - "{{ mds_group_name|default('mdss') }}" + - "{{ rgw_group_name|default('rgws') }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" + - "{{ nfs_group_name|default('nfss') }}" become: true @@ -97,7 +89,7 @@ restapi_group_name: restapis hosts: - - "{{ mon_group_name }}" + - "{{ mon_group_name|default('mons') }}" serial: 1 become: true @@ -187,7 +179,7 @@ osd_group_name: osds hosts: - - "{{ osd_group_name }}" + - "{{ osd_group_name|default('osds') }}" serial: 1 become: true @@ -288,11 +280,8 @@ - name: switching from non-containerized to containerized ceph mds - vars: - mds_group_name: mdss - hosts: - - "{{ mds_group_name }}" + - "{{ mds_group_name|default('mdss') }}" serial: 1 become: true @@ -348,11 +337,8 @@ - name: switching from non-containerized to containerized ceph rgw - vars: - rgw_group_name: rgws - hosts: - - "{{ rgw_group_name }}" + - "{{ rgw_group_name|default('rgws') }}" serial: 1 become: true @@ -409,11 +395,8 @@ - name: switching from non-containerized to containerized ceph rbd-mirror - vars: - rbdmirror_group_name: rbd-mirrors - hosts: - - "{{ rbdmirror_group_name }}" + - "{{ rbdmirror_group_name|default('rbdmirrors') }}" serial: 1 become: true @@ -468,11 +451,8 @@ - name: switching from non-containerized to containerized ceph nfs - vars: - nfs_group_name: nfss - hosts: - - "{{ nfs_group_name }}" + - "{{ nfs_group_name|default('nfss') }}" serial: 1 become: true From cf702b05cfbcdf76f4738a98ce2c779b53a224fc Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 13:45:22 -0600 Subject: [PATCH 5/6] purge-docker-cluster: do not include role defaults or group vars Doing so at playbook level overrides whatever values might be set for these in the user's group_vars directory that's relative to their inventory. Signed-off-by: Andrew Schoen --- .../purge-docker-cluster.yml | 61 ++----------------- 1 file changed, 5 insertions(+), 56 deletions(-) diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index bd5469f6d..d51d831c3 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -52,12 +52,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-mds/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ mds_group_name }}.yml - failed_when: false - name: disable ceph mds service service: @@ -96,12 +90,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-rgw/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ rgw_group_name }}.yml - failed_when: false - name: disable ceph rgw service service: @@ -140,12 +128,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-rbd-mirror/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ rbdmirror_group_name }}.yml - failed_when: false - name: disable ceph rbd-mirror service service: @@ -184,12 +166,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-nfs/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ nfs_group_name }}.yml - failed_when: false - name: disable ceph nfs service service: @@ -237,12 +213,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-osd/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ osd_group_name }}.yml - failed_when: false - name: disable ceph osd service service: @@ -322,15 +292,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-mon/defaults/main.yml - - include_vars: roles/ceph-restapi/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ mon_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ restapi_group_name }}.yml - failed_when: false - name: disable ceph mon service service: @@ -563,23 +524,11 @@ gather_facts: false tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ mds_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ rgw_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ rbdmirror_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ nfs_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ osd_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ mon_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ restapi_group_name }}.yml - failed_when: false + + - name: set fetch_directory value if not set + set_fact: + fetch_directory: "fetch/" + when: fetch_directory is not defined - name: purge fetch directory for localhost file: From e81d690aa02f8c531592bc26865d322af92f2adc Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 7 Mar 2017 13:51:48 -0600 Subject: [PATCH 6/6] switch-to-containers: do not include group vars or role defaults Doing so will override any values set for these in the group_vars directory relative to the users inventory. Signed-off-by: Andrew Schoen --- ...inerized-to-containerized-ceph-daemons.yml | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml index b9df8bd4a..10bf98a79 100644 --- a/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml +++ b/infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml @@ -95,15 +95,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-mon/defaults/main.yml - - include_vars: roles/ceph-restapi/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ mon_group_name }}.yml - failed_when: false - - include_vars: group_vars/{{ restapi_group_name }}.yml - failed_when: false - name: select a running monitor set_fact: mon_host={{ item }} @@ -185,12 +176,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-osd/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ osd_group_name }}.yml - failed_when: false - name: collect osd ids shell: | @@ -287,12 +272,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-mds/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ mds_group_name }}.yml - failed_when: false - name: stop ceph mds service service: @@ -344,12 +323,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-rgw/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ rgw_group_name }}.yml - failed_when: false - name: stop ceph rgw service service: @@ -402,12 +375,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-rbd-mirror/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ rbdmirror_group_name }}.yml - failed_when: false - name: stop ceph rbd mirror service service: @@ -458,12 +425,6 @@ become: true tasks: - - include_vars: roles/ceph-common/defaults/main.yml - - include_vars: roles/ceph-nfs/defaults/main.yml - - include_vars: group_vars/all.yml - failed_when: false - - include_vars: group_vars/{{ nfs_group_name }}.yml - failed_when: false - name: stop ceph nfs service service: