From c305af301bda33d24a7c12633fd572456ef5f017 Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Mon, 12 Dec 2022 12:36:40 +0000 Subject: [PATCH] Allow user defined extra files to be added to ironic tftp directory Some of these files are already statically defined in the role vars, but cannot be extended. The new variable ironic_tftp_extra_content allows either local files (path:) or files from a web server (url:) to be copied into the tftp server root. A feature like this is needed to copy EFI firmware to the tftp root for ironic node CPU architectures that are different to the ironic control plane nodes. The EFI firmware is sometimes not available from the system package manager for architechtures different to the host CPU. Change-Id: Ie30c009d0704b87c2298088935a7f2ec0d55c6fb --- defaults/main.yml | 8 ++++++++ tasks/ironic_conductor_post_install.yml | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index df173022..5b2dc2af 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -215,6 +215,14 @@ ironic_recreate_keys: False ironic_tftp_server_address: "{{ ironic_bmaas_address }}" +# Use this variable to add extra files into the ironic_tftp_root directory +# ironic_tftp_extra_content: +# - path: /some/local/dir/local-file.txt +# name: local-file.txt +# - url: http://boot.ipxe.org/arm64-efi/ipxe.efi +# name: ipxe_aa64.efi +ironic_tftp_extra_content: [] + ironic_pip_packages: - "git+{{ ironic_git_repo }}@{{ ironic_git_install_branch }}#egg=ironic" - cryptography diff --git a/tasks/ironic_conductor_post_install.yml b/tasks/ironic_conductor_post_install.yml index bc24cfaa..94fc2120 100644 --- a/tasks/ironic_conductor_post_install.yml +++ b/tasks/ironic_conductor_post_install.yml @@ -66,12 +66,18 @@ owner: "ironic" group: "ironic" -- name: Copy uefi modules into tftpboot +- name: Copy content into tftpboot (files) copy: src: "{{ item.path }}" dest: "{{ ironic_tftpd_root }}/{{ item.name }}" remote_src: True - with_items: "{{ ironic_uefi_modules }}" + with_items: "{{ (ironic_uefi_modules + ironic_tftp_extra_content) | selectattr('path', 'defined') | list }}" + +- name: Copy content into tftpboot (urls) + get_url: + url: "{{ item.url }}" + dest: "{{ ironic_tftpd_root }}/{{ item.name }}" + with_items: "{{ (ironic_uefi_modules + ironic_tftp_extra_content) | selectattr('url', 'defined') | list }}" - name: Start up tftp service: