Add etcd ansible role
Change-Id: If8351ab3000006323a05924e907f1e3745768304 Co-Authored-By: zhubingbing <zhubingbing10@gmail.com>> Partially-implements: bp kuryr-docker-plugin
This commit is contained in:
parent
239cea0c48
commit
a5b53f3a70
@ -195,6 +195,9 @@ influxdb_http_port: "8086"
|
||||
|
||||
senlin_api_port: "8778"
|
||||
|
||||
etcd_client_port: "2379"
|
||||
etcd_peer_port: "2380"
|
||||
|
||||
public_protocol: "{{ 'https' if kolla_enable_tls_external | bool else 'http' }}"
|
||||
internal_protocol: "http"
|
||||
admin_protocol: "http"
|
||||
@ -245,6 +248,7 @@ enable_cinder: "no"
|
||||
enable_cinder_backend_lvm: "no"
|
||||
enable_cloudkitty: "no"
|
||||
enable_congress: "no"
|
||||
enable_etcd: "no"
|
||||
enable_gnocchi: "no"
|
||||
enable_grafana: "no"
|
||||
enable_heat: "yes"
|
||||
|
@ -23,6 +23,9 @@ compute
|
||||
[grafana:children]
|
||||
monitoring
|
||||
|
||||
[etcd:children]
|
||||
control
|
||||
|
||||
[kibana:children]
|
||||
control
|
||||
|
||||
|
@ -41,6 +41,9 @@ compute
|
||||
[grafana:children]
|
||||
monitoring
|
||||
|
||||
[etcd:children]
|
||||
control
|
||||
|
||||
[influxdb:children]
|
||||
monitoring
|
||||
|
||||
|
10
ansible/roles/etcd/defaults/main.yml
Normal file
10
ansible/roles/etcd/defaults/main.yml
Normal 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 }}"
|
3
ansible/roles/etcd/meta/main.yml
Normal file
3
ansible/roles/etcd/meta/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
dependencies:
|
||||
- { role: common }
|
18
ansible/roles/etcd/tasks/bootstrap.yml
Normal file
18
ansible/roles/etcd/tasks/bootstrap.yml
Normal 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/"
|
15
ansible/roles/etcd/tasks/config.yml
Normal file
15
ansible/roles/etcd/tasks/config.yml
Normal 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"
|
6
ansible/roles/etcd/tasks/deploy.yml
Normal file
6
ansible/roles/etcd/tasks/deploy.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- include: config.yml
|
||||
|
||||
- include: bootstrap.yml
|
||||
|
||||
- include: start.yml
|
2
ansible/roles/etcd/tasks/main.yml
Normal file
2
ansible/roles/etcd/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
- include: "{{ action }}.yml"
|
6
ansible/roles/etcd/tasks/pull.yml
Normal file
6
ansible/roles/etcd/tasks/pull.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Pulling etcd image
|
||||
kolla_docker:
|
||||
action: "pull_image"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ etcd_image_full }}"
|
1
ansible/roles/etcd/tasks/reconfigure.yml
Normal file
1
ansible/roles/etcd/tasks/reconfigure.yml
Normal file
@ -0,0 +1 @@
|
||||
---
|
24
ansible/roles/etcd/tasks/start.yml
Normal file
24
ansible/roles/etcd/tasks/start.yml
Normal 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/"
|
4
ansible/roles/etcd/tasks/upgrade.yml
Normal file
4
ansible/roles/etcd/tasks/upgrade.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- include: config.yml
|
||||
|
||||
- include: start.yml
|
3
ansible/roles/etcd/templates/etcd.json.j2
Normal file
3
ansible/roles/etcd/templates/etcd.json.j2
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"command": "etcd"
|
||||
}
|
@ -94,6 +94,13 @@
|
||||
tags: rabbitmq,
|
||||
when: enable_rabbitmq | bool }
|
||||
|
||||
- hosts: etcd
|
||||
serial: '{{ "30%" if action == "upgrade" else "0" }}'
|
||||
roles:
|
||||
- { role: etcd,
|
||||
tags: etcd,
|
||||
when: enable_etcd | bool }
|
||||
|
||||
- hosts:
|
||||
- keystone
|
||||
serial: '{{ "30%" if action == "upgrade" else "0" }}'
|
||||
|
@ -1,5 +1,13 @@
|
||||
#!/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
|
||||
# of the KOLLA_BOOTSTRAP variable being set, including empty.
|
||||
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
|
||||
|
@ -138,3 +138,8 @@ keepalived_password:
|
||||
# Kibana options
|
||||
####################
|
||||
kibana_password:
|
||||
|
||||
####################
|
||||
# etcd options
|
||||
####################
|
||||
etcd_cluster_token:
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Add etcd ansible role
|
Loading…
Reference in New Issue
Block a user