Merge "Fix wrong permission on database during mysql_init tasks." into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / mistral-executor.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Mistral Executor service
5
6 parameters:
7   DockerMistralExecutorImage:
8     description: image
9     type: string
10   DockerMistralConfigImage:
11     description: The container image to use for the mistral 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
41 resources:
42
43   ContainersCommon:
44     type: ./containers-common.yaml
45
46   MySQLClient:
47     type: ../../puppet/services/database/mysql-client.yaml
48
49   MistralBase:
50     type: ../../puppet/services/mistral-executor.yaml
51     properties:
52       EndpointMap: {get_param: EndpointMap}
53       ServiceData: {get_param: ServiceData}
54       ServiceNetMap: {get_param: ServiceNetMap}
55       DefaultPasswords: {get_param: DefaultPasswords}
56       RoleName: {get_param: RoleName}
57       RoleParameters: {get_param: RoleParameters}
58
59 outputs:
60   role_data:
61     description: Role data for the Mistral Executor role.
62     value:
63       service_name: {get_attr: [MistralBase, role_data, service_name]}
64       config_settings:
65         map_merge:
66           - get_attr: [MistralBase, role_data, config_settings]
67       logging_source: {get_attr: [MistralBase, role_data, logging_source]}
68       logging_groups: {get_attr: [MistralBase, role_data, logging_groups]}
69       step_config: &step_config
70         list_join:
71           - "\n"
72           - - {get_attr: [MistralBase, role_data, step_config]}
73             - {get_attr: [MySQLClient, role_data, step_config]}
74       service_config_settings: {get_attr: [MistralBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS
76       puppet_config:
77         config_volume: mistral
78         puppet_tags: mistral_config
79         step_config: *step_config
80         config_image: {get_param: DockerMistralConfigImage}
81       kolla_config:
82         /var/lib/kolla/config_files/mistral_executor.json:
83           command: /usr/bin/mistral-server --config-file=/etc/mistral/mistral.conf --log-file=/var/log/mistral/executor.log --server=executor
84           config_files:
85             - source: "/var/lib/kolla/config_files/src/*"
86               dest: "/"
87               merge: true
88               preserve_properties: true
89           permissions:
90             - path: /var/log/mistral
91               owner: mistral:mistral
92               recurse: true
93       docker_config:
94         step_4:
95           mistral_executor:
96             image: {get_param: DockerMistralExecutorImage}
97             net: host
98             privileged: false
99             restart: always
100             volumes:
101               list_concat:
102                 - {get_attr: [ContainersCommon, volumes]}
103                 -
104                   - /var/lib/kolla/config_files/mistral_executor.json:/var/lib/kolla/config_files/config.json:ro
105                   - /var/lib/config-data/puppet-generated/mistral/:/var/lib/kolla/config_files/src:ro
106                   - /run:/run
107                   # FIXME: this is required in order for Nova cells
108                   # initialization workflows on the Undercloud. Need to
109                   # exclude this on the overcloud for security reasons.
110                   - /var/lib/config-data/nova/etc/nova:/etc/nova:ro
111                   - /var/log/containers/mistral:/var/log/mistral
112             environment:
113               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
114       host_prep_tasks:
115         - name: create persistent logs directory
116           file:
117             path: /var/log/containers/mistral
118             state: directory
119       upgrade_tasks:
120         - name: Check if mistral executor is deployed
121           command: systemctl is-enabled openstack-mistral-executor
122           tags: common
123           ignore_errors: True
124           register: mistral_executor_enabled
125         - name: "PreUpgrade step0,validation: Check if openstack-mistral-executor is running"
126           shell: >
127             /usr/bin/systemctl show 'openstack-mistral-executor' --property ActiveState |
128             grep '\bactive\b'
129           when: mistral_executor_enabled.rc == 0
130           tags: step0,validation
131         - name: Stop and disable mistral_executor service
132           tags: step2
133           when: mistral_executor_enabled.rc == 0
134           service: name=openstack-mistral-executor state=stopped enabled=no