Skip to content

Commit

Permalink
Resolve issue with undefined facts while running with tags
Browse files Browse the repository at this point in the history
Ansible fixed "issue" where gather_facts was working with any tag defined
Now this behaviour changed and we need to gather facts not depending on
the provided tag. Some info provided here [1]

[1] ansible/ansible#57529

Change-Id: Idc8be5f490cba79e70a45d159718ab68c78cbcee
  • Loading branch information
Dmitriy Rabotyagov committed May 15, 2020
1 parent 103f3d8 commit 9b50edb
Show file tree
Hide file tree
Showing 51 changed files with 374 additions and 97 deletions.
2 changes: 1 addition & 1 deletion inventory/group_vars/all/ceph.yml
Expand Up @@ -21,7 +21,7 @@ mgr_group_name: "{{ mon_group_name }}"
osd_group_name: ceph-osd
rgw_group_name: ceph-rgw
mds_group_name: ceph-mds
nfs_group_name: nfss
nfs_group_name: ceph-nfs
ceph_origin: "{{ (ansible_pkg_mgr == 'zypper') | ternary('distro', 'repository') }}"
ceph_repository: community
# The _stable_release var is used by both the OSA ceph_client role and the
Expand Down
65 changes: 21 additions & 44 deletions playbooks/ceph-install.yml
Expand Up @@ -13,9 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather ceph-mon facts
hosts: ceph-mon
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install ceph mons
hosts: ceph-mon
user: root
gather_facts: false
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/ceph_ansible.yml"
Expand Down Expand Up @@ -44,17 +51,6 @@
- ansible_pkg_mgr in ['yum', 'dnf']
- ansible_service_mgr == 'systemd'

# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins
include_role:
name: apt_package_pinning
vars:
apt_package_pinning_file_name: "ceph_community_pin.pref"
apt_package_pinning_priority: "{{ (ceph_repository == 'community') | ternary(1000, 100) }}"
apt_pinned_packages: [{ package: '*', release: 'ceph.com' }]
when:
- ansible_pkg_mgr == 'apt'

roles:
- role: ceph-defaults
tags:
Expand Down Expand Up @@ -95,38 +91,23 @@
- ceph
- ceph-mon

- name: Gather ceph-osd facts
hosts: ceph-osd
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install ceph osds
hosts: ceph-osd
user: root
gather_facts: false
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/ceph_ansible.yml"
pre_tasks:

- import_tasks: common-tasks/ceph-server.yml

- name: Gather ceph-mon facts
action: setup
delegate_to: "{{ item }}"
delegate_facts: yes
with_items: "{{ groups[mon_group_name] }}"
when:
- inventory_hostname == ansible_play_hosts[0]
tags:
- ceph-osd
- ceph-mon-facts

# Set the priority of the ceph community apt repo either above or below that of UCA or distro sources
- name: Set apt package pins
include_role:
name: apt_package_pinning
vars:
apt_package_pinning_file_name: "ceph_community_pin.pref"
apt_package_pinning_priority: "{{ (ceph_repository == 'community') | ternary(1000, 100) }}"
apt_pinned_packages: [{ package: '*', release: 'ceph.com' }]
when:
- ansible_pkg_mgr == 'apt'

roles:
- role: ceph-defaults
tags:
Expand Down Expand Up @@ -162,23 +143,19 @@
- ceph
- ceph-osd

- name: Gather ceph-mds facts
hosts: ceph-mds
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install ceph metadata servers
hosts: ceph-mds
gather_facts: false
user: root
vars_files:
- "defaults/{{ install_method }}_install.yml"
- "defaults/ceph_ansible.yml"
pre_tasks:
- name: Gather ceph-mon facts
action: setup
delegate_to: "{{ item }}"
delegate_facts: yes
with_items: "{{ groups[mon_group_name] }}"
when:
- inventory_hostname == ansible_play_hosts[0]
tags:
- ceph-mon-facts
- ceph-mds
roles:
- role: ceph-defaults
tags:
Expand Down
7 changes: 7 additions & 0 deletions playbooks/ceph-nfs-install.yml
Expand Up @@ -13,8 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather ceph-nfs facts
hosts: ceph-nfs
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install nfs-ganesha server
hosts: ceph-nfs
gather_facts: false
user: root
vars_files:
- "defaults/{{ install_method }}_install.yml"
Expand Down
9 changes: 8 additions & 1 deletion playbooks/ceph-rgw-install.yml
Expand Up @@ -14,10 +14,17 @@
# limitations under the License.

