blob: f1ce154c59a2399d96b87c7b89e080216180d116 [file] [log] [blame]
Andy Bavier30d27c92016-09-15 15:59:17 -04001---
Andy Bavierbef56282016-11-14 08:22:43 -08002- name: Enable trusty-backports
3 apt_repository:
4 repo: "{{ item }}"
5 state: present
Andy Bavier30d27c92016-09-15 15:59:17 -04006 with_items:
Andy Bavierbef56282016-11-14 08:22:43 -08007 - "deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe"
8 - "deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe"
Andy Bavier30d27c92016-09-15 15:59:17 -04009
Andy Bavierbef56282016-11-14 08:22:43 -080010- name: Ensure LXD
11 apt:
12 name: lxd
13 state: present
14 update_cache: yes
15 default_release: trusty-backports
16
17- name: get "fabric" bridge interface
18 shell: route -n | grep 10.6.1.0 | awk '{print $8}'
19 register: bridge
20 tags:
21 - skip_ansible_lint # running a sub job
22
23- name: Create testclient LXD profile
24 lxd_profile:
25 name: testclient
26 state: present
27 config:
28 user.user-data: |
29 #cloud-config
30 write_files:
31 - path: /etc/rc.local
32 permissions: "0755"
33 content: |
34 #!/bin/sh -e
35 # Set up VLAN tagging interface ("simulated OLT")
36 ip link add link eth0 name eth0.222 type vlan id 222
37 ip link add link eth0.222 name eth0.222.111 type vlan id 111
38 ifconfig eth0.222 up
39 ifconfig eth0.222.111 up
40 dhclient eth0.222.111
41 exit 0
42 bootcmd:
43 - sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces.d/eth0.cfg
44 description: 'Subscriber test client'
45 devices:
46 eth0:
47 nictype: bridged
48 parent: "{{ bridge.stdout }}"
49 type: nic
50
51- name: Create testclient container
52 lxd_container:
53 name: testclient
54 architecture: x86_64
55 state: started
56 source:
57 type: image
58 mode: pull
59 server: https://cloud-images.ubuntu.com/releases
60 protocol: simplestreams
61 alias: "{{ ansible_distribution_release }}"
62 profiles: ["testclient"]
63 timeout: 600
64
65- name: Stop container
66 lxd_container:
67 name: testclient
68 state: stopped
Andy Bavierb83beac2016-10-20 15:54:08 -040069 register: result
70 until: result | success
Andy Bavierbef56282016-11-14 08:22:43 -080071 retries: 3
72 delay: 10