diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 3eb02f2938..17c2c6da7f 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -423,6 +423,7 @@ enable_horizon_zun: "{{ enable_zun | bool }}" enable_hyperv: "no" enable_influxdb: "no" enable_ironic: "no" +enable_ironic_pxe_uefi: "no" enable_iscsid: "{{ (enable_cinder | bool and enable_cinder_backend_iscsi | bool) or enable_ironic | bool }}" enable_karbor: "no" enable_kuryr: "no" diff --git a/ansible/roles/ironic/tasks/config.yml b/ansible/roles/ironic/tasks/config.yml index fd51d76b93..e93a9f7774 100644 --- a/ansible/roles/ironic/tasks/config.yml +++ b/ansible/roles/ironic/tasks/config.yml @@ -72,6 +72,19 @@ # Only required when Ironic inspector is in use. - groups['ironic-inspector'] | length > 0 - inventory_hostname in groups['ironic-pxe'] + - not enable_ironic_pxe_uefi + +- name: Copying ironic_pxe_uefi.cfg default + template: + src: "{{ item }}" + dest: "{{ node_config_directory }}/ironic-pxe/default" + with_first_found: + - "{{ node_custom_config }}/ironic/ironic_pxe_uefi.default" + - "{{ node_custom_config }}/ironic/{{ inventory_hostname }}/ironic_pxe_uefi.default" + - "ironic_pxe_uefi.default.j2" + when: + - inventory_hostname in groups['ironic-pxe'] + - enable_ironic_pxe_uefi | bool - name: Copying ironic-agent kernel and initramfs copy: @@ -84,6 +97,7 @@ # Only required when Ironic inspector is in use. - groups['ironic-inspector'] | length > 0 - inventory_hostname in groups['ironic-pxe'] + - not enable_ironic_pxe_uefi - name: Check if policies shall be overwritten local_action: stat path="{{ node_custom_config }}/ironic/policy.json" diff --git a/ansible/roles/ironic/tasks/precheck.yml b/ansible/roles/ironic/tasks/precheck.yml index 2ef0530544..0dc5a1a03f 100644 --- a/ansible/roles/ironic/tasks/precheck.yml +++ b/ansible/roles/ironic/tasks/precheck.yml @@ -37,6 +37,7 @@ # Only required when Ironic inspector is in use. - groups['ironic-inspector'] | length > 0 - inventory_hostname in groups['ironic-pxe'] + - not enable_ironic_pxe_uefi with_items: - "ironic-agent.kernel" - "ironic-agent.initramfs" diff --git a/ansible/roles/ironic/templates/ironic-pxe.json.j2 b/ansible/roles/ironic/templates/ironic-pxe.json.j2 index b56286fb0c..3a06abb7f0 100644 --- a/ansible/roles/ironic/templates/ironic-pxe.json.j2 +++ b/ansible/roles/ironic/templates/ironic-pxe.json.j2 @@ -1,7 +1,11 @@ +{% set pxe_dir = ('/tftpboot/grub' if kolla_base_distro in ['ubuntu', 'debian'] else '/tftpboot/EFI/centos') if enable_ironic_pxe_uefi | bool else '/tftpboot/pxelinux.cfg' %} +{% set pxe_cfg = 'grub.cfg' if enable_ironic_pxe_uefi | bool else 'default' %} + { "command": "/usr/sbin/in.tftpd --verbose --foreground --user root --address 0.0.0.0:69 --map-file /map-file /tftpboot", "config_files": [ {% if groups['ironic-inspector'] | length > 0 %} +{% if not enable_ironic_pxe_uefi %} { "source": "{{ container_config_directory }}/ironic-agent.kernel", "dest": "/tftpboot/ironic-agent.kernel", @@ -14,9 +18,10 @@ "owner": "root", "perm": "0644" }, +{% endif %} { "source": "{{ container_config_directory }}/default", - "dest": "/tftpboot/pxelinux.cfg/default", + "dest": "{{ pxe_dir }}/{{ pxe_cfg }}", "owner": "root", "perm": "0644" } @@ -24,7 +29,7 @@ ], "permissions": [ { - "path": "/tftpboot/pxelinux.cfg", + "path": "{{ pxe_dir }}", "owner": "ironic:ironic", "recurse": true } diff --git a/ansible/roles/ironic/templates/ironic_pxe_uefi.default.j2 b/ansible/roles/ironic/templates/ironic_pxe_uefi.default.j2 new file mode 100644 index 0000000000..1546765077 --- /dev/null +++ b/ansible/roles/ironic/templates/ironic_pxe_uefi.default.j2 @@ -0,0 +1,7 @@ +set default=master +set timeout=5 +set hidden_timeout_quiet=false + +menuentry "master" { + configfile /tftpboot/$net_default_ip.conf +} diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index c9107f6ce9..88ba199690 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -185,6 +185,7 @@ kolla_internal_vip_address: "10.10.10.254" #enable_hyperv: "no" #enable_influxdb: "no" #enable_ironic: "no" +#enable_ironic_pxe_uefi: "no" #enable_karbor: "no" #enable_kuryr: "no" #enable_magnum: "no"