Skip to content

Commit 9aa5874

Browse files
authored
Merge pull request #48 from stackhpc/ansible-facts
Use ansible_facts to reference facts
2 parents 7964f3e + 968556e commit 9aa5874

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ libvirt_host_uri: >-
6666
6767
# Whether the python3 version of the libvirt python bindings should be
6868
# installed. If false, the python 2 bindings will be installed.
69-
libvirt_host_python3: "{{ ansible_python.version.major == 3 }}"
69+
libvirt_host_python3: "{{ ansible_facts.python.version.major == 3 }}"
7070

7171
# Whether to install and enable the libvirt daemon.
7272
libvirt_host_install_daemon: true

tasks/install-daemon.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
retries: 3
3232
become: True
3333
when:
34-
- ansible_os_family == "RedHat"
34+
- ansible_facts.os_family == "RedHat"
3535
- libvirt_host_qemu_emulators | length > 0
3636

3737
- name: Ensure QEMU emulator packages are installed
@@ -40,7 +40,7 @@
4040
state: present
4141
loop: "{{ libvirt_host_qemu_emulators | flatten(levels=1) }}"
4242
# NOTE(mgoddard): CentOS 8 does not provide separate packages per-emulator.
43-
when: ansible_os_family != "RedHat" or ansible_distribution_major_version | int == 7
43+
when: ansible_facts.os_family != "RedHat" or ansible_facts.distribution_major_version | int == 7
4444
register: result
4545
until: result is success
4646
retries: 3

tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
include: "{{ post_install_path }}"
1212
with_first_found:
1313
- files:
14-
- post-install-{{ ansible_distribution }}.yml
15-
- post-install-{{ ansible_os_family }}.yml
14+
- post-install-{{ ansible_facts.distribution }}.yml
15+
- post-install-{{ ansible_facts.os_family }}.yml
1616
skip: true
1717
loop_control:
1818
loop_var: post_install_path

tasks/post-install-Debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
become: true
3535
when:
3636
- libvirt_host_install_daemon | bool
37-
- ansible_apparmor.status | default == 'enabled'
37+
- ansible_facts.apparmor.status | default == 'enabled'
3838
- item.type == "dir"
3939
loop: "{{ libvirt_host_pools | flatten(levels=1) }}"
4040
notify:

tasks/prelude.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- name: gather os specific variables
55
include_vars: "{{ item }}"
66
with_first_found:
7-
- "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
8-
- "{{ ansible_distribution }}.yml"
9-
- "{{ ansible_os_family }}.yml"
7+
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
8+
- "{{ ansible_facts.distribution }}.yml"
9+
- "{{ ansible_facts.os_family }}.yml"
1010
tags: vars

vars/Debian.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ libvirt_host_libvirt_packages_common:
66
# List of all daemon packages to install.
77
libvirt_host_libvirt_packages_libvirt_daemon:
88
# The apparmor package contains the apparmor_parser tool.
9-
- "{% if ansible_apparmor.status| default == 'enabled' %}apparmor{% endif %}"
9+
- "{% if ansible_facts.apparmor.status| default == 'enabled' %}apparmor{% endif %}"
1010
- >-
11-
{%- if (ansible_distribution == "Ubuntu" and
12-
ansible_distribution_major_version is version_compare('16.04', '<')) or
13-
(ansible_distribution == "Debian" and
14-
ansible_distribution_major_version is version_compare('8', '<')) -%}
11+
{%- if (ansible_facts.distribution == "Ubuntu" and
12+
ansible_facts.distribution_major_version is version_compare('16.04', '<')) or
13+
(ansible_facts.distribution == "Debian" and
14+
ansible_facts.distribution_major_version is version_compare('8', '<')) -%}
1515
libvirt-bin
1616
{%- else -%}
1717
libvirt-daemon-system

0 commit comments

Comments
 (0)