Woojoong Kim | f002aec | 2017-10-25 14:43:37 -0700 | [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 | --- |
| 16 | |
| 17 | - name: resolve sudo timeout |
| 18 | become: yes |
| 19 | shell: "echo 127.0.1.1 $(cat /etc/hostname) >> /etc/hosts" |
| 20 | |
| 21 | - name: make interface config file |
| 22 | become: yes |
| 23 | template: |
| 24 | src=interface.cfg.j2 |
| 25 | dest="{{source_path}}/config/interface.cfg" owner=root group=root mode=755 |
| 26 | |
Woojoong Kim | 04d1216 | 2017-11-27 10:59:08 -0800 | [diff] [blame^] | 27 | - name: make static_arp config file |
| 28 | become: yes |
| 29 | template: |
| 30 | src=static_arp.cfg.j2 |
| 31 | dest="{{source_path}}/config/static_arp.cfg" owner=root group=root mode=755 |
| 32 | |
Woojoong Kim | f002aec | 2017-10-25 14:43:37 -0700 | [diff] [blame] | 33 | - name: get date |
| 34 | shell: date +"%Y-%m-%d_%H-%M" |
| 35 | register: tmp_date |
| 36 | |
| 37 | - name: get port_0 value |
Woojoong Kim | 04d1216 | 2017-11-27 10:59:08 -0800 | [diff] [blame^] | 38 | shell: "ifconfig | grep -B 1 {{ s1u_ip }} | awk '{print $1}' | head -n 1" |
Woojoong Kim | f002aec | 2017-10-25 14:43:37 -0700 | [diff] [blame] | 39 | register: tmp_port_0 |
| 40 | |
| 41 | - name: get port_1 value |
Woojoong Kim | 04d1216 | 2017-11-27 10:59:08 -0800 | [diff] [blame^] | 42 | shell: "ifconfig | grep -B 1 {{ sgi_ip }} | awk '{print $1}' | head -n 1" |
Woojoong Kim | f002aec | 2017-10-25 14:43:37 -0700 | [diff] [blame] | 43 | register: tmp_port_1 |
| 44 | |
| 45 | - name: get s1u_mac value |
| 46 | shell: "ifconfig | grep -B 2 {{ s1u_ip }} | grep HWaddr | awk \'{print $5}\'" |
| 47 | register: tmp_s1u_mac |
| 48 | |
| 49 | - name: get sgi_mac value |
| 50 | shell: "ifconfig | grep -B 2 {{ sgi_ip }} | grep HWaddr | awk \'{print $5}\'" |
| 51 | register: tmp_sgi_mac |
| 52 | |
| 53 | - name: assign results into each variable |
| 54 | set_fact: |
| 55 | port_0: "{{ tmp_port_0.stdout }}" |
| 56 | port_1: "{{ tmp_port_1.stdout }}" |
| 57 | s1u_mac: "{{ tmp_s1u_mac.stdout }}" |
| 58 | sgi_mac: "{{ tmp_sgi_mac.stdout }}" |
| 59 | date: "{{ tmp_date.stdout }}" |
| 60 | |
| 61 | - name: make dp_config config file |
| 62 | become: yes |
| 63 | template: |
| 64 | src=dp_config.cfg.j2 |
| 65 | dest="{{source_path}}/config/dp_config.cfg" owner=root group=root mode=755 |
| 66 | |
Woojoong Kim | 04d1216 | 2017-11-27 10:59:08 -0800 | [diff] [blame^] | 67 | - name: change Makefile.j2 |
| 68 | become: yes |
| 69 | template: |
| 70 | src=Makefile.j2 |
| 71 | dest="{{source_path}}/dp/Makefile" owner=root group=root mode=755 |
| 72 | |
| 73 | - name: write flag for interface_config |
| 74 | become: yes |
| 75 | shell: "echo 1 > {{source_path}}/dp/finish_flag_interface_config" |