common: make the delegate_facts feature optional

Since we encountered issue with this on ansible2.2, this commit provide
the ability to enable or disable it regarding which ansible we are
running.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/2123/head
Guillaume Abrioux 2017-10-31 14:39:29 +01:00
parent c28882c1cd
commit 4596fbaac1
2 changed files with 13 additions and 0 deletions

View File

@ -19,6 +19,9 @@
tags: tags:
- always - always
vars:
delegate_facts_host: True
tasks: tasks:
# If we can't get python2 installed before any module is used we will fail # If we can't get python2 installed before any module is used we will fail
# so just try what we can to get it installed # so just try what we can to get it installed
@ -40,11 +43,18 @@
when: when:
- systempython2.stat.exists is undefined or systempython2.stat.exists == false - systempython2.stat.exists is undefined or systempython2.stat.exists == false
- name: gather facts
setup:
when:
- not delegate_facts_host | bool
- name: gather and delegate facts - name: gather and delegate facts
setup: setup:
delegate_to: "{{ item }}" delegate_to: "{{ item }}"
delegate_facts: True delegate_facts: True
with_items: "{{ groups['all'] }}" with_items: "{{ groups['all'] }}"
when:
- delegate_facts_host | bool
- name: install required packages for fedora > 23 - name: install required packages for fedora > 23
raw: sudo dnf -y install python2-dnf libselinux-python ntp raw: sudo dnf -y install python2-dnf libselinux-python ntp

View File

@ -126,6 +126,7 @@ setenv=
ANSIBLE_CALLBACK_WHITELIST = profile_tasks ANSIBLE_CALLBACK_WHITELIST = profile_tasks
# only available for ansible >= 2.2 # only available for ansible >= 2.2
ANSIBLE_STDOUT_CALLBACK = debug ANSIBLE_STDOUT_CALLBACK = debug
ansible2.2: DELEGATE_FACTS_HOST = False
docker_cluster: PLAYBOOK = site-docker.yml.sample docker_cluster: PLAYBOOK = site-docker.yml.sample
docker_cluster_collocation: PLAYBOOK = site-docker.yml.sample docker_cluster_collocation: PLAYBOOK = site-docker.yml.sample
update_docker_cluster: PLAYBOOK = site-docker.yml.sample update_docker_cluster: PLAYBOOK = site-docker.yml.sample
@ -204,6 +205,7 @@ commands=
rhcs: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} repo_url={env:REPO_URL:} rhel7_repo_url={env:RHEL7_REPO_URL:}" --skip-tags "vagrant_setup" rhcs: ansible-playbook -vv -i {changedir}/hosts {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} repo_url={env:REPO_URL:} rhel7_repo_url={env:RHEL7_REPO_URL:}" --skip-tags "vagrant_setup"
ansible-playbook -vv -i {changedir}/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\ ansible-playbook -vv -i {changedir}/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} --extra-vars "\
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \ fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \
ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \ ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \
ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \ ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \
@ -231,6 +233,7 @@ commands=
# handlers/idempotency test # handlers/idempotency test
ansible-playbook -vv -i {changedir}/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} \ ansible-playbook -vv -i {changedir}/hosts {toxinidir}/{env:PLAYBOOK:site.yml.sample} \
--extra-vars "\ --extra-vars "\
delegate_facts_host={env:DELEGATE_FACTS_HOST:True} \
fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \ fetch_directory={env:FETCH_DIRECTORY:{changedir}/fetch} \
ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \ ceph_stable_release={env:CEPH_STABLE_RELEASE:luminous} \
ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \ ceph_docker_registry={env:CEPH_DOCKER_REGISTRY:docker.io} \