Collect physical host facts if missing

Allow the role to collect facts for the physical host if missing,
since the role has a hard dependency on checking the physical host's
kernel version.

In the OSA container create playbook[1], facts are collected only
if the physical host itself is included in the playbook scope. When
a '--limit containername' parameter is used, no physical host facts
are collected and the role fails with:

The conditional check 'hostvars[physical_host]['ansible_kernel'] |
version_compare('3.18.0-0-generic', '<')' failed. The error was:
Version comparison: 'dict object' has no attribute 'ansible_kernel'

Change-Id: Id84aefed6c0129909cb6153258863564c7cc914a
This commit is contained in:
Logan V 2018-03-18 22:37:54 -05:00
parent 2520c83523
commit 59f326b63e
1 changed files with 8 additions and 0 deletions

View File

@ -29,6 +29,14 @@
tags:
- always
- name: Collect physical host facts if missing
action:
module: setup
delegate_to: "{{ physical_host }}"
delegate_facts: yes
when:
- hostvars[physical_host]['ansible_kernel'] is not defined
- name: Kernel version and LXC backing store check
debug:
msg: "Using overlayfs is not recommended when using Kernel version < 3.18"