From 227bc5587848ab5288814e5d65acb189b90e8c74 Mon Sep 17 00:00:00 2001 From: grakiss Date: Tue, 15 Dec 2015 10:05:11 +0800 Subject: [PATCH] modify host ip to mgmt ip add some varibles to obtain mgmt ip cidr modify hosts ip to mgmt ip Change-Id: I6bd10857ec3abc56b0430b33627af2dc47b6863b Signed-off-by: grakiss --- .../openstack_juno/hosts/HA-ansible-multinodes.tmpl | 13 +++++++++++-- .../openstack_juno/vars/HA-ansible-multinodes.tmpl | 1 + .../openstack_kilo/hosts/HA-ansible-multinodes.tmpl | 13 +++++++++++-- .../openstack_kilo/vars/HA-ansible-multinodes.tmpl | 1 + .../hosts/HA-ansible-multinodes.tmpl | 13 +++++++++++-- .../vars/HA-ansible-multinodes.tmpl | 2 ++ 6 files changed, 37 insertions(+), 6 deletions(-) diff --git a/conf/templates/ansible_installer/openstack_juno/hosts/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_juno/hosts/HA-ansible-multinodes.tmpl index af384d45..9d628b5e 100644 --- a/conf/templates/ansible_installer/openstack_juno/hosts/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_juno/hosts/HA-ansible-multinodes.tmpl @@ -1,3 +1,12 @@ +#set ip_settings={} +#for k,v in $getVar('ip_settings', {}).items() +#set host_ip_settings={} +#for intf in v +#set $host_ip_settings[$intf["alias"]]=intf +#end for +#set $ip_settings[$k]=$host_ip_settings +#end for + # localhost 127.0.0.1 localhost #set controllers = $getVar('controller', []) @@ -10,13 +19,13 @@ #end if # controller #for worker in $controllers - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for # compute #for worker in $computes - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for diff --git a/conf/templates/ansible_installer/openstack_juno/vars/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_juno/vars/HA-ansible-multinodes.tmpl index 132add4b..d41eca1b 100644 --- a/conf/templates/ansible_installer/openstack_juno/vars/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_juno/vars/HA-ansible-multinodes.tmpl @@ -37,6 +37,7 @@ deploy_type: $getVar('deploy_type', 'virtual') public_cidr: $computers[0]['install']['subnet'] storage_cidr: "{{ ip_settings[inventory_hostname]['storage']['cidr'] }}" +mgmt_cidr: "{{ ip_settings[inventory_hostname]['mgmt']['cidr'] }}" public_net_info: "{{ network_cfg.public_net_info }}" host_ip_settings: "{{ ip_settings[inventory_hostname] }}" diff --git a/conf/templates/ansible_installer/openstack_kilo/hosts/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_kilo/hosts/HA-ansible-multinodes.tmpl index af384d45..9d628b5e 100644 --- a/conf/templates/ansible_installer/openstack_kilo/hosts/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_kilo/hosts/HA-ansible-multinodes.tmpl @@ -1,3 +1,12 @@ +#set ip_settings={} +#for k,v in $getVar('ip_settings', {}).items() +#set host_ip_settings={} +#for intf in v +#set $host_ip_settings[$intf["alias"]]=intf +#end for +#set $ip_settings[$k]=$host_ip_settings +#end for + # localhost 127.0.0.1 localhost #set controllers = $getVar('controller', []) @@ -10,13 +19,13 @@ #end if # controller #for worker in $controllers - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for # compute #for worker in $computes - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for diff --git a/conf/templates/ansible_installer/openstack_kilo/vars/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_kilo/vars/HA-ansible-multinodes.tmpl index 132add4b..d41eca1b 100644 --- a/conf/templates/ansible_installer/openstack_kilo/vars/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_kilo/vars/HA-ansible-multinodes.tmpl @@ -37,6 +37,7 @@ deploy_type: $getVar('deploy_type', 'virtual') public_cidr: $computers[0]['install']['subnet'] storage_cidr: "{{ ip_settings[inventory_hostname]['storage']['cidr'] }}" +mgmt_cidr: "{{ ip_settings[inventory_hostname]['mgmt']['cidr'] }}" public_net_info: "{{ network_cfg.public_net_info }}" host_ip_settings: "{{ ip_settings[inventory_hostname] }}" diff --git a/conf/templates/ansible_installer/openstack_liberty/hosts/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_liberty/hosts/HA-ansible-multinodes.tmpl index af384d45..9d628b5e 100644 --- a/conf/templates/ansible_installer/openstack_liberty/hosts/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_liberty/hosts/HA-ansible-multinodes.tmpl @@ -1,3 +1,12 @@ +#set ip_settings={} +#for k,v in $getVar('ip_settings', {}).items() +#set host_ip_settings={} +#for intf in v +#set $host_ip_settings[$intf["alias"]]=intf +#end for +#set $ip_settings[$k]=$host_ip_settings +#end for + # localhost 127.0.0.1 localhost #set controllers = $getVar('controller', []) @@ -10,13 +19,13 @@ #end if # controller #for worker in $controllers - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for # compute #for worker in $computes - #set worker_ip = $worker.install.ip #set worker_hostname = $worker.hostname + #set worker_ip = $ip_settings[$worker_hostname].mgmt.ip $worker_ip $worker_hostname #end for diff --git a/conf/templates/ansible_installer/openstack_liberty/vars/HA-ansible-multinodes.tmpl b/conf/templates/ansible_installer/openstack_liberty/vars/HA-ansible-multinodes.tmpl index e85ca3c1..d41eca1b 100644 --- a/conf/templates/ansible_installer/openstack_liberty/vars/HA-ansible-multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_liberty/vars/HA-ansible-multinodes.tmpl @@ -37,6 +37,8 @@ deploy_type: $getVar('deploy_type', 'virtual') public_cidr: $computers[0]['install']['subnet'] storage_cidr: "{{ ip_settings[inventory_hostname]['storage']['cidr'] }}" +mgmt_cidr: "{{ ip_settings[inventory_hostname]['mgmt']['cidr'] }}" + public_net_info: "{{ network_cfg.public_net_info }}" host_ip_settings: "{{ ip_settings[inventory_hostname] }}"