Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vm_hostvars variable #61

Merged
merged 1 commit into from
Mar 28, 2025
Merged
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
12 changes: 3 additions & 9 deletions playbooks/group_vars/libvirt_guests.yaml
Original file line number Diff line number Diff line change
@@ -4,12 +4,6 @@
# Reusable defaults for libvirt guests.
# =============================================================================

# Shortcut to access host's configuration values.
vm_hostvars: '{{ hostvars[vm_host] }}'
# XXX: Be careful not to use this in variables that are retrieved from the host
# (i.e.: all VM definitions), as they create circular dependencies that cannot
# be resolved.

# Connect using QEMU guest agent.
libvirt__vm_use_qemu_connection: true
ansible_connection: |-
@@ -20,9 +14,9 @@
}}
ansible_libvirt_uri: |-
qemu+ssh://{{
vm_hostvars.get('ansible_ssh_host') or
vm_hostvars.get('ansible_host') or
vm_hostvars.get('inventory_hostname')
hostvars[vm_host].get('ansible_ssh_host') or
hostvars[vm_host].get('ansible_host') or
hostvars[vm_host].get('inventory_hostname')
}}/system
ansible_host: |-
{{ vm_name if libvirt__vm_use_qemu_connection | bool else host_fqdn }}
@@ -61,7 +55,7 @@
format: raw
mount: ~ # Partitioned device.

_host_iface_prefix: |-

Check warning on line 58 in playbooks/group_vars/libvirt_guests.yaml

GitHub Actions / Ansible lint

jinja[spacing]

Jinja2 spacing could be improved: {% set _len = ('vm-%s-en0' % vm_name) | length %}
{% set _len = ('vm-%s-en0' % vm_name) | length %}
{{ 'vm-%s' % (vm_name if _len <= 15 else vm_name[:15 - _len]) }}
vm_interface__00_pubbr: