eb661af848cd0d49ff94757cef70dd559ca0f4b9
[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           config_files:
82             - source: "/var/lib/kolla/config_files/src/*"
83               dest: "/"
84               merge: true
85               preserve_properties: true
86           permissions:
87             - path: /var/lib/etcd
88               owner: etcd:etcd
89               recurse: true
90       docker_config:
91         step_2:
92           etcd:
93             image:
94               list_join:
95                 - '/'
96                 - [ {get_param: DockerNamespace}, {get_param: DockerEtcdImage} ]
97             net: host
98             privileged: false
99             restart: always
100             volumes:
101               - /var/lib/etcd:/var/lib/etcd
102               - /etc/localtime:/etc/localtime:ro
103               - /var/lib/kolla/config_files/etcd.json:/var/lib/kolla/config_files/config.json:ro
104               - /var/lib/config-data/puppet-generated/etcd/:/var/lib/kolla/config_files/src:ro
105             environment:
106               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
107       docker_puppet_tasks:
108         # Etcd keys initialization occurs only on single node
109         step_2:
110           config_volume: 'etcd_init_tasks'
111           puppet_tags: 'etcd_key'
112           step_config: 'include ::tripleo::profile::base::etcd'
113           config_image: *etcd_config_image
114           volumes:
115             - /var/lib/config-data/etcd/etc/etcd/:/etc/etcd:ro
116             - /var/lib/etcd:/var/lib/etcd:ro
117       host_prep_tasks:
118         - name: create /var/lib/etcd
119           file:
120             path: /var/lib/etcd
121             state: directory
122       upgrade_tasks:
123         - name: Stop and disable etcd service
124           tags: step2
125           service: name=etcd state=stopped enabled=no