- import_playbook: ceph-rgw-keystone-setup.yml
when: (groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or (ceph_rgws | length > 0)
when: (groups[rgw_group_name] is defined and groups[rgw_group_name] | length > 0) or (ceph_rgws | length > 0)

- name: Gather ceph-rgw facts
hosts: ceph-rgw
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install ceph radosgw
hosts: ceph-rgw
gather_facts: false
user: root
vars_files:
- "defaults/{{ install_method }}_install.yml"
Expand Down
8 changes: 7 additions & 1 deletion playbooks/common-playbooks/cinder.yml
Expand Up @@ -13,10 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather cinder facts
hosts: "{{ cinder_hosts }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install cinder services
hosts: "{{ cinder_hosts }}"
serial: "{{ cinder_serial }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
gather_facts: false
user: root
environment: "{{ deployment_environment_variables | default({}) }}"
vars_files:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/common-playbooks/glance.yml
Expand Up @@ -13,10 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather glance facts
hosts: "{{ glance_hosts }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install glance services
hosts: "{{ glance_hosts }}"
serial: "{{ glance_serial }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
gather_facts: false
user: root
environment: "{{ deployment_environment_variables | default({}) }}"
vars_files:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/common-playbooks/neutron.yml
Expand Up @@ -13,10 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather neutron facts
hosts: "{{ neutron_hosts }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install neutron services
hosts: "{{ neutron_hosts }}"
serial: "{{ neutron_serial }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
gather_facts: false
user: root
environment: "{{ deployment_environment_variables | default({}) }}"
vars_files:
Expand Down
6 changes: 6 additions & 0 deletions playbooks/common-playbooks/nova.yml
Expand Up @@ -13,6 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather nova facts
hosts: "{{ nova_hosts }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install nova services
hosts: "{{ nova_hosts }}"
serial: "{{ nova_serial }}"
Expand Down
8 changes: 7 additions & 1 deletion playbooks/containers-lxc-create.yml
Expand Up @@ -60,10 +60,16 @@
setup:
gather_subset: "network,hardware,virtual"

- name: Gather lxc containers facts
hosts: all_lxc_containers
gather_facts: true
tags:
- always

- name: Configure containers default software
hosts: all_lxc_containers
user: root
gather_facts: true
gather_facts: false
vars_files:
- defaults/repo_packages/openstack_services.yml
- "defaults/{{ install_method }}_install.yml"
Expand Down
10 changes: 8 additions & 2 deletions playbooks/containers-lxc-host.yml
Expand Up @@ -13,10 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather lxc hosts facts
hosts: "{{ lxc_host_group | default('lxc_hosts') }}"
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Basic lxc host setup
hosts: "{{ lxc_host_group | default('lxc_hosts')}}"
hosts: "{{ lxc_host_group | default('lxc_hosts') }}"
user: root
gather_facts: "{{ osa_gather_facts | default(True) }}"
gather_facts: false
vars_files:
- defaults/repo_packages/openstack_services.yml
- "defaults/{{ install_method }}_install.yml"
Expand Down
12 changes: 9 additions & 3 deletions playbooks/containers-nspawn-create.yml
Expand Up @@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Gather nspawn container host facts
- name: Gather nspawn host facts
hosts: "{{ nspawn_host_group | default('nspawn_hosts') }}"
gather_facts: true

tags:
- always

- name: Set nspawn containers group
hosts: "{{ container_group | default('all_containers') }}"
Expand Down Expand Up @@ -61,10 +62,15 @@
command: "btrfs quota rescan -w /var/lib/machines"
changed_when: false

- name: Gather nspawn containers facts
hosts: all_nspawn_containers
gather_facts: true
tags:
- always

- name: Configure containers default software
hosts: all_nspawn_containers
gather_facts: true
gather_facts: false
user: root
vars_files:
- defaults/repo_packages/openstack_services.yml
Expand Down
8 changes: 7 additions & 1 deletion playbooks/containers-nspawn-host.yml
Expand Up @@ -13,9 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Additional nspawn host setup
- name: Gather nspawn hosts facts
hosts: "{{ nspawn_host_group | default('nspawn_hosts') }}"
gather_facts: true
tags:
- always

- name: Additional nspawn host setup
hosts: "{{ nspawn_host_group | default('nspawn_hosts') }}"
gather_facts: false
vars_files:
- "defaults/{{ install_method }}_install.yml"
user: root
Expand Down
8 changes: 7 additions & 1 deletion playbooks/etcd-install.yml
Expand Up @@ -13,9 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Install etcd server cluster
- name: Gather etcd facts
hosts: etcd
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install etcd server cluster
hosts: etcd
gather_facts: false
user: root
pre_tasks:
- include_tasks: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml"
Expand Down
10 changes: 8 additions & 2 deletions playbooks/galera-install.yml
Expand Up @@ -13,9 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Galera container config
- name: Gather galera facts
hosts: galera_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Galera container config
hosts: galera_all
gather_facts: false
serial: 1
user: root
tasks:
Expand All @@ -34,7 +40,7 @@

- name: Install galera server
hosts: galera_all
gather_facts: "{{ osa_gather_facts | default(True) }}"
gather_facts: false
serial: 1
user: root
roles:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/haproxy-install.yml
Expand Up @@ -13,9 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: haproxy base config
- name: Gather haproxy facts
hosts: haproxy
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: haproxy base config
hosts: haproxy
gather_facts: false
serial: "50%"
user: root
pre_tasks:
Expand Down
8 changes: 7 additions & 1 deletion playbooks/infra-journal-remote.yml
Expand Up @@ -13,9 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Install Journal-Remote
- name: Gather facts
hosts: hosts
gather_facts: "{{ osa_gather_facts | default(True) }}"
tags:
- always

- name: Install Journal-Remote
hosts: hosts
gather_facts: false
become: true
handlers:
- name: Restart systemd-journald
Expand Down

0 comments on commit 9b50edb

Please sign in to comment.