use cloudinit-wait from git
This commit is contained in:
parent
8917e3e791
commit
ce28c8d850
3 changed files with 26 additions and 39 deletions
|
@ -1,5 +1,5 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
roles_path=roles
|
roles_path=~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:roles
|
||||||
inventory=inventory
|
inventory=inventory
|
||||||
vault_password_file=util/secret-service-client.sh
|
vault_password_file=util/secret-service-client.sh
|
||||||
interpreter_python=/usr/bin/python3
|
interpreter_python=/usr/bin/python3
|
||||||
|
|
|
@ -1,44 +1,28 @@
|
||||||
---
|
- name: Wait for cloud-init to finish
|
||||||
- hosts: all
|
hosts: all
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
|
roles:
|
||||||
|
- 'cloudinit-wait'
|
||||||
|
|
||||||
|
- name: Install services
|
||||||
|
hosts: all
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Wait for host to come up
|
- name: Copy resolv.conf
|
||||||
tags: always
|
copy:
|
||||||
block:
|
src: resolv.conf
|
||||||
- name: Wait for SSH connection
|
dest: /etc/resolv.conf
|
||||||
wait_for:
|
- name: Update repositories
|
||||||
state: started
|
apt:
|
||||||
port: 22
|
autoremove: true
|
||||||
host: "192.168.30.7"
|
upgrade: yes
|
||||||
timeout: 300
|
state: latest
|
||||||
connect_timeout: 300
|
update_cache: yes
|
||||||
search_regex: OpenSSH
|
cache_valid_time: 86400 # One day
|
||||||
delegate_to: localhost
|
- name: Install packages
|
||||||
- name: Wait for cloud-init to finish
|
apt:
|
||||||
command:
|
pkg:
|
||||||
cmd: cloud-init status --wait
|
- qemu-guest-agent
|
||||||
register: cloudinit
|
- dnsutils
|
||||||
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:
|
roles:
|
||||||
- {role: 'dnsmasq', tags: 'dnsmasq'}
|
- {role: 'dnsmasq', tags: 'dnsmasq'}
|
||||||
- {role: 'nsd', tags: 'nsd'}
|
- {role: 'nsd', tags: 'nsd'}
|
||||||
|
|
3
ansible/requirements.yml
Normal file
3
ansible/requirements.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
- name: cloudinit-wait
|
||||||
|
src: https://git.pim.kunis.nl/pim/ansible-role-cloudinit-wait
|
||||||
|
scm: git
|
Reference in a new issue