Merge "Enable mistral to run under mod_wsgi"
[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   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
42 resources:
43
44   ContainersCommon:
45     type: ./containers-common.yaml
46
47   IronicApiBase:
48     type: ../../puppet/services/ironic-api.yaml
49     properties:
50       EndpointMap: {get_param: EndpointMap}
51       ServiceNetMap: {get_param: ServiceNetMap}
52       DefaultPasswords: {get_param: DefaultPasswords}
53       RoleName: {get_param: RoleName}
54       RoleParameters: {get_param: RoleParameters}
55
56 outputs:
57   role_data:
58     description: Role data for the Ironic API role.
59     value:
60       service_name: {get_attr: [IronicApiBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [IronicApiBase, role_data, config_settings]
64       step_config: &step_config
65         get_attr: [IronicApiBase, role_data, step_config]
66       service_config_settings: {get_attr: [IronicApiBase, role_data, service_config_settings]}
67       # BEGIN DOCKER SETTINGS
68       puppet_config:
69         config_volume: ironic
70         puppet_tags: ironic_config
71         step_config: *step_config
72         config_image:
73           list_join:
74             - '/'
75             - [ {get_param: DockerNamespace}, {get_param: DockerIronicConfigImage} ]
76       kolla_config:
77         /var/lib/kolla/config_files/ironic_api.json:
78           command: /usr/bin/ironic-api
79           permissions:
80             - path: /var/log/ironic
81               owner: ironic:ironic
82               recurse: true
83       docker_config:
84         # db sync runs before permissions set by kolla_config
85         step_3:
86           ironic_init_logs:
87             start_order: 0
88             image: &ironic_image
89               list_join:
90                 - '/'
91                 - [ {get_param: DockerNamespace}, {get_param: DockerIronicApiImage} ]
92             privileged: false
93             user: root
94             volumes:
95               - /var/log/containers/ironic:/var/log/ironic
96             command: ['/bin/bash', '-c', 'chown -R ironic:ironic /var/log/ironic']
97           ironic_db_sync:
98             start_order: 1
99             image: *ironic_image
100             net: host
101             privileged: false
102             detach: false
103             volumes:
104               list_concat:
105                 - {get_attr: [ContainersCommon, volumes]}
106                 -
107                   - /var/lib/config-data/ironic/etc/:/etc/:ro
108                   - /var/log/containers/ironic:/var/log/ironic
109             command: ['ironic-dbsync', '--config-file', '/etc/ironic/ironic.conf']
110         step_4:
111           ironic_api:
112             start_order: 10
113             image: *ironic_image
114             net: host
115             privileged: false
116             restart: always
117             volumes:
118               list_concat:
119                 - {get_attr: [ContainersCommon, volumes]}
120                 -
121                   - /var/lib/kolla/config_files/ironic_api.json:/var/lib/kolla/config_files/config.json:ro
122                   - /var/lib/config-data/ironic/etc/:/etc/:ro
123                   - /var/log/containers/ironic:/var/log/ironic
124             environment:
125               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
126       host_prep_tasks:
127         - name: create persistent logs directory
128           file:
129             path: /var/log/containers/ironic
130             state: directory
131       upgrade_tasks:
132         - name: Stop and disable ironic_api service
133           tags: step2
134           service: name=openstack-ironic-api state=stopped enabled=no