From b5d2ea269f30e272ae33c71bafd0e512dd9f6e31 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Fri, 10 Aug 2018 08:16:30 -0400 Subject: [PATCH] don't use "static" field while including tasks Instead used "import_tasks" and "include_tasks" to tell whether tasks must be included statically or dynamically. Fixes: https://github.com/ceph/ceph-ansible/issues/2998 Signed-off-by: Rishabh Dave --- .../untested-by-ci/purge-multisite.yml | 4 +- roles/ceph-common/tasks/main.yml | 60 +++++++------------ roles/ceph-mon/tasks/main.yml | 6 +- roles/ceph-osd/tasks/main.yml | 54 ++++++----------- roles/ceph-rgw/tasks/main.yml | 42 +++++-------- roles/ceph-rgw/tasks/multisite/main.yml | 12 ++-- 6 files changed, 60 insertions(+), 118 deletions(-) diff --git a/infrastructure-playbooks/untested-by-ci/purge-multisite.yml b/infrastructure-playbooks/untested-by-ci/purge-multisite.yml index c17500e52..37608ea09 100644 --- a/infrastructure-playbooks/untested-by-ci/purge-multisite.yml +++ b/infrastructure-playbooks/untested-by-ci/purge-multisite.yml @@ -6,6 +6,6 @@ - include_tasks: roles/ceph-rgw/tasks/multisite/destroy.yml handlers: - - include: roles/ceph-rgw/handlers/main.yml # Ansible 2.1.0 bug will ignore included handlers without this - static: True + - name: import_tasks roles/ceph-rgw/handlers/main.yml + import_tasks: roles/ceph-rgw/handlers/main.yml diff --git a/roles/ceph-common/tasks/main.yml b/roles/ceph-common/tasks/main.yml index 9a024246f..049cacf45 100644 --- a/roles/ceph-common/tasks/main.yml +++ b/roles/ceph-common/tasks/main.yml @@ -1,55 +1,39 @@ --- -- name: include installs/install_on_redhat.yml - include: installs/install_on_redhat.yml - when: - - ansible_os_family == 'RedHat' +- name: include_tasks installs/install_on_redhat.yml + include_tasks: installs/install_on_redhat.yml + when: ansible_os_family == 'RedHat' tags: - package-install - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include installs/install_on_suse.yml - include: installs/install_on_suse.yml - when: - - ansible_os_family == 'Suse' +- name: include_tasks installs/install_on_suse.yml + include_tasks: installs/install_on_suse.yml + when: ansible_os_family == 'Suse' tags: - package-install - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include installs/install_on_debian.yml - include: installs/install_on_debian.yml - when: - - ansible_os_family == 'Debian' +- name: include_tasks installs/install_on_debian.yml + include_tasks: installs/install_on_debian.yml + when: ansible_os_family == 'Debian' tags: - package-install - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include installs/install_on_clear.yml - include: installs/install_on_clear.yml - when: - - ansible_os_family == 'ClearLinux' +- name: include_tasks installs/install_on_clear.yml + include_tasks: installs/install_on_clear.yml + when: ansible_os_family == 'ClearLinux' tags: - package-install - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include ntp debian setup tasks - include: "misc/ntp_debian.yml" +- name: include_tasks "misc/ntp_debian.yml" + include_tasks: "misc/ntp_debian.yml" when: - ansible_os_family == 'Debian' - ntp_service_enabled - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include ntp rpm setup tasks - include: "misc/ntp_rpm.yml" +- name: include_tasks "misc/ntp_rpm.yml" + include_tasks: "misc/ntp_rpm.yml" when: - ansible_os_family in ['RedHat', 'Suse'] - ntp_service_enabled - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False - name: get ceph version command: ceph --version @@ -69,20 +53,16 @@ tags: - always -- name: include checks/check_firewall.yml - include: checks/check_firewall.yml +- name: include_tasks checks/check_firewall.yml + include_tasks: checks/check_firewall.yml when: - check_firewall - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include misc/configure_firewall_rpm.yml - include: misc/configure_firewall_rpm.yml +- name: include_tasks misc/configure_firewall_rpm.yml + include_tasks: misc/configure_firewall_rpm.yml when: - configure_firewall - ansible_os_family in ['RedHat', 'Suse'] - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False - name: include facts_mon_fsid.yml include_tasks: facts_mon_fsid.yml diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 3cf192d09..ef6eb6211 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -13,11 +13,9 @@ import_tasks: start_monitor.yml when: not containerized_deployment -- name: include ceph_keys.yml - include: ceph_keys.yml +- name: include_tasks ceph_keys.yml + include_tasks: ceph_keys.yml when: not containerized_deployment - # this avoids the bug mentioned here: https://github.com/ansible/ansible/issues/18206 - static: no - name: include secure_cluster.yml include_tasks: secure_cluster.yml diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 15399c72a..d7ed8e83a 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -1,8 +1,6 @@ --- -- name: include system_tuning.yml - include: system_tuning.yml - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks system_tuning.yml + include_tasks: system_tuning.yml - name: install dependencies package: @@ -12,10 +10,8 @@ - not containerized_deployment - ansible_os_family != 'ClearLinux' -- name: include common.yml - include: common.yml - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks common.yml + include_tasks: common.yml - name: include ceph_disk_cli_options_facts.yml include_tasks: ceph_disk_cli_options_facts.yml @@ -35,61 +31,47 @@ when: - osd_scenario != 'lvm' -- name: include scenarios/collocated.yml - include: scenarios/collocated.yml +- name: include_tasks scenarios/collocated.yml + include_tasks: scenarios/collocated.yml when: - osd_scenario == 'collocated' - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include scenarios/non-collocated.yml - include: scenarios/non-collocated.yml +- name: include_tasks scenarios/non-collocated.yml + include_tasks: scenarios/non-collocated.yml when: - not osd_auto_discovery - osd_scenario == 'non-collocated' - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include scenarios/lvm.yml - include: scenarios/lvm.yml +- name: include_tasks scenarios/lvm.yml + include_tasks: scenarios/lvm.yml when: - osd_scenario == 'lvm' - lvm_volumes|length > 0 - not containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include scenarios/lvm-batch.yml - include: scenarios/lvm-batch.yml +- name: include_tasks scenarios/lvm-batch.yml + include_tasks: scenarios/lvm-batch.yml when: - osd_scenario == 'lvm' - devices|length > 0 - not containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include activate_osds.yml - include: activate_osds.yml +- name: include_tasks activate_osds.yml + include_tasks: activate_osds.yml when: - not containerized_deployment - osd_scenario != 'lvm' - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include start_osds.yml - include: start_osds.yml +- name: include_tasks start_osds.yml + include_tasks: start_osds.yml when: - not containerized_deployment - osd_scenario != 'lvm' - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include docker/main.yml - include: docker/main.yml +- name: include_tasks docker/main.yml + include_tasks: docker/main.yml when: - containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False - name: set_fact openstack_keys_tmp - preserve backward compatibility after the introduction of the ceph_keys module set_fact: diff --git a/roles/ceph-rgw/tasks/main.yml b/roles/ceph-rgw/tasks/main.yml index 9abb84424..9d86b1c56 100644 --- a/roles/ceph-rgw/tasks/main.yml +++ b/roles/ceph-rgw/tasks/main.yml @@ -2,42 +2,28 @@ - name: include common.yml include_tasks: common.yml -- name: include pre_requisite.yml - include: pre_requisite.yml - when: - - not containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks pre_requisite.yml + include_tasks: pre_requisite.yml + when: not containerized_deployment -- name: include openstack-keystone.yml - include: openstack-keystone.yml - when: - - radosgw_keystone_ssl|bool - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks openstack-keystone.yml + include_tasks: openstack-keystone.yml + when: radosgw_keystone_ssl|bool -- name: include start_radosgw.yml - include: start_radosgw.yml - when: - - not containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks start_radosgw.yml + include_tasks: start_radosgw.yml + when: not containerized_deployment -- name: include multisite/main.yml - include: multisite/main.yml +- name: include_tasks multisite/main.yml + include_tasks: multisite/main.yml when: - rgw_zone != "" - rgw_multisite - ceph_release_num[ceph_release] >= ceph_release_num.jewel - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include docker/main.yml - include: docker/main.yml - when: - - containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False +- name: include_tasks docker/main.yml + include_tasks: docker/main.yml + when: containerized_deployment - name: create rgw pools if rgw_create_pools is defined command: "{{ docker_exec_cmd }} ceph --connect-timeout 5 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num }}" diff --git a/roles/ceph-rgw/tasks/multisite/main.yml b/roles/ceph-rgw/tasks/multisite/main.yml index 1f1b1a6fb..dd8ac4ea6 100644 --- a/roles/ceph-rgw/tasks/multisite/main.yml +++ b/roles/ceph-rgw/tasks/multisite/main.yml @@ -3,21 +3,17 @@ include_tasks: checks.yml # Include the tasks depending on the zone type -- name: include master multisite tasks - include: master.yml +- name: include_tasks master.yml + include_tasks: master.yml when: - rgw_zonemaster is defined - rgw_zonemaster - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False -- name: include secondary multisite tasks - include: secondary.yml +- name: include_tasks secondary.yml + include_tasks: secondary.yml when: - rgw_zonesecondary is defined - rgw_zonesecondary - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False # Continue with common tasks - name: add zone to rgw stanza in ceph.conf -- 2.39.5