Merge "Containers: Bind mount directories with the key/certs for heat"
[apex-tripleo-heat-templates.git] / docker / services / ironic-api.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Ironic API service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerIronicApiImage:
12     description: image
13     default: 'centos-binary-ironic-api:latest'
14     type: string
15   DockerIronicConfigImage:
16     description: image
17     default: 'centos-binary-ironic-pxe: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
34 resources:
35
36   ContainersCommon:
37     type: ./containers-common.yaml
38
39   IronicApiBase:
40     type: ../../puppet/services/ironic-api.yaml
41     properties:
42       EndpointMap: {get_param: EndpointMap}
43       ServiceNetMap: {get_param: ServiceNetMap}
44       DefaultPasswords: {get_param: DefaultPasswords}
45
46 outputs:
47   role_data:
48     description: Role data for the Ironic API role.
49     value:
50       service_name: {get_attr: [IronicApiBase, role_data, service_name]}
51       config_settings:
52         map_merge:
53           - get_attr: [IronicApiBase, role_data, config_settings]
54       step_config: &step_config
55         get_attr: [IronicApiBase, role_data, step_config]
56       service_config_settings: {get_attr: [IronicApiBase, role_data, service_config_settings]}
57       # BEGIN DOCKER SETTINGS
58       puppet_config:
59         config_volume: ironic
60         puppet_tags: ironic_config
61         step_config: *step_config
62         config_image:
63           list_join:
64             - '/'
65             - [ {get_param: DockerNamespace}, {get_param: DockerIronicConfigImage} ]
66       kolla_config:
67         /var/lib/kolla/config_files/ironic_api.json:
68           command: /usr/bin/ironic-api
69           permissions:
70             - path: /var/log/ironic
71               owner: ironic:ironic
72               recurse: true
73       docker_config:
74         # db sync runs before permissions set by kolla_config
75         step_3:
76           ironic_init_logs:
77             start_order: 0
78             image: &ironic_image
79               list_join:
80                 - '/'
81                 - [ {get_param: DockerNamespace}, {get_param: DockerIronicApiImage} ]
82             privileged: false
83             user: root
84             volumes:
85               - /var/log/containers/ironic:/var/log/ironic
86             command: ['/bin/bash', '-c', 'chown -R ironic:ironic /var/log/ironic']
87           ironic_db_sync:
88             start_order: 1
89             image: *ironic_image
90             net: host
91             privileged: false
92             detach: false
93             volumes:
94               list_concat:
95                 - {get_attr: [ContainersCommon, volumes]}
96                 -
97                   - /var/lib/config-data/ironic/etc/:/etc/:ro
98                   - /var/log/containers/ironic:/var/log/ironic
99             command: ['ironic-dbsync', '--config-file', '/etc/ironic/ironic.conf']
100         step_4:
101           ironic_api:
102             start_order: 10
103             image: *ironic_image
104             net: host
105             privileged: false
106             restart: always
107             volumes:
108               list_concat:
109                 - {get_attr: [ContainersCommon, volumes]}
110                 -
111                   - /var/lib/kolla/config_files/ironic_api.json:/var/lib/kolla/config_files/config.json:ro
112                   - /var/lib/config-data/ironic/etc/:/etc/:ro
113                   - /var/log/containers/ironic:/var/log/ironic
114             environment:
115               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
116       host_prep_tasks:
117         - name: create persistent logs directory
118           file:
119             path: /var/log/containers/ironic
120             state: directory
121       upgrade_tasks:
122         - name: Stop and disable ironic_api service
123           tags: step2
124           service: name=openstack-ironic-api state=stopped enabled=no