summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles
diff options
context:
space:
mode:
authoryour name <email@163.com>2015-09-09 03:26:11 -0400
committeryour name <email@163.com>2015-09-09 03:26:11 -0400
commit72039e915d1fc960bd0d7fccd910ea282d61bee7 (patch)
tree60452129b1b9f3c3419b4a29a038f5f0cbade5f7 /deploy/adapters/ansible/roles
parentcf87d3067a63cb8be315a3addfd9c27d86be3b5a (diff)
Compass Netconfig optimization
Change-Id: Icbcfc7d794623436f22be5f6763b212a25d4fac7 JIRA: COMPASS-30
Diffstat (limited to 'deploy/adapters/ansible/roles')
-rw-r--r--deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml2
-rw-r--r--deploy/adapters/ansible/roles/cinder-controller/tasks/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/common/tasks/main.yml4
-rw-r--r--deploy/adapters/ansible/roles/common/vars/Debian.yml4
-rw-r--r--deploy/adapters/ansible/roles/common/vars/RedHat.yml4
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/main.yml4
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb.yml20
-rw-r--r--deploy/adapters/ansible/roles/database/templates/wsrep.cnf4
-rw-r--r--deploy/adapters/ansible/roles/database/vars/Debian.yml5
-rw-r--r--deploy/adapters/ansible/roles/database/vars/RedHat.yml2
-rw-r--r--deploy/adapters/ansible/roles/ext-network/handlers/main.yml21
-rw-r--r--deploy/adapters/ansible/roles/ext-network/tasks/main.yml57
-rw-r--r--deploy/adapters/ansible/roles/glance/tasks/glance_config.yml3
-rw-r--r--deploy/adapters/ansible/roles/glance/tasks/main.yml2
-rw-r--r--deploy/adapters/ansible/roles/ha/templates/haproxy.cfg40
-rw-r--r--deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml2
-rw-r--r--deploy/adapters/ansible/roles/keystone/tasks/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml4
-rw-r--r--deploy/adapters/ansible/roles/neutron-compute/defaults/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml5
-rw-r--r--deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/neutron-controller/tasks/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml7
-rw-r--r--deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml2
-rw-r--r--deploy/adapters/ansible/roles/neutron-controller/vars/RedHat.yml3
-rw-r--r--deploy/adapters/ansible/roles/neutron-network/tasks/main.yml14
-rw-r--r--deploy/adapters/ansible/roles/nova-controller/tasks/main.yml1
-rw-r--r--deploy/adapters/ansible/roles/nova-controller/tasks/nova_config.yml1
-rw-r--r--deploy/adapters/ansible/roles/setup-network/tasks/main.yml43
-rw-r--r--deploy/adapters/ansible/roles/setup-network/templates/my_configs.debian16
30 files changed, 217 insertions, 58 deletions
diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml
index fe9f7dc8..77029b81 100644
--- a/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml
+++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/cinder_config.yml
@@ -5,6 +5,7 @@
- name: sync cinder db
shell: su -s /bin/sh -c "cinder-manage db sync" cinder && cinder
register: result
+ run_once: True
until: result.rc == 0
retries: 5
delay: 3
@@ -18,5 +19,6 @@
- name: run cinder register script
shell: for i in {0..5}; do /opt/cinder_init.sh && touch cinder_init_complete; if [ $? != 0 ]; then sleep 5; else break; fi; done
+ run_once: True
args:
creates: cinder_init_complete
diff --git a/deploy/adapters/ansible/roles/cinder-controller/tasks/main.yml b/deploy/adapters/ansible/roles/cinder-controller/tasks/main.yml
index 9faa456b..e6a5f04f 100644
--- a/deploy/adapters/ansible/roles/cinder-controller/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/cinder-controller/tasks/main.yml
@@ -8,7 +8,6 @@
- cinder
- include: cinder_config.yml
- when: HA_CLUSTER is not defined or HA_CLUSTER[inventory_hostname] == ''
tags:
- config
- cinder-config
diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml
index 1b20c0fd..b58bb44d 100644
--- a/deploy/adapters/ansible/roles/common/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/common/tasks/main.yml
@@ -45,3 +45,7 @@
- name: restart ntp
service: name={{ ntp_service }} state=restarted enabled=yes
+
+- name: restart openvswitch
+ service: name={{ item }} state=restarted enabled=yes
+ with_items: services
diff --git a/deploy/adapters/ansible/roles/common/vars/Debian.yml b/deploy/adapters/ansible/roles/common/vars/Debian.yml
index af6130cb..0890c757 100644
--- a/deploy/adapters/ansible/roles/common/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/common/vars/Debian.yml
@@ -2,5 +2,9 @@
packages:
- ubuntu-cloud-keyring
- python-dev
+ - openvswitch-datapath-dkms
+ - openvswitch-switch
+
+services: []
ntp_service: ntp
diff --git a/deploy/adapters/ansible/roles/common/vars/RedHat.yml b/deploy/adapters/ansible/roles/common/vars/RedHat.yml
index f75c253e..57172b7f 100644
--- a/deploy/adapters/ansible/roles/common/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/common/vars/RedHat.yml
@@ -1,5 +1,9 @@
---
packages:
- python-devel
+ - openvswitch
+
+services:
+ - openvswitch
ntp_service: ntpd
diff --git a/deploy/adapters/ansible/roles/database/tasks/main.yml b/deploy/adapters/ansible/roles/database/tasks/main.yml
index 05697730..71916751 100644
--- a/deploy/adapters/ansible/roles/database/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/main.yml
@@ -7,8 +7,8 @@
- mysql_user
- include: mysql.yml
- when: HA_CLUSTER is not defined
+ when: haproxy_hosts is not defined
- include: mariadb.yml
- when: HA_CLUSTER is defined
+ when: haproxy_hosts is defined
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
index dbd76c68..3626777b 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb.yml
@@ -1,4 +1,9 @@
---
+#- name: delete default maridb-libs
+# action: "{{ ansible_pkg_mgr }} name=mariadb-libs state=absent"
+# when: ansible_os_family == "RedHat"
+# ignore_errors: True
+
- name: install python-mysqldb
action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
with_items: maridb_packages | union(packages_noarch)
@@ -19,8 +24,19 @@
- name: update wsrep_sst_rsync gid
lineinfile: dest=/usr/bin/wsrep_sst_rsync state=absent regexp="\s*gid = \$MYGID$" backup=yes
-- name: manually restart mysql server
+- name: restart first mysql server
+ shell: service mysql restart --wsrep-cluster-address="gcomm://"
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+ register: result
+ until: result|success
+ retries: 5
+ delay: 5
+ tags:
+ - mysql_restart
+
+- name: restart other mysql server
service: name=mysql state=restarted enabled=yes
+ when: inventory_hostname != haproxy_hosts.keys()[0]
register: result
until: result|success
retries: 5
@@ -34,6 +50,6 @@
- name: create database/user
shell: /opt/data.sh
- when: HA_CLUSTER[inventory_hostname] == ''
+ run_once: True
tags:
- mysql_user
diff --git a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
index 81699796..6c14b155 100644
--- a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
+++ b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
@@ -48,7 +48,7 @@ wsrep_provider={{ wsrep_provider_file }}
wsrep_cluster_name="my_wsrep_cluster"
# Group communication system handle
-wsrep_cluster_address=gcomm://{{ HA_CLUSTER[inventory_hostname] }}
+wsrep_cluster_address=gcomm://{{ haproxy_hosts.values()|join(",") }}
# Human-readable node name (non-unique). Hostname by default.
#wsrep_node_name=
@@ -56,7 +56,7 @@ wsrep_cluster_address=gcomm://{{ HA_CLUSTER[inventory_hostname] }}
# Base replication <address|hostname>[:port] of the node.
# The values supplied will be used as defaults for state transfer receiving,
# listening ports and so on. Default: address of the first network interface.
-wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}
+wsrep_node_address={{ internal_ips[inventory_hostname] }}
# Address for incoming client connections. Autodetect by default.
#wsrep_node_incoming_address=
diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml
index 79f7008c..15657d58 100644
--- a/deploy/adapters/ansible/roles/database/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/database/vars/Debian.yml
@@ -7,10 +7,9 @@ mysql_packages:
maridb_packages:
- libaio1
- libssl0.9.8
- - mysql-client-5.5
- python-mysqldb
- - mysql-wsrep-server
- - galera
+ - mysql-wsrep-server-5.5
+ - galera-3
services: []
diff --git a/deploy/adapters/ansible/roles/database/vars/RedHat.yml b/deploy/adapters/ansible/roles/database/vars/RedHat.yml
index 1e4b427a..12eedf51 100644
--- a/deploy/adapters/ansible/roles/database/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/database/vars/RedHat.yml
@@ -4,8 +4,8 @@ mysql_packages:
- mysql-server
maridb_packages:
+ - MariaDB-Galera-server
- MariaDB-client
- - MariaDB-server
- galera
services: []
diff --git a/deploy/adapters/ansible/roles/ext-network/handlers/main.yml b/deploy/adapters/ansible/roles/ext-network/handlers/main.yml
new file mode 100644
index 00000000..d6c5cc8f
--- /dev/null
+++ b/deploy/adapters/ansible/roles/ext-network/handlers/main.yml
@@ -0,0 +1,21 @@
+---
+- name: restart neutron-plugin-openvswitch-agent
+ service: name=neutron-plugin-openvswitch-agent state=restarted enabled=yes
+ when: "'opendaylight' not in {{ NEUTRON_MECHANISM_DRIVERS }}"
+
+- name: restart neutron-l3-agent
+ service: name=neutron-l3-agent state=restarted enabled=yes
+
+- name: kill dnsmasq
+ command: killall dnsmasq
+ ignore_errors: True
+
+- name: restart neutron-dhcp-agent
+ service: name=neutron-dhcp-agent state=restarted enabled=yes
+
+- name: restart neutron-metadata-agent
+ service: name=neutron-metadata-agent state=restarted enabled=yes
+
+- name: restart xorp
+ service: name=xorp state=restarted enabled=yes sleep=10
+ ignore_errors: True
diff --git a/deploy/adapters/ansible/roles/ext-network/tasks/main.yml b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml
new file mode 100644
index 00000000..bffb995f
--- /dev/null
+++ b/deploy/adapters/ansible/roles/ext-network/tasks/main.yml
@@ -0,0 +1,57 @@
+---
+- name: create external net
+ neutron_network:
+ login_username: ADMIN
+ login_password: "{{ ADMIN_PASS }}"
+ login_tenant_name: admin
+ auth_url: "http://{{ HA_VIP }}:35357/v2.0"
+ name: "{{ public_net_info.network }}"
+ provider_network_type: "{{ public_net_info.type }}"
+ provider_physical_network: "{{ public_net_info.provider_network }}"
+ provider_segmentation_id: "{{ public_net_info.segment_id}}"
+ shared: true
+ router_external: yes
+ state: present
+ run_once: true
+ when: 'public_net_info.enable == True'
+
+- name: create external subnet
+ neutron_subnet:
+ login_username: ADMIN
+ login_password: "{{ ADMIN_PASS }}"
+ login_tenant_name: admin
+ auth_url: "http://{{ HA_VIP }}:35357/v2.0"
+ name: "{{ public_net_info.subnet }}"
+ network_name: "{{ public_net_info.network }}"
+ cidr: "{{ public_net_info.floating_ip_cidr }}"
+ enable_dhcp: "{{ public_net_info.enable_dhcp }}"
+ no_gateway: "{{ public_net_info.no_gateway }}"
+ gateway_ip: "{{ public_net_info.external_gw }}"
+ allocation_pool_start: "{{ public_net_info.floating_ip_start }}"
+ allocation_pool_end: "{{ public_net_info.floating_ip_end }}"
+ state: present
+ run_once: true
+ when: 'public_net_info.enable == True'
+
+- name: create external router
+ neutron_router:
+ login_username: ADMIN
+ login_password: "{{ ADMIN_PASS }}"
+ login_tenant_name: admin
+ auth_url: "http://{{ HA_VIP }}:35357/v2.0"
+ name: "{{ public_net_info.router }}"
+ state: present
+ run_once: true
+ when: 'public_net_info.enable == True'
+
+- name: set external router gateway
+ neutron_router_gateway:
+ login_username: ADMIN
+ login_password: "{{ ADMIN_PASS }}"
+ login_tenant_name: admin
+ auth_url: "http://{{ HA_VIP }}:35357/v2.0"
+ router_name: "{{ public_net_info.router }}"
+ network_name: "{{ public_net_info.network }}"
+ state: present
+ run_once: true
+ when: 'public_net_info.enable == True'
diff --git a/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml b/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml
index 0960acfc..e2390d0e 100644
--- a/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml
+++ b/deploy/adapters/ansible/roles/glance/tasks/glance_config.yml
@@ -1,10 +1,12 @@
---
- name: init glance db version
shell: glance-manage db_version_control 0
+ run_once: True
when: ansible_os_family == "Debian"
- name: sync glance db
shell: sleep 15; su -s /bin/sh -c "glance-manage db_sync" glance
+ run_once: True
register: result
until: result.rc == 0
retries: 5
@@ -28,6 +30,7 @@
wait_for: host={{ image_host }} port=9292 delay=5
- name: run image upload
+ run_once: True
shell: for i in {0..5}; do /opt/image_upload.sh && touch image_upload_completed; if [ $? != 0 ] ;then sleep 5; else break;fi;done
args:
creates: image_upload_completed
diff --git a/deploy/adapters/ansible/roles/glance/tasks/main.yml b/deploy/adapters/ansible/roles/glance/tasks/main.yml
index 5d7db8e9..64b8ca9d 100644
--- a/deploy/adapters/ansible/roles/glance/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/glance/tasks/main.yml
@@ -12,7 +12,7 @@
- nfs
- include: glance_config.yml
- when: HA_CLUSTER is not defined or HA_CLUSTER[inventory_hostname] == ''
+ run_once: True
tags:
- config
- glance_config
diff --git a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
index 4ed528ad..4b20db03 100644
--- a/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
+++ b/deploy/adapters/ansible/roles/ha/templates/haproxy.cfg
@@ -30,8 +30,8 @@ listen proxy-glance_registry_cluster
option tcpka
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9191 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:9191 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-glance_api_cluster
@@ -40,8 +40,8 @@ listen proxy-glance_api_cluster
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9292 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:9292 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-nova-novncproxy
@@ -49,8 +49,8 @@ listen proxy-nova-novncproxy
option tcpka
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:6080 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:6080 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-network
@@ -58,8 +58,8 @@ listen proxy-network
option tcpka
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:9696 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:9696 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-volume
@@ -68,8 +68,8 @@ listen proxy-volume
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8776 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:8776 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-keystone_admin_cluster
@@ -78,8 +78,8 @@ listen proxy-keystone_admin_cluster
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:35357 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:35357 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-keystone_public_internal_cluster
@@ -88,8 +88,8 @@ listen proxy-keystone_public_internal_cluster
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:5000 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:5000 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-nova_compute_api_cluster
@@ -98,8 +98,8 @@ listen proxy-nova_compute_api_cluster
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8774 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:8774 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-nova_metadata_api_cluster
@@ -107,8 +107,8 @@ listen proxy-nova_metadata_api_cluster
option tcpka
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8775 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:8775 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen proxy-cinder_api_cluster
@@ -117,8 +117,8 @@ listen proxy-cinder_api_cluster
option httpchk
option tcplog
balance source
-{% for host in groups['controller'] %}
- server {{ host }} {{ hostvars[host]['ansible_' + INTERNAL_INTERFACE].ipv4.address }}:8776 weight 1 check inter 2000 rise 2 fall 5
+{% for host,ip in haproxy_hosts.items() %}
+ server {{ host }} {{ ip }}:8776 weight 1 check inter 2000 rise 2 fall 5
{% endfor %}
listen stats
diff --git a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml
index 4ba3ad03..78ac970b 100644
--- a/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml
+++ b/deploy/adapters/ansible/roles/keystone/tasks/keystone_config.yml
@@ -2,6 +2,7 @@
- name: keystone-manage db-sync
shell: su -s /bin/sh -c "keystone-manage db_sync"
register: result
+ run_once: True
until: result.rc == 0
retries: 5
delay: 3
@@ -10,6 +11,7 @@
template: src=keystone_init dest=/opt/keystone_init mode=0744
- name: run keystone_init
+ run_once: True
shell: /opt/keystone_init && touch keystone_init_complete || keystone_init_failed
args:
creates: keystone_init_complete
diff --git a/deploy/adapters/ansible/roles/keystone/tasks/main.yml b/deploy/adapters/ansible/roles/keystone/tasks/main.yml
index 2f36e911..3ff37342 100644
--- a/deploy/adapters/ansible/roles/keystone/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/keystone/tasks/main.yml
@@ -6,7 +6,6 @@
- keystone
- include: keystone_config.yml
- when: HA_CLUSTER is not defined or HA_CLUSTER[inventory_hostname] == ''
tags:
- config
- keystone_config
diff --git a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml
index cb83a0c9..fdc18a65 100644
--- a/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml
+++ b/deploy/adapters/ansible/roles/mq/tasks/rabbitmq_cluster.yml
@@ -1,11 +1,11 @@
---
- name: stop rabbitmq app
command: rabbitmqctl stop_app
- when: HA_CLUSTER[inventory_hostname] != ''
+ run_once: True
- name: rabbitmqctl reset
command: rabbitmqctl reset
- when: HA_CLUSTER[inventory_hostname] != ''
+ run_once: True
- name: stop rabbitmq
shell: rabbitmqctl stop
diff --git a/deploy/adapters/ansible/roles/neutron-compute/defaults/main.yml b/deploy/adapters/ansible/roles/neutron-compute/defaults/main.yml
index 825178b2..ed97d539 100644
--- a/deploy/adapters/ansible/roles/neutron-compute/defaults/main.yml
+++ b/deploy/adapters/ansible/roles/neutron-compute/defaults/main.yml
@@ -1,2 +1 @@
---
-neutron_ovs_bridge_mappings: ""
diff --git a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml
index 6c1f3bd9..e7ee13fc 100644
--- a/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/neutron-compute/tasks/main.yml
@@ -28,7 +28,7 @@
with_items: services | union(services_noarch)
- name: config ml2 plugin
- template: src=ml2_conf.ini
+ template: src=templates/ml2_conf.ini
dest=/etc/neutron/plugins/ml2/ml2_conf.ini
backup=yes
@@ -44,9 +44,6 @@
- meta: flush_handlers
-- name: add br-int
- openvswitch_bridge: bridge=br-int state=present
-
- include: ../../neutron-network/tasks/odl.yml
when: "'opendaylight' in {{ NEUTRON_MECHANISM_DRIVERS }}"
diff --git a/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml b/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml
index a9d9bd18..844718ff 100644
--- a/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml
+++ b/deploy/adapters/ansible/roles/neutron-controller/handlers/main.yml
@@ -2,3 +2,4 @@
- name: restart neutron control services
service: name={{ item }} state=restarted enabled=yes
with_items: services | union(services_noarch)
+ when: item != "neutron-server"
diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/main.yml
index 5ac1e045..5b3640d7 100644
--- a/deploy/adapters/ansible/roles/neutron-controller/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/main.yml
@@ -6,7 +6,6 @@
- neutron
- include: neutron_config.yml
- when: HA_CLUSTER is not defined or HA_CLUSTER[inventory_hostname] == ''
tags:
- config
- neutron_config
diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml
index c575b328..991e33cc 100644
--- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml
+++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_config.yml
@@ -2,10 +2,17 @@
- name: neutron-db-manage upgrade to Juno
shell: neutron-db-manage --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugins/ml2/ml2_conf.ini upgrade head
register: result
+ run_once: True
until: result.rc == 0
retries: 5
delay: 3
notify:
- restart neutron control services
+- name: restart neutron-server
+ service: name=neutron-server state=restarted enabled=yes
+ delegate_to: "{{ item }}"
+ run_once: True
+ with_items: groups['controller']
+
- meta: flush_handlers
diff --git a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml
index 96f17231..9655c0b3 100644
--- a/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml
+++ b/deploy/adapters/ansible/roles/neutron-controller/tasks/neutron_install.yml
@@ -17,7 +17,7 @@
template: src=templates/neutron.conf dest=/etc/neutron/neutron.conf backup=yes
- name: update ml2 plugin conf
- template: src=ml2_conf.ini dest=/etc/neutron/plugins/ml2/ml2_conf.ini backup=yes
+ template: src=templates/ml2_conf.ini dest=/etc/neutron/plugins/ml2/ml2_conf.ini backup=yes
- name: ln plugin.ini
file: src=/etc/neutron/plugins/ml2/ml2_conf.ini dest=/etc/neutron/plugin.ini state=link
diff --git a/deploy/adapters/ansible/roles/neutron-controller/vars/RedHat.yml b/deploy/adapters/ansible/roles/neutron-controller/vars/RedHat.yml
index 14eb730c..24557b4e 100644
--- a/deploy/adapters/ansible/roles/neutron-controller/vars/RedHat.yml
+++ b/deploy/adapters/ansible/roles/neutron-controller/vars/RedHat.yml
@@ -3,5 +3,4 @@ packages:
- openstack-neutron
- openstack-neutron-ml2
-services:
- - neutron-server
+services: []
diff --git a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml
index 6e4ed200..d1052897 100644
--- a/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/neutron-network/tasks/main.yml
@@ -44,7 +44,7 @@
dest=/etc/neutron/metadata_agent.ini backup=yes
- name: config ml2 plugin
- template: src=ml2_conf.ini
+ template: src=templates/ml2_conf.ini
dest=/etc/neutron/plugins/ml2/ml2_conf.ini
backup=yes
@@ -58,13 +58,6 @@
- meta: flush_handlers
-- name: add br-int
- openvswitch_bridge: bridge=br-int state=present
-
-- name: add br-ex
- openvswitch_bridge: bridge=br-ex state=present
- when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}"
-
- name: ln plugin.ini
file: src=/etc/neutron/plugins/ml2/ml2_conf.ini dest=/etc/neutron/plugin.ini state=link
@@ -73,11 +66,6 @@
- meta: flush_handlers
-- name: assign a port to br-ex for physical ext interface
- openvswitch_port: bridge=br-ex port={{ INTERFACE_NAME }}
- state=present
- when: "'openvswitch' in {{ NEUTRON_MECHANISM_DRIVERS }}"
-
- include: igmp-router.yml
when: "'vxlan' in {{ NEUTRON_TUNNEL_TYPES }} and ansible_os_family == 'Debian'"
diff --git a/deploy/adapters/ansible/roles/nova-controller/tasks/main.yml b/deploy/adapters/ansible/roles/nova-controller/tasks/main.yml
index 72a9f4d4..de2563d7 100644
--- a/deploy/adapters/ansible/roles/nova-controller/tasks/main.yml
+++ b/deploy/adapters/ansible/roles/nova-controller/tasks/main.yml
@@ -6,7 +6,6 @@
- nova
- include: nova_config.yml
- when: HA_CLUSTER is not defined or HA_CLUSTER[inventory_hostname] == ''
tags:
- config
- nova_config
diff --git a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_config.yml b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_config.yml
index fbf8e773..df2d5dad 100644
--- a/deploy/adapters/ansible/roles/nova-controller/tasks/nova_config.yml
+++ b/deploy/adapters/ansible/roles/nova-controller/tasks/nova_config.yml
@@ -3,6 +3,7 @@
command: su -s /bin/sh -c "nova-manage db sync" nova
register: result
until: result.rc == 0
+ run_once: True
retries: 5
delay: 3
notify:
diff --git a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml
new file mode 100644
index 00000000..94816044
--- /dev/null
+++ b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml
@@ -0,0 +1,43 @@
+---
+- name: add ovs bridge
+ openvswitch_bridge: bridge={{ item["name"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: 'item["type"] == "ovs"'
+
+- name: add ovs uplink
+ openvswitch_port: bridge={{ item["name"] }} port={{ item["interface"] }} state=present
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: 'item["type"] == "ovs"'
+
+- name: add ovs uplink
+ shell: ip link set {{ item["interface"] }} up
+ with_items: "{{ network_cfg['provider_net_mappings'] }}"
+ when: 'item["type"] == "ovs"'
+
+- name: setup sys intf
+ shell: ip link del {{ item["name"] }}; \
+ ip link add link {{ item["interface"] }} name {{ item["name"] }} type vlan id {{ item["vlan_tag"] }}; \
+ ip link set {{ item["interface"] }} up
+ when: '"vlan_tag" in item'
+ with_items: "{{ network_cfg['sys_intf_mappings'] }}"
+
+
+- name: set sys intf ip
+ shell: ip addr del {{ item["ip"] }}/{{ item["netmask"] }} dev {{ item["alias"] }}; \
+ ip addr add {{ item["ip"] }}/{{ item["netmask"] }} dev {{ item["alias"] }}; \
+ ip link set {{ item["alias"] }} up
+ with_items: "{{ host_ip_settings }}"
+
+- name: set gateway
+ shell: ip route del default; \
+ ip route add default via {{ item["gw"] }} dev {{ item["alias"] }}
+ when: '"gw" in item'
+ with_items: "{{ host_ip_settings }}"
+
+- name: copy net config
+ template: src=my_configs.debian dest=/etc/network/interfaces.d/my_configs.cfg
+ when: ansible_os_family == "Debian"
+
+- name: source net config
+ lineinfile: dest=/etc/network/interfaces line='source /etc/network/interfaces.d/my_configs.cfg'
+ when: ansible_os_family == "Debian"
diff --git a/deploy/adapters/ansible/roles/setup-network/templates/my_configs.debian b/deploy/adapters/ansible/roles/setup-network/templates/my_configs.debian
new file mode 100644
index 00000000..54031ed4
--- /dev/null
+++ b/deploy/adapters/ansible/roles/setup-network/templates/my_configs.debian
@@ -0,0 +1,16 @@
+{%- for intf in host_ip_settings %}
+
+auto {{ intf["alias"] }}
+iface {{ intf["alias"] }} inet static
+ address {{ intf["ip"] }}
+ netmask {{ intf["netmask"] }}
+{% if "gw" in intf %}
+ gateway {{ intf["gw"] }}
+{% endif %}
+{% for sys_intf in network_cfg["sys_intf_mappings"] %}
+{% if "vlan_tag" in sys_intf and sys_intf["name"] == intf["alias"] %}
+ pre-up ip link set {{ sys_intf["interface"] }} up
+ pre-up ip link add link {{ sys_intf["interface"] }} name {{ sys_intf["name"] }} type vlan id {{ sys_intf["vlan_tag"] }}
+{% endif %}
+{% endfor %}
+{% endfor %}