Zack Williams | 18b6f02 | 2018-01-19 11:46:54 -0700 | [diff] [blame] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Zack Williams | 18b6f02 | 2018-01-19 11:46:54 -0700 | [diff] [blame] | 16 | # test-client-install/tasks/main.yml |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 17 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 18 | - name: Create testclient LXD profile |
| 19 | lxd_profile: |
| 20 | name: testclient |
| 21 | state: present |
| 22 | config: |
| 23 | user.user-data: | |
| 24 | #cloud-config |
| 25 | write_files: |
| 26 | - path: /etc/rc.local |
| 27 | permissions: "0755" |
| 28 | content: | |
| 29 | #!/bin/sh -e |
| 30 | # Set up VLAN tagging interface ("simulated OLT") |
| 31 | ip link add link eth0 name eth0.222 type vlan id 222 |
| 32 | ip link add link eth0.222 name eth0.222.111 type vlan id 111 |
| 33 | ifconfig eth0.222 up |
| 34 | ifconfig eth0.222.111 up |
| 35 | dhclient eth0.222.111 |
| 36 | exit 0 |
| 37 | bootcmd: |
| 38 | - sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces.d/eth0.cfg |
| 39 | description: 'Subscriber test client' |
| 40 | devices: |
| 41 | eth0: |
Andy Bavier | b9b5700 | 2016-11-23 17:01:36 -0500 | [diff] [blame] | 42 | nictype: macvlan |
Zack Williams | 18b6f02 | 2018-01-19 11:46:54 -0700 | [diff] [blame] | 43 | parent: "{{ headnode_fabric_bridge }}" |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 44 | type: nic |
| 45 | |
| 46 | - name: Create testclient container |
| 47 | lxd_container: |
| 48 | name: testclient |
| 49 | architecture: x86_64 |
| 50 | state: started |
| 51 | source: |
| 52 | type: image |
| 53 | mode: pull |
| 54 | server: https://cloud-images.ubuntu.com/releases |
| 55 | protocol: simplestreams |
| 56 | alias: "{{ ansible_distribution_release }}" |
| 57 | profiles: ["testclient"] |
| 58 | timeout: 600 |
| 59 | |
| 60 | - name: Stop container |
| 61 | lxd_container: |
| 62 | name: testclient |
| 63 | state: stopped |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 64 | register: result |
Zack Williams | f6cc012 | 2018-03-30 16:00:49 -0700 | [diff] [blame] | 65 | until: result is success |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 66 | retries: 3 |
| 67 | delay: 10 |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 68 | |