fix unable to scope ansible to tags

fixes #4
This commit is contained in:
Pim Kunis 2023-04-13 17:21:48 +02:00
parent f8bd422451
commit b89713643d
2 changed files with 18 additions and 16 deletions

View file

@ -20,7 +20,6 @@ module "tf-datatest" {
name = "max" name = "max"
domain_name = "tf-max" domain_name = "tf-max"
data_disk = "/kvm/data/max-data" data_disk = "/kvm/data/max-data"
#ansible_command = "ansible-playbook max.yml"
memory = 1024 * 8 memory = 1024 * 8
mac = "CA:FE:C0:FF:EE:03" mac = "CA:FE:C0:FF:EE:03"
} }

33
max.yml
View file

@ -4,21 +4,24 @@
pre_tasks: pre_tasks:
- name: Wait for host to come up - name: Wait for host to come up
wait_for: tags: always
state: started block:
port: 22 - name: Wait for SSH connection
host: max.dmz wait_for:
timeout: 300 state: started
connect_timeout: 300 port: 22
search_regex: OpenSSH host: max.dmz
delegate_to: localhost timeout: 300
- name: Wait for cloud-init to finish connect_timeout: 300
shell: search_regex: OpenSSH
cmd: "cloud-init status --wait" delegate_to: localhost
register: cloudinit - name: Wait for cloud-init to finish
changed_when: "'..' in cloudinit.stdout" shell:
- name: Gather facts cmd: "cloud-init status --wait"
setup: register: cloudinit
changed_when: "'..' in cloudinit.stdout"
- name: Gather facts
setup:
roles: roles:
- {role: 'watchtower', tags: 'watchtower'} - {role: 'watchtower', tags: 'watchtower'}