Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 1 | --- |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 2 | - name: Create testclient LXD profile |
| 3 | lxd_profile: |
| 4 | name: testclient |
| 5 | state: present |
| 6 | config: |
| 7 | user.user-data: | |
| 8 | #cloud-config |
| 9 | write_files: |
| 10 | - path: /etc/rc.local |
| 11 | permissions: "0755" |
| 12 | content: | |
| 13 | #!/bin/sh -e |
| 14 | # Set up VLAN tagging interface ("simulated OLT") |
| 15 | ip link add link eth0 name eth0.222 type vlan id 222 |
| 16 | ip link add link eth0.222 name eth0.222.111 type vlan id 111 |
| 17 | ifconfig eth0.222 up |
| 18 | ifconfig eth0.222.111 up |
| 19 | dhclient eth0.222.111 |
| 20 | exit 0 |
| 21 | bootcmd: |
| 22 | - sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces.d/eth0.cfg |
| 23 | description: 'Subscriber test client' |
| 24 | devices: |
| 25 | eth0: |
Andy Bavier | b9b5700 | 2016-11-23 17:01:36 -0500 | [diff] [blame] | 26 | nictype: macvlan |
Andy Bavier | 2968291 | 2017-01-24 10:28:58 -0500 | [diff] [blame] | 27 | parent: fabric |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 28 | type: nic |
| 29 | |
| 30 | - name: Create testclient container |
| 31 | lxd_container: |
| 32 | name: testclient |
| 33 | architecture: x86_64 |
| 34 | state: started |
| 35 | source: |
| 36 | type: image |
| 37 | mode: pull |
| 38 | server: https://cloud-images.ubuntu.com/releases |
| 39 | protocol: simplestreams |
| 40 | alias: "{{ ansible_distribution_release }}" |
| 41 | profiles: ["testclient"] |
| 42 | timeout: 600 |
| 43 | |
| 44 | - name: Stop container |
| 45 | lxd_container: |
| 46 | name: testclient |
| 47 | state: stopped |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 48 | register: result |
| 49 | until: result | success |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 50 | retries: 3 |
| 51 | delay: 10 |