aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-07-31 08:50:41 +0000
committerGerrit Code Review <review@openstack.org>2015-07-31 08:50:41 +0000
commit240bed12caf0f45a4e0982c50719ff06675013a7 (patch)
tree8738950c1ac1923e3dbaffcb5ddbabf5232c04d8 /ansible
parent6b1f9714c703bb3a1c2411b264b26c3fc960901f (diff)
parentab9f652113243c38bef59b907e6729ea5d17f9e0 (diff)
downloadkolla-240bed12caf0f45a4e0982c50719ff06675013a7.tar.gz
kolla-240bed12caf0f45a4e0982c50719ff06675013a7.zip
Merge "Add keepalived to ansible"
Diffstat (limited to 'ansible')
-rwxr-xr-xansible/roles/haproxy/defaults/main.yml11
-rwxr-xr-xansible/roles/haproxy/tasks/config.yml11
-rwxr-xr-xansible/roles/haproxy/tasks/start.yml10
-rw-r--r--ansible/roles/haproxy/templates/keepalived.conf.j219
4 files changed, 51 insertions, 0 deletions
diff --git a/ansible/roles/haproxy/defaults/main.yml b/ansible/roles/haproxy/defaults/main.yml
index 1d8b444a6..910ddd4c8 100755
--- a/ansible/roles/haproxy/defaults/main.yml
+++ b/ansible/roles/haproxy/defaults/main.yml
@@ -14,3 +14,14 @@ kolla_haproxy_container_name: "haproxy"
docker_haproxy_image: "{{ docker_haproxy_registry }}{{ docker_haproxy_namespace }}/{{ kolla_haproxy_base_distro }}-{{ kolla_haproxy_install_type }}-{{ kolla_haproxy_container_name }}"
docker_haproxy_tag: "{{ openstack_release }}"
docker_haproxy_image_full: "{{ docker_haproxy_image }}:{{ docker_haproxy_tag }}"
+
+
+docker_keepalived_registry: "{{ docker_registry }}"
+docker_keepalived_namespace: "{{ docker_namespace }}"
+kolla_keepalived_base_distro: "{{ kolla_base_distro }}"
+kolla_keepalived_install_type: "{{ kolla_install_type }}"
+kolla_keepalived_container_name: "keepalived"
+
+docker_keepalived_image: "{{ docker_keepalived_registry }}{{ docker_keepalived_namespace }}/{{ kolla_keepalived_base_distro }}-{{ kolla_keepalived_install_type }}-{{ kolla_keepalived_container_name }}"
+docker_keepalived_tag: "{{ openstack_release }}"
+docker_keepalived_image_full: "{{ docker_keepalived_image }}:{{ docker_keepalived_tag }}"
diff --git a/ansible/roles/haproxy/tasks/config.yml b/ansible/roles/haproxy/tasks/config.yml
index 6aa4c0bba..d71ae7232 100755
--- a/ansible/roles/haproxy/tasks/config.yml
+++ b/ansible/roles/haproxy/tasks/config.yml
@@ -12,3 +12,14 @@
- name: Allowing non-local IP binding
sysctl: name="net.ipv4.ip_nonlocal_bind" value=1 sysctl_set=yes
+
+- name: Ensuring config directory exists
+ file:
+ path: "{{ node_config_directory }}/keepalived/"
+ state: "directory"
+ recurse: "yes"
+
+- name: Copying over config(s)
+ template:
+ src: "keepalived.conf.j2"
+ dest: "{{ node_config_directory }}/keepalived/keepalived.conf"
diff --git a/ansible/roles/haproxy/tasks/start.yml b/ansible/roles/haproxy/tasks/start.yml
index cbb577b0f..cda6c0cf3 100755
--- a/ansible/roles/haproxy/tasks/start.yml
+++ b/ansible/roles/haproxy/tasks/start.yml
@@ -1,6 +1,16 @@
---
- include: ../../start.yml
vars:
+ container_image: "{{ docker_keepalived_image_full }}"
+ container_name: "keepalived"
+ container_privileged: "True"
+ container_volumes:
+ - "{{ node_config_directory }}/keepalived/:/opt/kolla/keepalived/:ro"
+ container_environment:
+ KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
+
+- include: ../../start.yml
+ vars:
container_image: "{{ docker_haproxy_image_full }}"
container_name: "haproxy"
container_volumes:
diff --git a/ansible/roles/haproxy/templates/keepalived.conf.j2 b/ansible/roles/haproxy/templates/keepalived.conf.j2
new file mode 100644
index 000000000..05062e5bd
--- /dev/null
+++ b/ansible/roles/haproxy/templates/keepalived.conf.j2
@@ -0,0 +1,19 @@
+vrrp_script check_alive {
+ script "/check_alive.sh"
+ interval 2
+ weight -10
+}
+
+vrrp_instance Floating {
+ state MASTER
+ interface {{ api_interface }}
+ virtual_router_id 51
+ priority {{ groups['database'].index(inventory_hostname) }}
+ advert_int 1
+ virtual_ipaddress {
+ {{ kolla_internal_address }}
+ }
+ track_script {
+ check_alive
+ }
+}