diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg index 4351528..65e6c38 100644 --- a/ansible/ansible.cfg +++ b/ansible/ansible.cfg @@ -1,5 +1,5 @@ [defaults] -roles_path=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:roles +roles_path=roles inventory=inventory vault_password_file=util/secret-service-client.sh interpreter_python=/usr/bin/python3 diff --git a/ansible/hermes.yml b/ansible/hermes.yml index 83be269..49ff96d 100644 --- a/ansible/hermes.yml +++ b/ansible/hermes.yml @@ -1,28 +1,44 @@ -- name: Wait for cloud-init to finish - hosts: all +--- +- hosts: all gather_facts: no - roles: - - 'cloudinit-wait' -- name: Install services - hosts: all pre_tasks: - - name: Copy resolv.conf - copy: - src: resolv.conf - dest: /etc/resolv.conf - - name: Update repositories - apt: - autoremove: true - upgrade: yes - state: latest - update_cache: yes - cache_valid_time: 86400 # One day - - name: Install packages - apt: - pkg: - - qemu-guest-agent - - dnsutils + - name: Wait for host to come up + tags: always + block: + - name: Wait for SSH connection + wait_for: + state: started + port: 22 + host: "192.168.30.7" + timeout: 300 + connect_timeout: 300 + search_regex: OpenSSH + delegate_to: localhost + - name: Wait for cloud-init to finish + command: + cmd: cloud-init status --wait + register: cloudinit + changed_when: "'..' in cloudinit.stdout" + - name: Gather facts + setup: + - name: Copy resolv.conf + copy: + src: resolv.conf + dest: /etc/resolv.conf + - name: Update repositories + apt: + autoremove: true + upgrade: yes + state: latest + update_cache: yes + cache_valid_time: 86400 # One day + - name: Install packages + apt: + pkg: + - qemu-guest-agent + - dnsutils + roles: - {role: 'dnsmasq', tags: 'dnsmasq'} - {role: 'nsd', tags: 'nsd'} diff --git a/ansible/requirements.yml b/ansible/requirements.yml deleted file mode 100644 index 5530c9f..0000000 --- a/ansible/requirements.yml +++ /dev/null @@ -1,3 +0,0 @@ -- name: cloudinit-wait - src: https://git.pim.kunis.nl/pim/ansible-role-cloudinit-wait - scm: git diff --git a/terraform/main.tf b/terraform/main.tf index d6efb4d..6ca4267 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -21,7 +21,6 @@ provider "libvirt" { module "vm" { source = "git::https://git.pim.kunis.nl/home/tf-modules.git//debian" name = "hermes" - domain_name = "tf-hermes" use_host_cert = false fixed_address = "192.168.30.7/24" mac = "CA:FE:C0:FF:EE:07"