13a0735b3f2af0b9f9ddd1404543823a1af0f1e8
[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   RoleName:
30     default: ''
31     description: Role name on which the service is applied
32     type: string
33   RoleParameters:
34     default: {}
35     description: Parameters specific to the role
36     type: json
37   EtcdInitialClusterToken:
38     description: Initial cluster token for the etcd cluster during bootstrap.
39     type: string
40     hidden: true
41
42 resources:
43
44   EtcdPuppetBase:
45     type: ../../puppet/services/etcd.yaml
46     properties:
47       EndpointMap: {get_param: EndpointMap}
48       ServiceNetMap: {get_param: ServiceNetMap}
49       DefaultPasswords: {get_param: DefaultPasswords}
50       EtcdInitialClusterToken: {get_param: EtcdInitialClusterToken}
51
52 outputs:
53   role_data:
54     description: Role data for the etcd role.
55     value:
56       service_name: {get_attr: [EtcdPuppetBase, role_data, service_name]}
57       step_config: &step_config
58         list_join:
59           - "\n"
60           - - "['Etcd_key'].each |String $val| { noop_resource($val) }"
61             - get_attr: [EtcdPuppetBase, role_data, step_config]
62       config_settings:
63         map_merge:
64           - {get_attr: [EtcdPuppetBase, role_data, config_settings]}
65           - etcd::manage_service: false
66       # BEGIN DOCKER SETTINGS
67       puppet_config:
68         config_volume: etcd
69         step_config: *step_config
70         config_image: &etcd_image
71           list_join:
72             - '/'
73             - [ {get_param: DockerNamespace}, {get_param: DockerEtcdImage} ]
74       kolla_config:
75         /var/lib/kolla/config_files/etcd.json:
76           command: /usr/bin/etcd --config-file /etc/etcd/etcd.yml
77           permissions:
78             - path: /var/lib/etcd
79               owner: etcd:etcd
80               recurse: true
81       docker_config:
82         step_2:
83           etcd:
84             image: *etcd_image
85             net: host
86             privileged: false
87             restart: always
88             volumes:
89               - /var/lib/etcd:/var/lib/etcd
90               - /etc/localtime:/etc/localtime:ro
91               - /var/lib/kolla/config_files/etcd.json:/var/lib/kolla/config_files/config.json:ro
92               - /var/lib/config-data/etcd/etc/etcd/etcd.yml:/etc/etcd/etcd.yml:ro
93             environment:
94               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
95       docker_puppet_tasks:
96         # Etcd keys initialization occurs only on single node
97         step_2:
98           config_volume: 'etcd_init_tasks'
99           puppet_tags: 'etcd_key'
100           step_config: 'include ::tripleo::profile::base::etcd'
101           config_image: *etcd_image
102           volumes:
103             - /var/lib/config-data/etcd/etc/:/etc
104             - /var/lib/etcd:/var/lib/etcd:ro
105       host_prep_tasks:
106         - name: create /var/lib/etcd
107           file:
108             path: /var/lib/etcd
109             state: directory
110       upgrade_tasks:
111         - name: Stop and disable etcd service
112           tags: step2
113           service: name=etcd state=stopped enabled=no