Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ libvirt_host_var_prefix: ""

# Where the Unix Domain sockets are stored
libvirt_host_socket_dir: >-
{%- if libvirt_host_var_prefix -%}
{%- if libvirt_host_var_prefix is truthy -%}
/var/run/{{ libvirt_host_var_prefix }}
{%- endif -%}

# Path to PID file which prevents mulitple instances of the daemon from
# spawning
libvirt_host_pid_path: >-
{%- if libvirt_host_var_prefix -%}
{%- if libvirt_host_var_prefix is truthy -%}
/var/run/{{ libvirt_host_var_prefix }}.pid
{%- endif -%}

# Command line arguments passed to libvirtd by the init system when
# libvirtd is started - quotes will be added
libvirt_host_libvirtd_args: >-
{%- if libvirt_host_pid_path -%}
{%- if libvirt_host_pid_path is truthy -%}
-p {{ libvirt_host_pid_path }}
{%- endif %}

# The libvirt connnection URI
libvirt_host_uri: >-
{%- if libvirt_host_socket_dir -%}
{%- if libvirt_host_socket_dir is truthy -%}
qemu+unix:///system?socket={{ libvirt_host_socket_dir }}/libvirt-sock
{%- endif %}

Expand Down
8 changes: 3 additions & 5 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
group: root
mode: 0755
become: true
when: libvirt_host_socket_dir | length > 0
when: libvirt_host_socket_dir is truthy

- name: Process lineinfile rules
lineinfile: "{{ rule.args }}"
Expand Down Expand Up @@ -56,8 +56,7 @@
become: true
loop: "{{ _libvirt_socket_services | selectattr('enabled') }}"
when:
- item.listen_address is not none
- item.listen_address | length > 0
- item.listen_address is truthy
loop_control:
label: "{{ item.service }}"
vars:
Expand All @@ -73,8 +72,7 @@
become: true
loop: "{{ _libvirt_socket_services | selectattr('enabled') }}"
when:
- item.listen_address is not none
- item.listen_address | length > 0
- item.listen_address is truthy
loop_control:
label: "{{ item.service }}"
vars:
Expand Down
2 changes: 1 addition & 1 deletion tasks/install-daemon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
when:
- ansible_facts.os_family == "RedHat"
- ansible_facts.distribution_major_version | int == 7
- libvirt_host_qemu_emulators | length > 0
- libvirt_host_qemu_emulators is truthy

- name: Ensure QEMU emulator packages are installed
package:
Expand Down
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
when: libvirt_host_install_client | bool
- name: Include pools.yml
include_tasks: pools.yml
when: libvirt_host_pools | length > 0
when: libvirt_host_pools is truthy
- name: Include networks.yml
include_tasks: networks.yml
when: libvirt_host_networks | length > 0
when: libvirt_host_networks is truthy
2 changes: 1 addition & 1 deletion tasks/post-install-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
insertafter: '^#libvirtd_opts='
regexp: '^libvirtd_opts='
line: "libvirtd_opts={{ libvirt_host_libvirtd_args }}"
condition: "{{ libvirt_host_libvirtd_args | length > 0 }}"
condition: "{{ libvirt_host_libvirtd_args is truthy }}"
vars:
libvirt_env_path: "{{ '/etc/default/libvirt-bin' if libvirt_bin_stat.stat.exists else '/etc/default/libvirtd' }}"
tags: vars
Expand Down
2 changes: 1 addition & 1 deletion tasks/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
defined
when:
- libvirt_host_enable_sasl_support | bool
- libvirt_host_sasl_credentials | rejectattr('password') | length > 0
- libvirt_host_sasl_credentials | rejectattr('password') is truthy
2 changes: 1 addition & 1 deletion templates/libvirtd.conf.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# {{ ansible_managed }}
{% if libvirt_host_socket_dir | length > 0 %}
{% if libvirt_host_socket_dir is truthy %}
unix_sock_dir = "{{ libvirt_host_socket_dir }}"
{% endif %}
{% for key, value in libvirt_host_libvirtd_conf.items() %}
Expand Down
2 changes: 1 addition & 1 deletion vars/RedHat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ libvirt_host_lineinfile_extra_rules:
insertafter: '^#LIBVIRTD_ARGS='
regexp: '^LIBVIRTD_ARGS='
line: LIBVIRTD_ARGS="{{ libvirt_host_libvirtd_args }}"
condition: "{{ libvirt_host_libvirtd_args != '' }}"
condition: "{{ libvirt_host_libvirtd_args is truthy }}"