Skip to content

Commit

Permalink
Add vars to add .ssh/config and /etc/hosts only optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
Enucatl committed Oct 17, 2023
1 parent 4e91fc0 commit 0cf37ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ virt_infra_host_deps:
virt_infra_guest_deps:
- cloud-init
- qemu-guest-agent

# Automatically add entries to /etc/hosts on the kvmhost
virt_infra_add_etc_hosts: true

# Automatically add entries to $HOME/.ssh/config on the kvmhost
virt_infra_add_ssh_config: true
2 changes: 2 additions & 0 deletions tasks/hosts-add.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
become: true
delegate_to: "{{ kvmhost }}"
when:
- virt_infra_add_etc_hosts
- inventory_hostname not in groups['kvmhost']
- vm_ip is defined and vm_ip
- virt_infra_state | default(virt_infra_state) == "running"
Expand Down Expand Up @@ -46,6 +47,7 @@
become: false
delegate_to: "{{ kvmhost }}"
when:
- virt_infra_add_ssh_config
- inventory_hostname not in groups['kvmhost']
- vm_ip is defined and vm_ip
- virt_infra_state | default(virt_infra_state) == "running"
Expand Down

0 comments on commit 0cf37ba

Please sign in to comment.