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