Merge "Add etcd ansible role"

This commit is contained in:
Jenkins 2016-09-15 22:21:27 +00:00 committed by Gerrit Code Review
commit 97c99a9214
18 changed files with 125 additions and 0 deletions

View File

@ -195,6 +195,9 @@ influxdb_http_port: "8086"
senlin_api_port: "8778" senlin_api_port: "8778"
etcd_client_port: "2379"
etcd_peer_port: "2380"
public_protocol: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}" public_protocol: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}"
internal_protocol: "http" internal_protocol: "http"
admin_protocol: "http" admin_protocol: "http"
@ -245,6 +248,7 @@ enable_cinder: "no"
enable_cinder_backend_lvm: "no" enable_cinder_backend_lvm: "no"
enable_cloudkitty: "no" enable_cloudkitty: "no"
enable_congress: "no" enable_congress: "no"
enable_etcd: "no"
enable_gnocchi: "no" enable_gnocchi: "no"
enable_grafana: "no" enable_grafana: "no"
enable_heat: "yes" enable_heat: "yes"

View File

@ -23,6 +23,9 @@ compute
[grafana:children] [grafana:children]
monitoring monitoring
[etcd:children]
control
[kibana:children] [kibana:children]
control control

View File

@ -41,6 +41,9 @@ compute
[grafana:children] [grafana:children]
monitoring monitoring
[etcd:children]
control
[influxdb:children] [influxdb:children]
monitoring monitoring

View File

@ -0,0 +1,10 @@
---
project_name: "etcd"
####################
# Docker
####################
etcd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-etcd"
etcd_tag: "{{ openstack_release }}"
etcd_image_full: "{{ etcd_image }}:{{ etcd_tag }}"

View File

@ -0,0 +1,3 @@
---
dependencies:
- { role: common }

View File

@ -0,0 +1,18 @@
---
- name: Running etcd bootstrap container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False
environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ etcd_image_full }}"
labels:
BOOTSTRAP:
name: "bootstrap_etcd"
restart_policy: "never"
volumes:
- "{{ node_config_directory }}/etcd/:{{ container_config_directory }}/:ro"
- "kolla_etcd:/var/lib/etcd/"
- "kolla_logs:/var/log/kolla/"

View File

@ -0,0 +1,15 @@
---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item }}"
state: "directory"
recurse: yes
with_items:
- "etcd"
- name: Copying over config.json files for services
template:
src: "{{ item }}.json.j2"
dest: "{{ node_config_directory }}/{{ item }}/config.json"
with_items:
- "etcd"

View File

@ -0,0 +1,6 @@
---
- include: config.yml
- include: bootstrap.yml
- include: start.yml

View File

@ -0,0 +1,2 @@
---
- include: "{{ action }}.yml"

View File

@ -0,0 +1,6 @@
---
- name: Pulling etcd image
kolla_docker:
action: "pull_image"
common_options: "{{ docker_common_options }}"
image: "{{ etcd_image_full }}"

View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1,24 @@
---
- name: Starting etcd container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
environment:
ETCD_DATA_DIR: "/var/lib/etcd"
ETCD_NAME: "{{ ansible_hostname }}"
ETCD_ADVERTISE_CLIENT_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_client_port }}"
ETCD_LISTEN_CLIENT_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_client_port }}"
ETCD_INITIAL_ADVERTISE_PEER_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}"
ETCD_LISTEN_PEER_URLS: "{{ internal_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}"
ETCD_INITIAL_CLUSTER_TOKEN: "{{ etcd_cluster_token }}"
ETCD_INITIAL_CLUSTER: "{% for host in groups['etcd'] %}{{ hostvars[host]['ansible_hostname'] }}={{ internal_protocol }}://{{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:{{ etcd_peer_port }}{% if not loop.last %},{% endif %}{% endfor %}"
ETCD_INITIAL_CLUSTER_STATE: "new"
ETCD_OUT_FILE: "/var/log/kolla/etcd/etcd.log"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
image: "{{ etcd_image_full }}"
name: "etcd"
volumes:
- "{{ node_config_directory }}/etcd/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_etcd:/var/lib/etcd/"
- "kolla_logs:/var/log/kolla/"

View File

@ -0,0 +1,4 @@
---
- include: config.yml
- include: start.yml

View File

@ -0,0 +1,3 @@
{
"command": "etcd"
}

View File

@ -94,6 +94,13 @@
tags: rabbitmq, tags: rabbitmq,
when: enable_rabbitmq | bool } when: enable_rabbitmq | bool }
- hosts: etcd
serial: '{{ "30%" if action == "upgrade" else "0" }}'
roles:
- { role: etcd,
tags: etcd,
when: enable_etcd | bool }
- hosts: - hosts:
- keystone - keystone
serial: '{{ "30%" if action == "upgrade" else "0" }}' serial: '{{ "30%" if action == "upgrade" else "0" }}'

View File

@ -1,5 +1,13 @@
#!/bin/bash #!/bin/bash
# Create log directory, with appropriate permissions
if [[ ! -d "/var/log/kolla/etcd" ]]; then
mkdir -p /var/log/kolla/etcd
fi
if [[ $(stat -c %a /var/log/kolla/etcd) != "755" ]]; then
chmod 755 /var/log/kolla/etcd
fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty. # of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then

View File

@ -138,3 +138,8 @@ keepalived_password:
# Kibana options # Kibana options
#################### ####################
kibana_password: kibana_password:
####################
# etcd options
####################
etcd_cluster_token:

View File

@ -0,0 +1,3 @@
---
features:
- Add etcd ansible role