From 1420da02369d5db05487ea13e29f47947e07b338 Mon Sep 17 00:00:00 2001 From: "chenshuai@huawei.com" Date: Fri, 25 Mar 2016 10:06:06 +0800 Subject: opencontrail: move vhost0 on eth1 JIRA: COMPASS-349 Change-Id: I61f481dd9b3aa7885ea3eaa3c7ba2d02c0556d2c Signed-off-by: chenshuai@huawei.com --- .../tasks/install/install-interface.yml | 10 +++++----- .../ansible/roles/open-contrail/tasks/main.yml | 7 ++++--- .../tasks/provision/provision-compute.yml | 14 +++++++------- .../open-contrail/tasks/uninstall-openvswitch.yml | 21 ++++++++++++--------- .../provision/contrail-vrouter-agent-conf.j2 | 2 +- .../ansible/roles/open-contrail/vars/main.yml | 14 ++++---------- 6 files changed, 33 insertions(+), 35 deletions(-) (limited to 'deploy/adapters') diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml index 05c30da0..3f7b43c1 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml @@ -10,9 +10,9 @@ #- hosts: all # sudo: yes # tasks: -- name: get last ip address - shell: expr substr `cat /etc/hostname` 5 1 - register: lastip +#- name: get last ip address +# shell: expr substr `cat /etc/hostname` 5 1 +# register: lastip #- name: "configure interface" ## sudo: True @@ -22,12 +22,12 @@ # with_items: # - "auto {{ contrail_vhost_device }}" # - "iface {{ contrail_vhost_device }} inet static" -# - "\taddress {{ contrail_vhost_address }}{{ lastip.stdout_lines[0] }}" +# - "\taddress {{ contrail_vhost_address }}" # - "\tnetmask {{ contrail_vhost_netmask }}" - name: "set interface address" # sudo: True - shell: "ifconfig {{ contrail_vhost_device }} {{ contrail_vhost_address }}{{ lastip.stdout_lines[0] }} netmask {{ contrail_vhost_netmask }}" + shell: "ifconfig {{ contrail_vhost_device }} {{ contrail_vhost_address }} netmask {{ contrail_vhost_netmask }}" - name: "up interface" # sudo: True diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml index 6c01f0f1..b1e9cbcd 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml @@ -53,9 +53,10 @@ # or inventory_hostname in groups['opencontrail_tsn'] -- name: Install interface on all hosts for Open Contrail - include: install/install-interface.yml - when: groups['opencontrail']|length !=0 +# change vhost0 on eth1 +#- name: Install interface on all hosts for Open Contrail +# include: install/install-interface.yml +# when: groups['opencontrail']|length !=0 #- include: install/install-common.yml #- include: install/install-kernel.yml diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml index a4cd36db..d9258ef5 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml @@ -62,9 +62,9 @@ regexp: "dev=__DEVICE__" line: "dev={{ contrail_vhost_device }}" -- name: "get last ip address" - shell: expr substr `cat /etc/hostname` 5 1 - register: lastip +#- name: "get last ip address" +# shell: expr substr `cat /etc/hostname` 5 1 +# register: lastip - name: "fix up contrail vrouter agent config" template: @@ -89,9 +89,9 @@ - "sed -i -n -e '/auto .*/,$p' /tmp/contrail-interfaces-bottom" - "cat /tmp/contrail-interfaces-top /tmp/contrail-interfaces-bottom > /etc/network/interfaces" -- name: get last ip address - shell: expr substr `cat /etc/hostname` 5 1 - register: lastip +#- name: get last ip address +# shell: expr substr `cat /etc/hostname` 5 1 +# register: lastip - name: "configure interface" lineinfile: @@ -107,7 +107,7 @@ - "iface vhost0 inet static" - "\tpre-up /opt/contrail/bin/if-vhost0" - "\tnetwork_name application" - - "\taddress {{ contrail_vhost_address }}{{ lastip.stdout_lines[0] }}" + - "\taddress {{ contrail_vhost_address }}" - "\tnetmask {{ contrail_vhost_netmask }}" ################################################################################## diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml index 195a8990..55b1690e 100755 --- a/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml +++ b/deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml @@ -26,17 +26,20 @@ shell: rmmod vport_vxlan; rmmod openvswitch; ignore_errors: True -- name: copy recovery script - copy: src={{ item }} dest=/opt/setup_networks - with_items: - - recover_network_opencontrail.py - - setup_networks_opencontrail.py - -- name: recover external script - shell: python /opt/setup_networks/recover_network_opencontrail.py +#- name: copy recovery script +# copy: src={{ item }} dest=/opt/setup_networks +# with_items: +# - recover_network_opencontrail.py +# - setup_networks_opencontrail.py +# +#- name: recover external script +# shell: python /opt/setup_networks/recover_network_opencontrail.py +# +#- name: modify net-init +# shell: sed -i 's/setup_networks.py/setup_networks_opencontrail.py/g' /etc/init.d/net_init - name: modify net-init - shell: sed -i 's/setup_networks.py/setup_networks_opencontrail.py/g' /etc/init.d/net_init + shell: sed -i '/setup_networks/d' /etc/init.d/net_init - name: resolve dual NIC problem shell: > diff --git a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 index e638ce16..d64cc21c 100755 --- a/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 +++ b/deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2 @@ -127,7 +127,7 @@ control_network_ip = {{ contrail_haproxy_address }} name = vhost0 # IP address and prefix in ip/prefix_len format -ip = {{ contrail_vhost_address }}{{ lastip.stdout_lines[0] }}/{{ contrail_prefixlen }} +ip = {{ contrail_vhost_address }}/{{ contrail_prefixlen }} # Gateway IP address for virtual host gateway = {{ contrail_vhost_gateway }} diff --git a/deploy/adapters/ansible/roles/open-contrail/vars/main.yml b/deploy/adapters/ansible/roles/open-contrail/vars/main.yml index 94a1423e..eb840cec 100755 --- a/deploy/adapters/ansible/roles/open-contrail/vars/main.yml +++ b/deploy/adapters/ansible/roles/open-contrail/vars/main.yml @@ -30,10 +30,10 @@ contrail_gateway: ########################################################### ### we make an independent NIC for OpenContrail vRouter ### ########################################################### -contrail_vhost_device: "eth2" -contrail_vhost_address: "10.18.1." -contrail_vhost_gateway: "10.18.1.254" -contrail_vhost_netmask: "255.255.255.0" +contrail_vhost_device: "{{ network_cfg['provider_net_mappings'][0]['interface'] }}" +contrail_vhost_address: "{{ ip_settings[inventory_hostname]['br-prv']['ip'] }}" +contrail_vhost_gateway: "{{ ip_settings[inventory_hostname]['br-prv']['gw'] }}" +contrail_vhost_netmask: "{{ ip_settings[inventory_hostname]['br-prv']['netmask'] }}" ########################################################### ########################################################### ########################################################### @@ -81,9 +81,3 @@ kernel_package_noarch: [] compute_package_noarch: [] -# network infor adapter for compass -contrail_address: "{{ internal_ip }}" -contrail_netmask: "255.255.255.0" -#contrail_gateway: "10.84.50.254" -contrail_gateway: -#contrail_mgmt_address: "172.27.113.91" -- cgit 1.2.3-korg