---
- hosts: all
gather_facts: no
tasks:
- name: Wait for host to come up
wait_for:
state: started
port: 22
host: "{{ internal_ip }}"
delay: 10
timeout: 300
connect_timeout: 300
search_regex: OpenSSH
delegate_to: localhost
- name: Wait for cloud-init to finish
command:
cmd: cloud-init status --wait
- name: Gather facts
setup:
- name: Update repositories
apt:
autoremove: true
upgrade: yes
state: latest
update_cache: yes
cache_valid_time: 86400 # One day
- name: Install packages
pkg:
- qemu-guest-agent
- dnsmasq
- dnsutils
- name: Disable systemd-resolved
systemd:
name: systemd-resolved
enabled: false
state: stopped
- name: Copy dnsmasq configuration
copy:
src: "dnsmasq.conf"
dest: "/etc/dnsmasq.conf"
- name: Enable dnsmasq
name: dnsmasq
enabled: true