sidn-lxd-ansible-demo/roles/lxd_container/tasks/bootstrap-ubuntu14.04.yml

33 lines
1.1 KiB
YAML

---
# In the Ubuntu 14.04 cloud image, cloud-init is supported, but it is an old
# version and network configuration does not seem to work. Therefore, the
# network configuration is handled in a clunky way.
- name: "Create Ubuntu 14.04 LXD container"
delegate_to: "{{ hostvars[inventory_hostname].lxd_host }}"
lxd_container:
name: "{{ inventory_hostname }}"
state: started
source:
type: image
mode: pull
server: "{{ vars.lxd_image_server }}"
protocol: simplestreams
alias: "{{ vars.lxd_image_name }}"
profiles:
- "{{ vars.lxd_profile }}"
wait_for_ipv4_addresses: True
- name: "Generate network config for Ubuntu 14.04 LXD container"
delegate_to: "{{ hostvars[inventory_hostname].lxd_host }}"
template:
src: network-interfaces.j2
dest: /tmp/network-interfaces-{{ inventory_hostname }}
- name: "Install network config for Ubuntu 14.04 LXD container"
delegate_to: "{{ hostvars[inventory_hostname].lxd_host }}"
shell: >-
lxc file push
/tmp/network-interfaces-{{ inventory_hostname }}
{{ inventory_hostname }}/etc/network/interfaces