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