Merge "Remove package if service stopped and disabled" into stable/pike
[apex-tripleo-heat-templates.git] / docker / services / nova-conductor.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Nova Conductor service
5
6 parameters:
7   DockerNovaConductorImage:
8     description: image
9     type: string
10   DockerNovaConfigImage:
11     description: The container image to use for the nova 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   UpgradeLevelNovaCompute:
40     type: string
41     description: Nova Compute upgrade level
42     default: ''
43   UpgradeRemoveUnusedPackages:
44     default: false
45     description: Remove package if the service is being disabled during upgrade
46     type: boolean
47
48
49 resources:
50
51   ContainersCommon:
52     type: ./containers-common.yaml
53
54   MySQLClient:
55     type: ../../puppet/services/database/mysql-client.yaml
56
57   NovaConductorBase:
58     type: ../../puppet/services/nova-conductor.yaml
59     properties:
60       EndpointMap: {get_param: EndpointMap}
61       ServiceData: {get_param: ServiceData}
62       ServiceNetMap: {get_param: ServiceNetMap}
63       DefaultPasswords: {get_param: DefaultPasswords}
64       RoleName: {get_param: RoleName}
65       RoleParameters: {get_param: RoleParameters}
66
67 outputs:
68   role_data:
69     description: Role data for the Nova Conductor service.
70     value:
71       service_name: {get_attr: [NovaConductorBase, role_data, service_name]}
72       config_settings: {get_attr: [NovaConductorBase, role_data, config_settings]}
73       logging_source: {get_attr: [NovaConductorBase, role_data, logging_source]}
74       logging_groups: {get_attr: [NovaConductorBase, role_data, logging_groups]}
75       step_config: &step_config
76         list_join:
77           - "\n"
78           - - {get_attr: [NovaConductorBase, role_data, step_config]}
79             - {get_attr: [MySQLClient, role_data, step_config]}
80       service_config_settings: {get_attr: [NovaConductorBase, role_data, service_config_settings]}
81       # BEGIN DOCKER SETTINGS
82       puppet_config:
83         config_volume: nova
84         puppet_tags: nova_config
85         step_config: *step_config
86         config_image: {get_param: DockerNovaConfigImage}
87       kolla_config:
88         /var/lib/kolla/config_files/nova_conductor.json:
89           command: /usr/bin/nova-conductor
90           config_files:
91             - source: "/var/lib/kolla/config_files/src/*"
92               dest: "/"
93               merge: true
94               preserve_properties: true
95           permissions:
96             - path: /var/log/nova
97               owner: nova:nova
98               recurse: true
99       docker_config:
100         step_4:
101           nova_conductor:
102             image: {get_param: DockerNovaConductorImage}
103             net: host
104             privileged: false
105             restart: always
106             volumes:
107               list_concat:
108                 - {get_attr: [ContainersCommon, volumes]}
109                 -
110                   - /var/lib/kolla/config_files/nova_conductor.json:/var/lib/kolla/config_files/config.json:ro
111                   - /var/lib/config-data/puppet-generated/nova/:/var/lib/kolla/config_files/src:ro
112                   - /var/log/containers/nova:/var/log/nova
113             environment:
114               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
115       host_prep_tasks:
116         - name: create persistent logs directory
117           file:
118             path: /var/log/containers/nova
119             state: directory
120       upgrade_tasks:
121         - name: Set compute upgrade level to auto
122           tags: step1
123           ini_file:
124             str_replace:
125               template: "dest=/etc/nova/nova.conf section=upgrade_levels option=compute value=LEVEL"
126               params:
127                 LEVEL: {get_param: UpgradeLevelNovaCompute}
128         - name: Stop and disable nova_conductor service
129           tags: step2
130           service: name=openstack-nova-conductor state=stopped enabled=no
131         - name: Remove openstack-nova-conductor package if operator requests it
132           yum: name=openstack-nova-conductor state=removed
133           tags: step2
134           ignore_errors: True
135           when: {get_param: UpgradeRemoveUnusedPackages}