JianHao | 90e65dc | 2017-10-31 18:01:07 +0800 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | --- |
Andy Bavier | c79d99f | 2017-11-13 17:18:41 -0700 | [diff] [blame^] | 16 | # Should be in the data model, not hardcoded here... |
| 17 | - name: Set SSH password |
| 18 | set_fact: |
| 19 | ansible_ssh_pass: cfguser |
| 20 | |
JianHao | 90e65dc | 2017-10-31 18:01:07 +0800 | [diff] [blame] | 21 | - name: check flat_network interface |
| 22 | shell: ifconfig | grep -B1 "inet addr:{{ ts_ip }}" | awk '$1!="inet" && $1!="--" {print $1}' |
| 23 | args: |
| 24 | executable: /bin/bash |
| 25 | register: iface |
| 26 | |
| 27 | - name: disable TAS process |
| 28 | command: disable-tas |
| 29 | |
| 30 | - name: enable TS process |
| 31 | command: enable-ts |
| 32 | |
| 33 | - name: test response to test.py |
| 34 | expect: |
| 35 | command: ipcfg |
| 36 | responses: |
| 37 | Configure now?: "n" |
| 38 | Do you wish to Continue: "yes" |
| 39 | Designate management port: "{{ iface.stdout_lines }}" |
| 40 | IP Address: "{{ ts_ip }}" |
Andy Bavier | c79d99f | 2017-11-13 17:18:41 -0700 | [diff] [blame^] | 41 | Network Mask: "{{ ts_mask }}" |
JianHao | 90e65dc | 2017-10-31 18:01:07 +0800 | [diff] [blame] | 42 | Auto Negotiate: "yes" |
Andy Bavier | c79d99f | 2017-11-13 17:18:41 -0700 | [diff] [blame^] | 43 | IP Gateway: "{{ ts_gateway }}" |
JianHao | 90e65dc | 2017-10-31 18:01:07 +0800 | [diff] [blame] | 44 | Host Name: "{{ ts_host_name }}" |
| 45 | TAS IP Address: "{{ tas_ip }}" |
| 46 | NTP Server IP: "{{ ntp_ip }}" |
Andy Bavier | c79d99f | 2017-11-13 17:18:41 -0700 | [diff] [blame^] | 47 | System must be rebooted: "no" |
| 48 | echo: yes |
| 49 | |
| 50 | - name: Re-add network interfaces to configuration |
| 51 | sudo: yes |
| 52 | notify: reboot node |
| 53 | blockinfile: |
| 54 | dest: /etc/network/interfaces |
| 55 | block: | |
| 56 | auto eth1 |
| 57 | iface eth1 inet dhcp |
| 58 | auto eth2 |
| 59 | iface eth2 inet dhcp |
| 60 | auto eth3 |
| 61 | iface eth3 inet dhcp |
| 62 | auto eth4 |
| 63 | iface eth4 inet dhcp |
| 64 | auto eth5 |
| 65 | iface eth5 inet dhcp |
| 66 | auto eth6 |
| 67 | iface eth6 inet dhcp |