summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible
diff options
context:
space:
mode:
authorchenshuai@huawei.com <chenshuai@huawei.com>2016-05-15 22:32:44 +0800
committerchenshuai@huawei.com <chenshuai@huawei.com>2016-05-15 22:32:44 +0800
commit962fbfefa11fbd553f7d1c772bdd1dc7b7161043 (patch)
tree68478d215c48cf51968ba74293447a9c7d06ef3c /deploy/adapters/ansible
parentc6f911e50c666c2fc837a9192e721e6660660686 (diff)
ocl:create vgw to access public network
JIRA: COMPASS-390 Change-Id: I19e5902b2af03a3a9c52e002a383b3a1b553861b Signed-off-by: chenshuai@huawei.com <chenshuai@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible')
-rw-r--r--deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml19
-rwxr-xr-xdeploy/adapters/ansible/roles/open-contrail/tasks/main.yml3
2 files changed, 22 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml
new file mode 100644
index 00000000..8f3e095d
--- /dev/null
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/ext-net.yml
@@ -0,0 +1,19 @@
+---
+- name: add ext-network router of vgw on controller for open-contrail
+ shell: >
+ ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev {{ network_cfg.public_vip.interface }} ;
+ echo "ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev {{ network_cfg.public_vip.interface }}" >> /opt/contrail/bin/if-vhost0 ;
+ when: inventory_hostname in groups['opencontrail']
+
+
+- name: create vgw for open-contrail
+ shell: >
+ echo "lsof -ni :9090 ; while [ $? -ne 0 ]; do sleep 10; lsof -ni :9090; done" >> /etc/init.d/net_init;
+ echo "sleep 10" >> /etc/init.d/net_init;
+ echo "python /opt/contrail/utils/provision_vgw_interface.py --oper create --interface vgw1 --subnets {{ public_net_info.floating_ip_cidr }} --routes 0.0.0.0/0 --vrf default-domain:admin:{{ public_net_info.network }}:{{ public_net_info.network }}" >> /etc/init.d/net_init;
+ when: groups['opencontrail']|length !=0 and inventory_hostname == groups['compute'][0]
+
+
+- name: add vgw router on compute(without vgw) for open-contrail
+ shell: echo "ip route add {{ public_net_info.floating_ip_cidr }} via {{ ip_settings[groups['compute'][0]]['br-prv']['ip'] }} dev vhost0" >> /etc/init.d/net_init
+ when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail'] and inventory_hostname != groups['compute'][0]
diff --git a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
index 16ca4e91..7d0f1a9e 100755
--- a/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/open-contrail/tasks/main.yml
@@ -121,6 +121,9 @@
include: uninstall-openvswitch.yml
when: groups['opencontrail']|length !=0 and inventory_hostname not in groups['opencontrail']
+- name: Config ext-net network
+ include: ext-net.yml
+
- name: Enable Service Daemon
shell: if [ -f “\/opt\/service.bak” ] ; then mv /opt/service.bak /opt/service ; fi
when: groups['opencontrail']|length !=0