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