Improvements to seed VM provisioning

Fully bounce interfaces, fix permissions of /etc/resolv.conf (it gets written out with 0660,
but should be 0644), increase SSH wait timeout to 360 seconds. The latter change allows for
a commonly used 5 minute DHCP timeout which may be applied before cloud-init is run.
This commit is contained in:
Mark Goddard 2017-08-07 12:00:19 +00:00
parent 7a8e087731
commit 2a66c77525

View File

@ -19,15 +19,19 @@
state: directory
# The user data script is used to bring up the network interfaces that will
# be configured by metadata in the configdrive. It could be used for other
# things in future if necessary.
# be configured by metadata in the configdrive. For some reason resolv.conf
# gets configured with 660 permissions, so fix that here also.
- name: Ensure the user data file exists
copy:
content: |
#!/bin/bash
{% for interface in seed_hostvars.network_interfaces | map('net_interface', seed_host) %}
# Bounce {{ interface }}.
ifdown {{ interface }}
ifup {{ interface }}
{% endfor %}
# Fix permissions of resolv.conf.
chmod 644 /etc/resolv.conf
dest: "{{ seed_user_data_path }}"
roles:
@ -110,3 +114,6 @@
host: "{{ seed_hostvars.ansible_host }}"
port: 22
state: started
# NOTE: Ensure we exceed the 5 minute DHCP timeout of the eth0
# interface if necessary.
timeout: 360