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