opencontrail: move vhost0 on eth1 07/11607/1
authorchenshuai@huawei.com <chenshuai@huawei.com>
Fri, 25 Mar 2016 02:06:06 +0000 (10:06 +0800)
committerchenshuai@huawei.com <chenshuai@huawei.com>
Fri, 25 Mar 2016 02:06:06 +0000 (10:06 +0800)
JIRA: COMPASS-349

Change-Id: I61f481dd9b3aa7885ea3eaa3c7ba2d02c0556d2c
Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
deploy/adapters/ansible/roles/open-contrail/tasks/install/install-interface.yml
deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
deploy/adapters/ansible/roles/open-contrail/tasks/provision/provision-compute.yml
deploy/adapters/ansible/roles/open-contrail/tasks/uninstall-openvswitch.yml
deploy/adapters/ansible/roles/open-contrail/templates/provision/contrail-vrouter-agent-conf.j2
deploy/adapters/ansible/roles/open-contrail/vars/main.yml

index 05c30da..3f7b43c 100755 (executable)
@@ -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
 #  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
index 6c01f0f..b1e9cbc 100755 (executable)
 # 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
index a4cd36d..d9258ef 100755 (executable)
@@ -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:
     - "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 }}"
 
 ##################################################################################
index 195a899..55b1690 100755 (executable)
   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: >
index e638ce1..d64cc21 100755 (executable)
@@ -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 }}
index 94a1423..eb840ce 100755 (executable)
@@ -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"