Merge "Add stack_name/ctlplane_service_ips into post-upgrade.j2.yaml"
[apex-tripleo-heat-templates.git] / docker / services / ironic-conductor.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Ironic Conductor service
5
6 parameters:
7   DockerNamespace:
8     description: namespace
9     default: 'tripleoupstream'
10     type: string
11   DockerIronicConductorImage:
12     description: image
13     default: 'centos-binary-ironic-conductor:latest'
14     type: string
15   DockerIronicConfigImage:
16     description: The container image to use for the ironic config_volume
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   IronicConductorBase:
48     type: ../../puppet/services/ironic-conductor.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 Conductor role.
59     value:
60       service_name: {get_attr: [IronicConductorBase, role_data, service_name]}
61       config_settings:
62         map_merge:
63           - get_attr: [IronicConductorBase, role_data, config_settings]
64           # to avoid hard linking errors we store these on the same
65           # volume/device as the ironic master_path
66           # https://github.com/docker/docker/issues/7457
67           - ironic::drivers::pxe::tftp_root: /var/lib/ironic/tftpboot
68           - ironic::drivers::pxe::tftp_master_path: /var/lib/ironic/tftpboot/master_images
69           - ironic::pxe::tftp_root: /var/lib/ironic/tftpboot
70           - ironic::pxe::http_root: /var/lib/ironic/httpboot
71           - ironic::conductor::http_root: /var/lib/ironic/httpboot
72       step_config: &step_config
73         get_attr: [IronicConductorBase, role_data, step_config]
74       service_config_settings: {get_attr: [IronicConductorBase, role_data, service_config_settings]}
75       # BEGIN DOCKER SETTINGS
76       puppet_config:
77         config_volume: ironic
78         puppet_tags: ironic_config
79         step_config: *step_config
80         config_image:
81           list_join:
82             - '/'
83             - [ {get_param: DockerNamespace}, {get_param: DockerIronicConfigImage} ]
84       kolla_config:
85         /var/lib/kolla/config_files/ironic_conductor.json:
86           command: /usr/bin/ironic-conductor
87           permissions:
88             - path: /var/lib/ironic
89               owner: ironic:ironic
90               recurse: true
91             - path: /var/log/ironic
92               owner: ironic:ironic
93               recurse: true
94       docker_config:
95         step_4:
96           ironic_conductor:
97             start_order: 80
98             image:
99               list_join:
100                 - '/'
101                 - [ {get_param: DockerNamespace}, {get_param: DockerIronicConductorImage} ]
102             net: host
103             privileged: true
104             restart: always
105             volumes:
106               list_concat:
107                 - {get_attr: [ContainersCommon, volumes]}
108                 -
109                   - /var/lib/kolla/config_files/ironic_conductor.json:/var/lib/kolla/config_files/config.json:ro
110                   - /var/lib/config-data/ironic/etc/ironic/:/etc/ironic/:ro
111                   - /lib/modules:/lib/modules:ro
112                   - /sys:/sys
113                   - /dev:/dev
114                   - /run:/run #shared?
115                   - /var/lib/ironic:/var/lib/ironic
116                   - /var/log/containers/ironic:/var/log/ironic
117             environment:
118               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
119       host_prep_tasks:
120         - name: create persistent directories
121           file:
122             path: "{{ item }}"
123             state: directory
124           with_items:
125             - /var/log/containers/ironic
126             - /var/lib/ironic
127         - name: stat /httpboot
128           stat: path=/httpboot
129           register: stat_httpboot
130         - name: stat /tftpboot
131           stat: path=/tftpboot
132           register: stat_tftpboot
133         - name: stat /var/lib/ironic/httpboot
134           stat: path=/var/lib/ironic/httpboot
135           register: stat_ironic_httpboot
136         - name: stat /var/lib/ironic/tftpboot
137           stat: path=/var/lib/ironic/tftpboot
138           register: stat_ironic_tftpboot
139         # cannot use 'copy' module as with 'remote_src' it doesn't support recursion
140         - name: migrate /httpboot to containerized (if applicable)
141           command: /bin/cp -R /httpboot /var/lib/ironic/httpboot
142           when: stat_httpboot.stat.exists and not stat_ironic_httpboot.stat.exists
143         - name: migrate /tftpboot to containerized (if applicable)
144           command: /bin/cp -R /tftpboot /var/lib/ironic/tftpboot
145           when: stat_tftpboot.stat.exists and not stat_ironic_tftpboot.stat.exists
146         # Even if there was nothing to copy from original locations,
147         # we need to create the dirs before starting the containers
148         - name: ensure ironic pxe directories exist
149           file:
150             path: /var/lib/ironic/{{ item }}
151             state: directory
152           with_items:
153             - httpboot
154             - tftpboot
155       upgrade_tasks:
156         - name: Stop and disable ironic_conductor service
157           tags: step2
158           service: name=openstack-ironic-conductor state=stopped enabled=no