openstack-ansible-os_ironic/tasks/ironic_inspector_post_install.yml
Jonathan Rosser b974a6c0e0 Refactor ironic deploy image handling.
The deploy image is required in two places in an ironic deployment,
first as images uploaded to glance for the ironic service, and second
as files on a web server for the ironic-inspector service.

Previously this role only placed the deploy images on the ironic
inspector web server, but this patch provides the functionality to
also upload the images to glance.

The variables for ironic deploy image source locations are
consolidated so that only one set are required to run the tasks
for both ironic and ironic-inspector, and several overrides are
available allowing the source to be overidden to a local mirror
easily.

Finally - the name of the files placed on the inspector web server
and into glance represent the upstream name of the image files rather
than generic names which lose versioning and release information.

Change-Id: I1aed9d97a4ddbfb70d2375f5204c55374d1067c9
2022-12-07 15:03:32 +01:00

79 lines
2.3 KiB
YAML

---
# Copyright 2019, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Default pxelinux.0 config
template:
src: pxelinux-default.j2
dest: "{{ ironic_inspector_tftpboot_dir }}/pxelinux.cfg/default"
- name: Copy Inspector iPXE Configuration
template:
src: inspector.ipxe.j2
dest: "{{ ironic_http_root }}/inspector.ipxe"
owner: "{{ ironic_system_user_name }}"
group: "{{ ironic_system_group_name }}"
- name: Download IPA Images
get_url:
url: "{{ item.url }}"
dest: "/httpboot/{{ item.name }}"
checksum: "sha256:{{ item.sha_url }}"
owner: "{{ ironic_system_user_name }}"
group: "{{ ironic_system_group_name }}"
mode: '0644'
with_items: "{{ ironic_deploy_image_list }}"
- name: Configure nginx when inspector boot mode is http
when: ironic_inspector_boot_mode == 'http'
block:
- name: Disable default nginx configuration
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify:
- Restart web server
- name: Remove default nginx config
file:
path: /etc/nginx/conf.d/default.conf
state: absent
notify:
- Restart web server
- name: Ensure nginx configuration directories exist
file:
path: "{{ item }}"
state: directory
with_items:
- "/etc/nginx/{{ ironic_nginx_conf_path }}"
- name: Configure nginx virtual hosts
template:
src: ironic-ipxe.conf.j2
dest: "/etc/nginx/{{ ironic_nginx_conf_path }}/ironic-ipxe.conf"
notify:
- Restart web server
- name: Link to enable nginx virtual hosts
file:
src: "/etc/nginx/sites-available/ironic-ipxe.conf"
path: "/etc/nginx/sites-enabled/ironic-ipxe.conf"
state: link
when:
- ansible_facts['os_family'] == "Debian"
notify:
- Restart web server