aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-09-23 14:23:44 +0800
committerbaigk <baiguoku@huawei.com>2015-09-24 00:22:30 +0800
commit5dcc94014a588e6f7bb5cb605b164609ac0b50c7 (patch)
tree1027a92382ed4a3c96c0bb2ec84ec1fdfd8e8b93 /deploy/adapters/ansible
parent7d95e981d3685795620443083385e00ab1ccd3f0 (diff)
bug fix: using external_vip as linked dashboard ip
JIRA: COMPASS-72 Change-Id: I9ab8f6042635a7a06f1a4e2fb3222f790a5bee76 Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible')
-rw-r--r--deploy/adapters/ansible/roles/dashboard/tasks/main.yml13
-rw-r--r--deploy/adapters/ansible/roles/dashboard/templates/ports.j215
-rw-r--r--deploy/adapters/ansible/roles/dashboard/vars/Debian.yml9
-rw-r--r--deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml11
-rw-r--r--deploy/adapters/ansible/roles/ha/templates/haproxy.cfg6
-rw-r--r--deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py12
6 files changed, 39 insertions, 27 deletions
diff --git a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
index 9206fda4..dd5c6fd0 100644
--- a/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/dashboard/tasks/main.yml
@@ -1,13 +1,20 @@
---
- include_vars: "{{ ansible_os_family }}.yml"
+- name: install http packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items: http_packages
+
+- name: set http config
+ lineinfile: dest={{ http_config_file }} regexp='^Listen 80' line='Listen {{ internal_ip }}:80'
+
+- name: restart http services
+ service: name={{ http_service }} state=restarted enabled=yes
+
- name: install dashboard packages
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: packages | union(packages_noarch)
-- name: set apache2 config
- template: src=ports.j2 dest=/etc/apache2/ports.conf backup=yes
-
- name: remove ubuntu theme
action: "{{ ansible_pkg_mgr }} name=openstack-dashboard-ubuntu-theme state=absent"
diff --git a/deploy/adapters/ansible/roles/dashboard/templates/ports.j2 b/deploy/adapters/ansible/roles/dashboard/templates/ports.j2
deleted file mode 100644
index 0bfa0428..00000000
--- a/deploy/adapters/ansible/roles/dashboard/templates/ports.j2
+++ /dev/null
@@ -1,15 +0,0 @@
-# if you just change the port or add more ports here, you will likely also
-# have to change the VirtualHost statement in
-# /etc/apache2/sites-enabled/000-default.conf
-
-Listen {{ internal_ip }}:80
-
-<IfModule ssl_module>
- Listen 443
-</IfModule>
-
-<IfModule mod_gnutls.c>
- Listen 443
-</IfModule>
-
-# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
diff --git a/deploy/adapters/ansible/roles/dashboard/vars/Debian.yml b/deploy/adapters/ansible/roles/dashboard/vars/Debian.yml
index fee64c38..97c4af40 100644
--- a/deploy/adapters/ansible/roles/dashboard/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/dashboard/vars/Debian.yml
@@ -1,8 +1,13 @@
---
-packages:
+http_packages:
- apache2
- libapache2-mod-wsgi
+http_service: apache2
+
+packages: []
+
services:
- - apache2
- memcached
+
+http_config_file: "/etc/apache2/ports.conf"
diff --git a/deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml b/deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml
index f0acce9b..5e84901c 100644
--- a/deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/dashboard/vars/RedHat.yml
@@ -1,8 +1,13 @@
---
-packages:
+http_packages:
- httpd
+
+http_service: httpd
+
+packages:
- mod_wsgi
- python-memcached
-services:
- - httpd
+services: []
+
+http_config_file: "/etc/httpd/conf/httpd.conf"
diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
index 8f026fa4..27aa5b24 100644
--- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
+++ b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
@@ -27,6 +27,7 @@ defaults
listen proxy-glance_registry_cluster
bind {{ internal_vip.ip }}:9191
+ bind {{ public_vip.ip }}:9191
option tcpka
option tcplog
balance source
@@ -47,6 +48,7 @@ listen proxy-glance_api_cluster
listen proxy-nova-novncproxy
bind {{ internal_vip.ip }}:6080
+ bind {{ public_vip.ip }}:6080
option tcpka
option tcplog
balance source
@@ -56,6 +58,7 @@ listen proxy-nova-novncproxy
listen proxy-network
bind {{ internal_vip.ip }}:9696
+ bind {{ public_vip.ip }}:9696
option tcpka
option tcplog
balance source
@@ -65,6 +68,7 @@ listen proxy-network
listen proxy-volume
bind {{ internal_vip.ip }}:8776
+ bind {{ public_vip.ip }}:8776
option tcpka
option httpchk
option tcplog
@@ -75,6 +79,7 @@ listen proxy-volume
listen proxy-keystone_admin_cluster
bind {{ internal_vip.ip }}:35357
+ bind {{ public_vip.ip }}:35357
option tcpka
option httpchk
option tcplog
@@ -85,6 +90,7 @@ listen proxy-keystone_admin_cluster
listen proxy-keystone_public_internal_cluster
bind {{ internal_vip.ip }}:5000
+ bind {{ public_vip.ip }}:5000
option tcpka
option httpchk
option tcplog
diff --git a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
index b46abcee..5e6520af 100644
--- a/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
+++ b/deploy/adapters/ansible/roles/setup-network/files/setup_networks/setup_networks.py
@@ -30,7 +30,8 @@ def add_ovs_port(ovs_br, ifname, vlan_id=None):
cmd = "ovs-vsctl --may-exist add-port %s %s" % (ovs_br, ifname)
if vlan_id:
cmd += " tag=%s" % vlan_id
- cmd += " -- set Interface %s type=internal" % ifname
+ cmd += " -- set Interface %s type=internal;" % ifname
+ cmd += "ip link set %s up;" % ifname
LOG.info("add_ovs_port: cmd=%s" % cmd)
os.system(cmd)
@@ -44,11 +45,14 @@ def setup_intfs(sys_intf_mappings):
else:
pass
-def setup_ips(ip_settings):
+def setup_ips(ip_settings, sys_intf_mappings):
LOG.info("setup_ips enter")
for intf_info in ip_settings.values():
network = netaddr.IPNetwork(intf_info["cidr"])
- intf_name = intf_info["alias"]
+ if sys_intf_mappings[intf_info["name"]]["type"] == "ovs":
+ intf_name = intf_info["name"]
+ else:
+ intf_name = intf_info["alias"]
cmd = "ip addr add %s/%s brd %s dev %s;" \
% (intf_info["ip"], intf_info["netmask"], str(network.broadcast),intf_name)
if "gw" in intf_info:
@@ -65,7 +69,7 @@ def setup_ips(ip_settings):
def main(config):
setup_bondings(config["bond_mappings"])
setup_intfs(config["sys_intf_mappings"])
- setup_ips(config["ip_settings"])
+ setup_ips(config["ip_settings"], config["sys_intf_mappings"])
if __name__ == "__main__":
os.system("service openvswitch-switch status|| service openvswitch-switch start")