0a7daef81088191fbeff070fd690662aa0d48ff6
[apex-tripleo-heat-templates.git] / docker / services / etcd.yaml
1 heat_template_version: ocata
2
3 description: >
4   OpenStack containerized etcd services
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerEtcdImage:
12     description: image
13     default: 'centos-binary-etcd:latest'
14     type: string
15   EndpointMap:
16     default: {}
17     description: Mapping of service endpoint -> protocol. Typically set
18                  via parameter_defaults in the resource registry.
19     type: json
20   ServiceNetMap:
21     default: {}
22     description: Mapping of service_name -> network name. Typically set
23                  via parameter_defaults in the resource registry.  This
24                  mapping overrides those in ServiceNetMapDefaults.
25     type: json
26   DefaultPasswords:
27     default: {}
28     type: json
29   EtcdInitialClusterToken:
30     description: Initial cluster token for the etcd cluster during bootstrap.
31     type: string
32     hidden: true
33
34 resources:
35
36   EtcdPuppetBase:
37     type: ../../puppet/services/etcd.yaml
38     properties:
39       EndpointMap: {get_param: EndpointMap}
40       ServiceNetMap: {get_param: ServiceNetMap}
41       DefaultPasswords: {get_param: DefaultPasswords}
42       EtcdInitialClusterToken: {get_param: EtcdInitialClusterToken}
43
44 outputs:
45   role_data:
46     description: Role data for the etcd role.
47     value:
48       service_name: {get_attr: [EtcdPuppetBase, role_data, service_name]}
49       step_config: &step_config
50         list_join:
51           - "\n"
52           - - "['Etcd_key'].each |String $val| { noop_resource($val) }"
53             - get_attr: [EtcdPuppetBase, role_data, step_config]
54       config_settings:
55         map_merge:
56           - {get_attr: [EtcdPuppetBase, role_data, config_settings]}
57           - etcd::manage_service: false
58       # BEGIN DOCKER SETTINGS
59       puppet_config:
60         config_volume: etcd
61         step_config: *step_config
62         config_image: &etcd_image
63           list_join:
64             - '/'
65             - [ {get_param: DockerNamespace}, {get_param: DockerEtcdImage} ]
66       kolla_config:
67         /var/lib/kolla/config_files/etcd.json:
68           command: /usr/bin/etcd --config-file /etc/etcd/etcd.yml
69           permissions:
70             - path: /var/lib/etcd
71               owner: etcd:etcd
72               recurse: true
73       docker_config:
74         step_2:
75           etcd:
76             image: *etcd_image
77             net: host
78             privileged: false
79             restart: always
80             volumes:
81               - /var/lib/etcd:/var/lib/etcd
82               - /etc/localtime:/etc/localtime:ro
83               - /var/lib/kolla/config_files/etcd.json:/var/lib/kolla/config_files/config.json:ro
84               - /var/lib/config-data/etcd/etc/etcd/etcd.yml:/etc/etcd/etcd.yml:ro
85             environment:
86               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
87       docker_puppet_tasks:
88         # Etcd keys initialization occurs only on single node
89         step_2:
90           config_volume: 'etcd_init_tasks'
91           puppet_tags: 'etcd_key'
92           step_config: 'include ::tripleo::profile::base::etcd'
93           config_image: *etcd_image
94           volumes:
95             - /var/lib/config-data/etcd/etc/:/etc
96             - /var/lib/etcd:/var/lib/etcd:ro
97       host_prep_tasks:
98         - name: create /var/lib/etcd
99           file:
100             path: /var/lib/etcd
101             state: directory
102       upgrade_tasks:
103         - name: Stop and disable etcd service
104           tags: step2
105           service: name=etcd state=stopped enabled=no