Workaround openSUSE ansible_os_family issue

https://github.com/ansible/ansible/issues/17573 was filed
regarding incorrect detection of ansible_os_family for openSUSE
distributions. https://github.com/ansible/ansible/pull/17575
has been submitted, but in the interim we need to work around
this issue.

Change-Id: Ic88dd7c76df761ffc39369ddbd1d75284390b74e
This commit is contained in:
stephane 2016-09-15 12:56:07 -07:00 committed by Stephanie Miller
parent 5644b68a54
commit add3cfb7e4
2 changed files with 28 additions and 0 deletions

View File

@ -14,6 +14,20 @@
#
# TODO: Consider converting to ansible virt module.
---
# NOTE(cinerama) openSUSE Tumbleweed & Leap have different distribution
# IDs which are not currently accounted for in Ansible, so adjust facts
# so we can have shared defaults for the whole SuSE family.
# This change can be removed when the pull request at
# https://github.com/ansible/ansible/pull/17575 lands in a new version.
- name: Ensure openSUSE Tumbleweed has the correct family
set_fact:
ansible_os_family: "Suse"
when: ansible_os_family | search("openSUSE Tumbleweed")
- name: Ensure openSUSE Leap has the correct family
set_fact:
ansible_os_family: "Suse"
when: (ansible_os_family | search("SUSE LINUX")) or
(ansible_os_family | search("openSUSE Leap"))
- name: "Update apt cache if Ubuntu/Debian"
apt:
update_cache: yes

View File

@ -13,6 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
# NOTE(cinerama) openSUSE Tumbleweed & Leap have different distribution
# IDs which are not currently accounted for in Ansible, so adjust facts
# so we can have shared defaults for the whole SuSE family.
# This change can be removed when the pull request at
# https://github.com/ansible/ansible/pull/17575 lands in a new version.
- name: Ensure openSUSE Tumbleweed has the correct family
set_fact:
ansible_os_family: "Suse"
when: ansible_os_family | search("openSUSE Tumbleweed")
- name: Ensure openSUSE Leap has the correct family
set_fact:
ansible_os_family: "Suse"
when: (ansible_os_family | search("SUSE LINUX")) or
(ansible_os_family | search("openSUSE Leap"))
# NOTE(cinerama) dummy-defaults.yml is an empty defaults file. We use it
# here to ensure that with_first_found won't fail should we not have
# defaults for a particular distribution, version, etc.