Use a single configuration file for specifying docker containers.
[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   DockerEtcdImage:
8     description: image
9     type: string
10   DockerEtcdConfigImage:
11     description: The container image to use for the etcd config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceNetMap:
19     default: {}
20     description: Mapping of service_name -> network name. Typically set
21                  via parameter_defaults in the resource registry.  This
22                  mapping overrides those in ServiceNetMapDefaults.
23     type: json
24   DefaultPasswords:
25     default: {}
26     type: json
27   RoleName:
28     default: ''
29     description: Role name on which the service is applied
30     type: string
31   RoleParameters:
32     default: {}
33     description: Parameters specific to the role
34     type: json
35   EtcdInitialClusterToken:
36     description: Initial cluster token for the etcd cluster during bootstrap.
37     type: string
38     hidden: true
39
40 resources:
41
42   EtcdPuppetBase:
43     type: ../../puppet/services/etcd.yaml
44     properties:
45       EndpointMap: {get_param: EndpointMap}
46       ServiceNetMap: {get_param: ServiceNetMap}
47       DefaultPasswords: {get_param: DefaultPasswords}
48       EtcdInitialClusterToken: {get_param: EtcdInitialClusterToken}
49
50 outputs:
51   role_data:
52     description: Role data for the etcd role.
53     value:
54       service_name: {get_attr: [EtcdPuppetBase, role_data, service_name]}
55       step_config: &step_config
56         list_join:
57           - "\n"
58           - - "['Etcd_key'].each |String $val| { noop_resource($val) }"
59             - get_attr: [EtcdPuppetBase, role_data, step_config]
60       config_settings:
61         map_merge:
62           - {get_attr: [EtcdPuppetBase, role_data, config_settings]}
63           - etcd::manage_service: false
64       # BEGIN DOCKER SETTINGS
65       puppet_config:
66         config_volume: etcd
67         step_config: *step_config
68         config_image: &etcd_config_image {get_param: DockerEtcdConfigImage}
69       kolla_config:
70         /var/lib/kolla/config_files/etcd.json:
71           command: /usr/bin/etcd --config-file /etc/etcd/etcd.yml
72           config_files:
73             - source: "/var/lib/kolla/config_files/src/*"
74               dest: "/"
75               merge: true
76               preserve_properties: true
77           permissions:
78             - path: /var/lib/etcd
79               owner: etcd:etcd
80               recurse: true
81       docker_config:
82         step_2:
83           etcd:
84             image: {get_param: DockerEtcdImage}
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/puppet-generated/etcd/:/var/lib/kolla/config_files/src: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_config_image
102           volumes:
103             - /var/lib/config-data/etcd/etc/etcd/:/etc/etcd:ro
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