Merge "Remove empty metadata_settings from iscsid and multipathd templates"
[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   DockerIronicApiImage:
8     description: image
9     type: string
10   DockerIronicApiConfigImage:
11     description: The container image to use for the ironic_api 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   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40 resources:
41
42   ContainersCommon:
43     type: ./containers-common.yaml
44
45   MySQLClient:
46     type: ../../puppet/services/database/mysql-client.yaml
47
48   IronicApiBase:
49     type: ../../puppet/services/ironic-api.yaml
50     properties:
51       EndpointMap: {get_param: EndpointMap}
52       ServiceData: {get_param: ServiceData}
53       ServiceNetMap: {get_param: ServiceNetMap}
54       DefaultPasswords: {get_param: DefaultPasswords}
55       RoleName: {get_param: RoleName}
56       RoleParameters: {get_param: RoleParameters}
57
58 outputs:
59   role_data:
60     description: Role data for the Ironic API role.
61     value:
62       service_name: {get_attr: [IronicApiBase, role_data, service_name]}
63       config_settings:
64         map_merge:
65           - get_attr: [IronicApiBase, role_data, config_settings]
66           - apache::default_vhost: false
67       step_config: &step_config
68         list_join:
69           - "\n"
70           - - {get_attr: [IronicApiBase, role_data, step_config]}
71             - {get_attr: [MySQLClient, role_data, step_config]}
72       service_config_settings: {get_attr: [IronicApiBase, role_data, service_config_settings]}
73       # BEGIN DOCKER SETTINGS
74       puppet_config:
75         config_volume: ironic_api
76         puppet_tags: ironic_config
77         step_config: *step_config
78         config_image: {get_param: DockerIronicApiConfigImage}
79       kolla_config:
80         /var/lib/kolla/config_files/ironic_api.json:
81           command: /usr/sbin/httpd -DFOREGROUND
82           config_files:
83             - source: "/var/lib/kolla/config_files/src/*"
84               dest: "/"
85               merge: true
86               preserve_properties: true
87           permissions:
88             - path: /var/log/ironic
89               owner: ironic:ironic
90               recurse: true
91       docker_config:
92         # db sync runs before permissions set by kolla_config
93         step_2:
94           ironic_init_logs:
95             image: &ironic_api_image {get_param: DockerIronicApiImage}
96             privileged: false
97             user: root
98             volumes:
99               - /var/log/containers/ironic:/var/log/ironic
100             command: ['/bin/bash', '-c', 'chown -R ironic:ironic /var/log/ironic']
101         step_3:
102           ironic_db_sync:
103             start_order: 1
104             image: *ironic_api_image
105             net: host
106             privileged: false
107             detach: false
108             user: root
109             volumes:
110               list_concat:
111                 - {get_attr: [ContainersCommon, volumes]}
112                 -
113                   - /var/lib/config-data/ironic_api/etc/ironic:/etc/ironic:ro
114                   - /var/log/containers/ironic:/var/log/ironic
115             command: "/usr/bin/bootstrap_host_exec ironic_api su ironic -s /bin/bash -c 'ironic-dbsync --config-file /etc/ironic/ironic.conf'"
116         step_4:
117           ironic_api:
118             start_order: 10
119             image: *ironic_api_image
120             net: host
121             user: root
122             restart: always
123             volumes:
124               list_concat:
125                 - {get_attr: [ContainersCommon, volumes]}
126                 -
127                   - /var/lib/kolla/config_files/ironic_api.json:/var/lib/kolla/config_files/config.json:ro
128                   - /var/lib/config-data/puppet-generated/ironic_api/:/var/lib/kolla/config_files/src:ro
129                   - /var/log/containers/ironic:/var/log/ironic
130             environment:
131               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
132       host_prep_tasks:
133         - name: create persistent logs directory
134           file:
135             path: /var/log/containers/ironic
136             state: directory
137       upgrade_tasks:
138         - name: Stop and disable ironic_api service
139           tags: step2
140           service: name=openstack-ironic-api state=stopped enabled=no