From f00c6bf215d43209444b69978f13794b44075cd7 Mon Sep 17 00:00:00 2001 From: Antony Messerli Date: Tue, 30 Jan 2018 11:03:16 -0600 Subject: [PATCH] Replace pxelinux with iPXE support in MNAIO Adds support for iPXE scripting. Allows for the operator to specify a remote iPXE kernel to pull in newer iPXE kernel features and specify a remote default iPXE script for customizing the multi node for other types of deployments. Switches the installations to use netboot installer kernels instead of ISO retrival and extraction. Restructures directory to allow for future multi node configs instead of just debian based installs. Change-Id: Ie97f021dbd33ad3d852132b0b2850f54d4e13476 --- multi-node-aio/README.rst | 6 + multi-node-aio/build.sh | 16 ++- multi-node-aio/playbooks/deploy-pxe.yml | 136 +++--------------- multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 | 32 +++-- multi-node-aio/playbooks/group_vars/all.yml | 72 +++++----- .../playbooks/group_vars/dhcp_hosts.yml | 9 +- .../playbooks/group_vars/pxe_hosts.yml | 4 +- .../{ => configs}/debian/basic-interface.cfg | 0 .../debian/compute.config.j2} | 5 - .../debian/general-post-install-script.sh.j2 | 0 .../debian/infra.config.j2} | 5 - .../{ => configs}/debian/mnaio-bridges.cfg.j2 | 0 .../debian/mnaio-post-install-script.sh.j2 | 0 .../debian/mnaio.config.j2} | 5 - .../{ => configs}/debian/vm-bridges.cfg.j2 | 0 .../debian/vm-compute.config.j2} | 5 - .../debian/vm-post-install-script.sh.j2 | 0 .../debian/vm.config.j2} | 5 - .../playbooks/pxe/tftp/boot.ipxe.j2 | 61 ++++++++ .../playbooks/pxe/tftp/boot.ipxe.macaddr.j2 | 10 ++ multi-node-aio/playbooks/pxe/tftp/menu.cfg.j2 | 24 ---- .../playbooks/pxe/tftp/pxelinux.cfg.default | 5 - .../pxe/tftp/pxelinux.cfg.macaddr.j2 | 11 -- multi-node-aio/playbooks/setup-host.yml | 2 +- 24 files changed, 167 insertions(+), 246 deletions(-) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/basic-interface.cfg (100%) rename multi-node-aio/playbooks/pxe/{debian/compute.preseed.j2 => configs/debian/compute.config.j2} (98%) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/general-post-install-script.sh.j2 (100%) rename multi-node-aio/playbooks/pxe/{debian/infra.preseed.j2 => configs/debian/infra.config.j2} (98%) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/mnaio-bridges.cfg.j2 (100%) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/mnaio-post-install-script.sh.j2 (100%) rename multi-node-aio/playbooks/pxe/{debian/mnaio.preseed.j2 => configs/debian/mnaio.config.j2} (98%) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/vm-bridges.cfg.j2 (100%) rename multi-node-aio/playbooks/pxe/{debian/vm-compute.preseed.j2 => configs/debian/vm-compute.config.j2} (98%) rename multi-node-aio/playbooks/pxe/{ => configs}/debian/vm-post-install-script.sh.j2 (100%) rename multi-node-aio/playbooks/pxe/{debian/vm.preseed.j2 => configs/debian/vm.config.j2} (98%) create mode 100644 multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 create mode 100644 multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2 delete mode 100644 multi-node-aio/playbooks/pxe/tftp/menu.cfg.j2 delete mode 100644 multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.default delete mode 100644 multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 diff --git a/multi-node-aio/README.rst b/multi-node-aio/README.rst index 485669d6..2b401028 100644 --- a/multi-node-aio/README.rst +++ b/multi-node-aio/README.rst @@ -170,6 +170,12 @@ Instruct the system to use a set amount of ram for the logging VM type: Instruct the system to use a set amount of ram for the swift VM type: ``SWIFT_VM_SERVER_RAM=${SWIFT_VM_SERVER_RAM:-1024}`` +Instruct the system to use a customized iPXE kernel: + ``IPXE_KERNEL_URL=${IPXE_KERNEL_URL:-'http://boot.ipxe.org/ipxe.lkrn'}`` + +Instruct the system to use a customized iPXE script during boot of VMs: + ``IPXE_PATH_URL=${IPXE_PATH_URL:-''}`` + Re-kicking VM(s) ---------------- diff --git a/multi-node-aio/build.sh b/multi-node-aio/build.sh index 4373af30..a447a558 100755 --- a/multi-node-aio/build.sh +++ b/multi-node-aio/build.sh @@ -43,12 +43,14 @@ ansible-playbook -vv \ -e default_ubuntu_kernel=${DEFAULT_KERNEL:-"linux-image-generic"} \ -e default_ubuntu_mirror_hostname=${DEFAULT_MIRROR_HOSTNAME:-"archive.ubuntu.com"} \ -e default_ubuntu_mirror_directory=${DEFAULT_MIRROR_DIR:-"/ubuntu"} \ - -e cinder_vm_server_ram=${CINDER_VM_SERVER_RAM-"2048"} \ - -e compute_vm_server_ram=${COMPUTE_VM_SERVER_RAM-"8196"} \ - -e infra_vm_server_ram=${INFRA_VM_SERVER_RAM-"8196"} \ - -e loadbalancer_vm_server_ram=${LOADBALANCER_VM_SERVER_RAM-"1024"} \ - -e logging_vm_server_ram=${LOGGING_VM_SERVER_RAM-"1024"} \ - -e swift_vm_server_ram=${SWIFT_VM_SERVER_RAM-"1024"} \ - -e container_tech=${CONTAINER_TECH-"lxc"}\ + -e cinder_vm_server_ram=${CINDER_VM_SERVER_RAM:-"2048"} \ + -e compute_vm_server_ram=${COMPUTE_VM_SERVER_RAM:-"8196"} \ + -e infra_vm_server_ram=${INFRA_VM_SERVER_RAM:-"8196"} \ + -e loadbalancer_vm_server_ram=${LOADBALANCER_VM_SERVER_RAM:-"1024"} \ + -e logging_vm_server_ram=${LOGGING_VM_SERVER_RAM:-"1024"} \ + -e swift_vm_server_ram=${SWIFT_VM_SERVER_RAM:-"1024"} \ + -e container_tech=${CONTAINER_TECH-"lxc"} \ + -e ipxe_kernel_url=${IPXE_KERNEL_URL:-"http://boot.ipxe.org/ipxe.lkrn"} \ + -e ipxe_path_url=${IPXE_PATH_URL:-""} \ --force-handlers \ playbooks/site.yml diff --git a/multi-node-aio/playbooks/deploy-pxe.yml b/multi-node-aio/playbooks/deploy-pxe.yml index 2f17816e..0058e75e 100644 --- a/multi-node-aio/playbooks/deploy-pxe.yml +++ b/multi-node-aio/playbooks/deploy-pxe.yml @@ -45,15 +45,13 @@ mode: "0755" with_items: - /var/www/pxe + - /var/www/pxe/configs - /var/www/pxe/images - - /var/www/pxe/iso - /var/www/pxe/networking - /var/www/pxe/scripts - /var/www/pxe/templates - /var/lib/tftpboot - - /var/lib/tftpboot/boot-screens - - /var/lib/tftpboot/preseed - - /var/lib/tftpboot/pxelinux.cfg + - /var/lib/tftpboot/ipxe - name: Get root public key command: cat /root/.ssh/id_rsa.pub @@ -89,82 +87,23 @@ notify: - restart tftp-hpa - - name: Download image iso(s) + - name: Download iPXE get_url: - url: "{{ item.value.image_iso_url }}" - dest: "/var/www/pxe/iso/{{ item.value.image_name }}" - with_dict: "{{ images }}" - - - name: Remove image directory if it exists - file: - path: "/var/www/pxe/images/{{ item.value.image_short_name }}" - state: absent - with_dict: "{{ images }}" - - - name: Create image directory if it exists - file: - path: "/var/www/pxe/images/{{ item.value.image_short_name }}" - state: directory - owner: "root" - group: "root" - mode: "0755" - with_dict: "{{ images }}" - - - name: Extract ISO(s) contents - command: "7z x /var/www/pxe/iso/{{ item.value.image_name }}" - args: - chdir: "/var/www/pxe/images/{{ item.value.image_short_name }}" - with_dict: "{{ images }}" - - - name: Download pxelinux - get_url: - url: "{{ pxelinux_url }}" - dest: "/var/www/pxe/{{ pxelinux_name }}" + url: "{{ ipxe_kernel_url }}" + dest: "/var/lib/tftpboot/ipxe.lkrn" tmp_dest: /tmp/ - - name: Remove image directory if it exists - file: - path: "/var/www/pxe/{{ pxelinux_short_name }}" - state: absent - - - name: Extract pxelinux contents - command: "tar -xf /var/www/pxe/{{ pxelinux_name }}" - args: - chdir: "/var/www/pxe" - - - name: Drop pxelinux.cfg default menu - copy: - src: "pxe/tftp/pxelinux.cfg.default" - dest: "{{ item }}" - mode: "0644" - owner: root - group: root - with_items: - - /var/lib/tftpboot/pxelinux.cfg/default - - /var/lib/tftpboot/boot-screens/syslinux.cfg - - # These links are using the shell command because the file module does not create hard links - - name: Create hard links - shell: | - ln -f /var/www/pxe/{{ pxelinux_short_name }}/bios/com32/elflink/ldlinux/ldlinux.c32 /var/lib/tftpboot/ldlinux.c32 - ln -f /var/www/pxe/{{ pxelinux_short_name }}/bios/core/pxelinux.0 /var/lib/tftpboot/pxelinux.0 - ln -f /var/www/pxe/{{ pxelinux_short_name }}/bios/com32/lib/libcom32.c32 /var/lib/tftpboot/boot-screens/libcom32.c32 - ln -f /var/www/pxe/{{ pxelinux_short_name }}/bios/com32/libutil/libutil.c32 /var/lib/tftpboot/boot-screens/libutil.c32 - ln -f /var/www/pxe/{{ pxelinux_short_name }}/bios/com32/menu/vesamenu.c32 /var/lib/tftpboot/boot-screens/vesamenu.c32 - - - name: Drop boot-screens default menu + - name: Drop ipxe default menu template: - src: "pxe/tftp/menu.cfg.j2" - dest: /var/lib/tftpboot/boot-screens/menu.cfg + src: "pxe/tftp/boot.ipxe.j2" + dest: "/var/lib/tftpboot/boot.ipxe" mode: "0644" owner: root group: root - tags: - - boot-menu - name: network scripts for pxe template: - src: "pxe/{{ ansible_os_family | lower }}/{{ item.src }}" + src: "pxe/configs/{{ ansible_os_family | lower }}/{{ item.src }}" dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }} mode: "0644" owner: root @@ -182,7 +121,7 @@ - name: network scripts for an MNAIO template: - src: "pxe/{{ ansible_os_family | lower }}/{{ item.src }}" + src: "pxe/configs/{{ ansible_os_family | lower }}/{{ item.src }}" dest: /var/www/pxe/{{ item.dir }}/{{ item.dest }} mode: "0644" owner: root @@ -199,7 +138,7 @@ - name: network scripts for servers template: - src: "pxe/{{ ansible_os_family | lower }}/vm-bridges.cfg.j2" + src: "pxe/configs/{{ ansible_os_family | lower }}/vm-bridges.cfg.j2" dest: /var/www/pxe/networking/{{ hostvars[item]['server_hostname'] }}-bridges.cfg mode: "0644" owner: root @@ -208,8 +147,8 @@ - name: tftp configs for servers template: - src: "pxe/tftp/pxelinux.cfg.macaddr.j2" - dest: "/var/lib/tftpboot/pxelinux.cfg/01-{{ hostvars[item]['server_mac_address'] | replace(':', '-') | lower }}" + src: "pxe/tftp/boot.ipxe.macaddr.j2" + dest: "/var/lib/tftpboot/ipxe/{{ hostvars[item]['server_mac_address'] | replace(':', '-') | lower }}" mode: "0644" owner: root group: root @@ -217,8 +156,8 @@ - name: Preseeds for pxe mnaio template: - src: "pxe/{{ ansible_os_family | lower }}/mnaio.preseed.j2" - dest: /var/lib/tftpboot/preseed/mnaio.preseed + src: "pxe/configs/{{ ansible_os_family | lower }}/mnaio.config.j2" + dest: /var/www/pxe/configs/mnaio.config mode: "0644" owner: root group: root @@ -226,8 +165,8 @@ - name: Preseeds for pxe vm template: - src: "pxe/{{ ansible_os_family | lower }}/vm.preseed.j2" - dest: /var/lib/tftpboot/preseed/vm.preseed + src: "pxe/configs/{{ ansible_os_family | lower }}/vm.config.j2" + dest: /var/www/pxe/configs/vm.config mode: "0644" owner: root group: root @@ -235,8 +174,8 @@ - name: Preseeds for pxe vm-compute template: - src: "pxe/{{ ansible_os_family | lower }}/vm-compute.preseed.j2" - dest: /var/lib/tftpboot/preseed/vm-compute.preseed + src: "pxe/configs/{{ ansible_os_family | lower }}/vm-compute.config.j2" + dest: /var/www/pxe/configs/vm-compute.config mode: "0644" owner: root group: root @@ -244,8 +183,8 @@ - name: Preseeds for pxe compute template: - src: "pxe/{{ ansible_os_family | lower }}/compute.preseed.j2" - dest: /var/lib/tftpboot/preseed/compute.preseed + src: "pxe/configs/{{ ansible_os_family | lower }}/compute.config.j2" + dest: /var/www/pxe/configs/compute.config mode: "0644" owner: root group: root @@ -253,32 +192,13 @@ - name: Preseeds for pxe infra template: - src: "pxe/{{ ansible_os_family | lower }}/infra.preseed.j2" - dest: /var/lib/tftpboot/preseed/infra.preseed + src: "pxe/configs/{{ ansible_os_family | lower }}/infra.config.j2" + dest: /var/www/pxe/configs/infra.config mode: "0644" owner: root group: root with_dict: "{{ images }}" - - name: Create netboot bind mount path - file: - path: "/var/lib/tftpboot/{{ item.value.image_short_name }}" - state: directory - owner: "root" - group: "root" - mode: "0755" - with_dict: "{{ images }}" - - - name: Unbind mount netboot images - mount: - name: "/var/lib/tftpboot/{{ item.value.image_short_name }}" - src: "/var/www/pxe/images/{{ item.value.image_netboot }}" - opts: bind - fstype: none - state: unmounted - register: fstab - with_dict: "{{ images }}" - - name: Ensure permissions are correct shell: | # Fix perms if needed @@ -286,16 +206,6 @@ find /var/lib/tftpboot -type f -exec chmod 0644 {} \; find /var/www/pxe -type d -exec chmod 0755 {} \; - - name: Bind mount netboot images - mount: - name: "/var/lib/tftpboot/{{ item.value.image_short_name }}" - src: "/var/www/pxe/images/{{ item.value.image_netboot }}" - opts: bind - fstype: none - state: mounted - register: fstab - with_dict: "{{ images }}" - environment: "{{ deployment_environment_variables | default({}) }}" handlers: diff --git a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 index 87da8345..ab2d9f94 100644 --- a/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 +++ b/multi-node-aio/playbooks/dhcp/dhcpd.conf.j2 @@ -12,26 +12,30 @@ shared-network all-networks { option routers {{ dhcp.gateway }}; option domain-name-servers {{ dhcp.dns }}; option subnet-mask {{ dhcp.netmask }}; - {% if dhcp.default_lease_time is defined and dhcp.default_lease_time > 0 %} +{% if dhcp.default_lease_time is defined and dhcp.default_lease_time > 0 %} default-lease-time {{ dhcp.default_lease_time }}; - {% else %} +{% else %} default-lease-time {{ dhcp_default_lease_time }}; - {% endif %} - {% if dhcp.max_lease_time is defined and dhcp.max_lease_time > 0 %} +{% endif %} +{% if dhcp.max_lease_time is defined and dhcp.max_lease_time > 0 %} max-lease-time {{ dhcp.max_lease_time }}; - {% else %} +{% else %} max-lease-time {{ dhcp_max_lease_time }}; - {% endif %} - {% if dhcp.tftp_server is defined and dhcp.tftp_server|ipaddr %} +{% endif %} +{% if dhcp.tftp_server is defined and dhcp.tftp_server|ipaddr %} next-server {{ dhcp.tftp_server }}; - {% elif tftp_server is defined and tftp_server|length > 0 %} +{% elif tftp_server is defined and tftp_server|length > 0 %} next-server {{ tftp_server }}; - {% endif %} - {% if dhcp.tftp_boot_path is defined and dhcp.tftp_boot_path|ipaddr %} - filename "{{ dhcp.tftp_boot_path }}"; - {% elif tftp_boot_path is defined and tftp_boot_path|length > 0 %} - filename "{{ tftp_boot_path }}"; - {% endif %} +{% endif %} + if exists user-class and ( option user-class = "iPXE" ) { +{% if dhcp.ipxe_boot_file is defined and dhcp.ipxe_boot_file|ipaddr %} + filename "{{ dhcp.ipxe_boot_file }}"; +{% elif ipxe_boot_file is defined and ipxe_boot_file|length > 0 %} + filename "{{ ipxe_boot_file }}"; +{% endif %} + } else { + filename "ipxe.lkrn"; + } } {% endfor %} diff --git a/multi-node-aio/playbooks/group_vars/all.yml b/multi-node-aio/playbooks/group_vars/all.yml index c7c9da90..7c5d86b6 100644 --- a/multi-node-aio/playbooks/group_vars/all.yml +++ b/multi-node-aio/playbooks/group_vars/all.yml @@ -24,6 +24,8 @@ default_ubuntu_mirror_proxy: 'http://10.0.2.1:3142/' default_ubuntu_mirror_hostname: archive.ubuntu.com default_ubuntu_mirror_directory: /ubuntu +ipxe_kernel_url: "{{ ipxe_kernel_url | default('http://boot.ipxe.org/ipxe.lkrn') }}" + # IP address, or domain name of the TFTP server tftp_server: "{{ hostvars[groups['pxe_hosts'][0]]['ansible_host'] | default(ansible_host) }}" # tftp_ssh_key: '' # user defined ssh key, used to access the host @@ -32,57 +34,51 @@ tftp_port: 69 # Default ISO images images: ubuntu-16.04-amd64: - image_type: debian - image_iso_url: "http://releases.ubuntu.com/16.04.2/ubuntu-16.04.2-server-amd64.iso" - image_name: "ubuntu-16.04.2-server-amd64.iso" - image_short_name: "ubuntu-16.04.2-server-amd64" - image_default_boot: "ubuntu-16.04.2-server-amd64/amd64/boot-screens/menu.cfg" + image_type: "debian" + image_os: "ubuntu" + image-version: "xenial" image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical" - image_kernel: "ubuntu-16.04.2-server-amd64/amd64/linux" - image_initrd: "ubuntu-16.04.2-server-amd64/amd64/initrd.gz" - image_netboot: "ubuntu-16.04.2-server-amd64/install/netboot/ubuntu-installer" - image_preseeds: + image_netboot_kernel_url: "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux" + image_netboot_initrd_url: "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz" + image_configs: mnaio: - url: "tftp://{{ tftp_server }}/preseed/mnaio.preseed" - template_name: "mnaio.preseed" + url: "http://{{ tftp_server }}/configs/mnaio.config" + template_name: "mnaio.config" vm: - url: "tftp://{{ tftp_server }}/preseed/vm.preseed" - template_name: "vm.preseed" + url: "http://{{ tftp_server }}/configs/vm.config" + template_name: "vm.config" vm-compute: - url: "tftp://{{ tftp_server }}/preseed/vm-compute.preseed" - template_name: "vm-compute.preseed" + url: "http://{{ tftp_server }}/configs/vm-compute.config" + template_name: "vm-compute.config" compute: - url: "tftp://{{ tftp_server }}/preseed/compute.preseed" - template_name: "compute.preseed" + url: "http://{{ tftp_server }}/configs/compute.config" + template_name: "compute.config" infra: - url: "tftp://{{ tftp_server }}/preseed/infra.preseed" - template_name: "infra.preseed" + url: "http://{{ tftp_server }}/configs/infra.config" + template_name: "infra.config" ubuntu-14.04-amd64: - image_type: debian - image_iso_url: "http://releases.ubuntu.com/14.04.5/ubuntu-14.04.5-server-amd64.iso" - image_name: "ubuntu-14.04.5-server-amd64.iso" - image_short_name: "ubuntu-14.04.5-server-amd64" - image_default_boot: "ubuntu-14.04.5-server-amd64/amd64/boot-screens/menu.cfg" + image_type: "debian" + image_os: "ubuntu" + image_version: "trusty" image_kernel_options: "biosdevname=0 net.ifnames=0 auto=true priority=critical quiet splash" - image_kernel: "ubuntu-14.04.5-server-amd64/amd64/linux" - image_initrd: "ubuntu-14.04.5-server-amd64/amd64/initrd.gz" - image_netboot: "ubuntu-14.04.5-server-amd64/install/netboot/ubuntu-installer" - image_preseeds: + image_netboot_kernel_url: "http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux" + image_netboot_initrd_url: "http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz" + image_configs: mnaio: - url: "tftp://{{ tftp_server }}/preseed/mnaio.preseed" - template_name: "mnaio.preseed" + url: "http://{{ tftp_server }}/configs/mnaio.config" + template_name: "mnaio.config" vm: - url: "tftp://{{ tftp_server }}/preseed/vm.preseed" - template_name: "vm.preseed" + url: "http://{{ tftp_server }}/configs/vm.config" + template_name: "vm.config" vm-compute: - url: "tftp://{{ tftp_server }}/preseed/vm-compute.preseed" - template_name: "vm-compute.preseed" + url: "http://{{ tftp_server }}/configs/vm-compute.config" + template_name: "vm-compute.config" compute: - url: "tftp://{{ tftp_server }}/preseed/compute.preseed" - template_name: "compute.preseed" + url: "http://{{ tftp_server }}/configs/compute.config" + template_name: "compute.config" infra: - url: "tftp://{{ tftp_server }}/preseed/infra.preseed" - template_name: "infra.preseed" + url: "http://{{ tftp_server }}/configs/infra.config" + template_name: "infra.config" # mnaio_data_disk: 'sdc' # str - not required, set this to define a given data disk if no data disk # is defined the largest unpartitioned disk will be used. mnaio_host_networks: diff --git a/multi-node-aio/playbooks/group_vars/dhcp_hosts.yml b/multi-node-aio/playbooks/group_vars/dhcp_hosts.yml index 2fcea994..3f2d957c 100644 --- a/multi-node-aio/playbooks/group_vars/dhcp_hosts.yml +++ b/multi-node-aio/playbooks/group_vars/dhcp_hosts.yml @@ -11,10 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -dhcp_default_lease_time: 21600 # Default lease time -dhcp_max_lease_time: 43200 # Max lease time -tftp_boot_path: /pxelinux.0 # Path of where to boot from first - +dhcp_default_lease_time: 21600 # Default lease time +dhcp_max_lease_time: 43200 # Max lease time +ipxe_boot_file: "boot.ipxe" # Path of initial iPXE bootloader # - List of DHCP Subnets - These are iterated though and each will be created dhcp_list: - netmask: 255.255.255.0 # Netmask @@ -23,6 +22,6 @@ dhcp_list: subnet: 10.0.2.0 # Subnet mask default_lease_time: 21600 # Subnet Default lease time - The default is used if this is not defined max_lease_time: 43200 # Subnet Max lease time - The default is used if this is not defined - tftp_boot_path: /pxelinux.0 # Path for tftp of where to boot from first - The default is used if this is not defined + ipxe_boot_file: "boot.ipxe" # Path of initial iPXE bootloader to boot from first tftp_server: "{{ tftp_server }}" # The server hosting the TFTP server - The default is used if this is not defined dhcp_default_domain_name: openstackci.local diff --git a/multi-node-aio/playbooks/group_vars/pxe_hosts.yml b/multi-node-aio/playbooks/group_vars/pxe_hosts.yml index 1c6f98f8..053b3c0d 100644 --- a/multi-node-aio/playbooks/group_vars/pxe_hosts.yml +++ b/multi-node-aio/playbooks/group_vars/pxe_hosts.yml @@ -11,6 +11,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -pxelinux_url: "https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz" -pxelinux_name: "syslinux-6.03.tar.gz" -pxelinux_short_name: "syslinux-6.03" +ipxe_ubuntu_version: "1.0.0+git-20150424.a25a16d-1ubuntu1.2" diff --git a/multi-node-aio/playbooks/pxe/debian/basic-interface.cfg b/multi-node-aio/playbooks/pxe/configs/debian/basic-interface.cfg similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/basic-interface.cfg rename to multi-node-aio/playbooks/pxe/configs/debian/basic-interface.cfg diff --git a/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 b/multi-node-aio/playbooks/pxe/configs/debian/compute.config.j2 similarity index 98% rename from multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/compute.config.j2 index a43b58c8..da73d941 100644 --- a/multi-node-aio/playbooks/pxe/debian/compute.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/configs/debian/compute.config.j2 @@ -34,11 +34,6 @@ d-i netcfg/wireless_wep string d-i preseed/early_command string \ umount /media || true -# Net Image - -# Required at least for 12.10+ -d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs - # The kernel image (meta) package to be installed; "none" can be used if no # kernel is to be installed. d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} diff --git a/multi-node-aio/playbooks/pxe/debian/general-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/configs/debian/general-post-install-script.sh.j2 similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/general-post-install-script.sh.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/general-post-install-script.sh.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 b/multi-node-aio/playbooks/pxe/configs/debian/infra.config.j2 similarity index 98% rename from multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/infra.config.j2 index 03bb8641..2cd1bc73 100644 --- a/multi-node-aio/playbooks/pxe/debian/infra.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/configs/debian/infra.config.j2 @@ -34,11 +34,6 @@ d-i netcfg/wireless_wep string d-i preseed/early_command string \ umount /media || true -# Net Image - -# Required at least for 12.10+ -d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs - # The kernel image (meta) package to be installed; "none" can be used if no # kernel is to be installed. d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} diff --git a/multi-node-aio/playbooks/pxe/debian/mnaio-bridges.cfg.j2 b/multi-node-aio/playbooks/pxe/configs/debian/mnaio-bridges.cfg.j2 similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/mnaio-bridges.cfg.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/mnaio-bridges.cfg.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/mnaio-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/configs/debian/mnaio-post-install-script.sh.j2 similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/mnaio-post-install-script.sh.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/mnaio-post-install-script.sh.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 b/multi-node-aio/playbooks/pxe/configs/debian/mnaio.config.j2 similarity index 98% rename from multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/mnaio.config.j2 index 33b97ab1..88f275a5 100644 --- a/multi-node-aio/playbooks/pxe/debian/mnaio.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/configs/debian/mnaio.config.j2 @@ -34,11 +34,6 @@ d-i netcfg/wireless_wep string d-i preseed/early_command string \ umount /media || true -# Net Image - -# Required at least for 12.10+ -d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs - # The kernel image (meta) package to be installed; "none" can be used if no # kernel is to be installed. d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} diff --git a/multi-node-aio/playbooks/pxe/debian/vm-bridges.cfg.j2 b/multi-node-aio/playbooks/pxe/configs/debian/vm-bridges.cfg.j2 similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/vm-bridges.cfg.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/vm-bridges.cfg.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/vm-compute.preseed.j2 b/multi-node-aio/playbooks/pxe/configs/debian/vm-compute.config.j2 similarity index 98% rename from multi-node-aio/playbooks/pxe/debian/vm-compute.preseed.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/vm-compute.config.j2 index 125590a9..021494c4 100644 --- a/multi-node-aio/playbooks/pxe/debian/vm-compute.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/configs/debian/vm-compute.config.j2 @@ -34,11 +34,6 @@ d-i netcfg/wireless_wep string d-i preseed/early_command string \ umount /media || true -# Net Image - -# Required at least for 12.10+ -d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs - # The kernel image (meta) package to be installed; "none" can be used if no # kernel is to be installed. d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} diff --git a/multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 b/multi-node-aio/playbooks/pxe/configs/debian/vm-post-install-script.sh.j2 similarity index 100% rename from multi-node-aio/playbooks/pxe/debian/vm-post-install-script.sh.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/vm-post-install-script.sh.j2 diff --git a/multi-node-aio/playbooks/pxe/debian/vm.preseed.j2 b/multi-node-aio/playbooks/pxe/configs/debian/vm.config.j2 similarity index 98% rename from multi-node-aio/playbooks/pxe/debian/vm.preseed.j2 rename to multi-node-aio/playbooks/pxe/configs/debian/vm.config.j2 index 873cb03b..7b890ab6 100644 --- a/multi-node-aio/playbooks/pxe/debian/vm.preseed.j2 +++ b/multi-node-aio/playbooks/pxe/configs/debian/vm.config.j2 @@ -34,11 +34,6 @@ d-i netcfg/wireless_wep string d-i preseed/early_command string \ umount /media || true -# Net Image - -# Required at least for 12.10+ -d-i live-installer/net-image string {{ tftp_server }}/images/{{ item.value.image_short_name }}/install/filesystem.squashfs - # The kernel image (meta) package to be installed; "none" can be used if no # kernel is to be installed. d-i base-installer/kernel/image string {{ default_ubuntu_kernel }} diff --git a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 new file mode 100644 index 00000000..516a02c9 --- /dev/null +++ b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.j2 @@ -0,0 +1,61 @@ +#!ipxe +set esc:hex 1b +set bold ${esc:string}[1m +set boldoff ${esc:string}[22m +set space:hex 20:20 +set space ${space:string} +set timeout 10 + +{% if ipxe_kernel_url is defined and ipxe_kernel_url|length > 0%} +iseq ${version} {{ ipxe_ubuntu_version }} && chain --autofree {{ ipxe_kernel_url }} || +{% else %} +iseq ${version} {{ ipxe_ubuntu_version }} && chain --autofree ipxe.lkrn || +{% endif %} +{% if ipxe_path_url is defined and ipxe_path_url| length > 0%} +echo Loading iPXE path defined in ipxe_path_url... +chain --autofree {{ ipxe_path_url }} +{% endif %} +:start +echo ${bold}Multi Node AIO Install${boldoff} starting... +prompt --key m --timeout 4000 Hit the ${bold}m${boldoff} key to load default menu... && goto menu || goto boot_mac + +:boot_mac +chain --autofree ipxe/${net0/mac:hexhyp} || +goto menu + +:menu +clear choice +menu Multi Node AIO Installation Menu +item --gap Default: +item local ${space} Boot from local hdd +item --gap Automated Installs +{% for key, value in images.items() %} +{% for _key, _value in value.image_configs.items() %} +item {{ key }}-{{ _key }} ${space} {{ key }}-{{ _key }} +{% endfor %} +{% endfor %} +item --gap Tools +item shell ${space} iPXE shell +isset ${choice} && set timeout 0 || set timeout 300000 +choose --timeout ${timeout} --default local choice && goto ${choice} || goto local + +{% for key, value in images.items() %} +{% for _key, _value in value.image_configs.items() %} +:{{ key }}-{{ _key }} +kernel {{ value.image_netboot_kernel_url }} +initrd {{ value.image_netboot_initrd_url }} +{% if value.image_type == 'debian' %} +imgargs linux {{ value.image_kernel_options }} initrd=initrd.gz preseed/url={{ _value.url }} preseed/interactive=false netcfg/choose_interface={{ default_interface }} +{% endif %} +boot +{% endfor %} +{% endfor %} + +:local +echo Booting from local disks ... +exit 0 + +:shell +echo Type "exit" to return to menu. +shell +goto menu diff --git a/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2 b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2 new file mode 100644 index 00000000..bd4c8675 --- /dev/null +++ b/multi-node-aio/playbooks/pxe/tftp/boot.ipxe.macaddr.j2 @@ -0,0 +1,10 @@ +{% set server_vars = hostvars[item] %} +{% set image_properties = images[server_vars['server_image']] %} +#!ipxe + +kernel {{ image_properties['image_netboot_kernel_url'] }} +initrd {{ image_properties['image_netboot_initrd_url'] }} +{% if image_properties['image_type'] == 'debian' %} +imgargs linux hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} preseed/url={{ image_properties['image_configs'][server_vars['server_preseed_ks']]['url'] }} preseed/interactive=false netcfg/choose_interface={{ server_vars['server_default_interface'] }} netcfg/get_domain={{ server_vars['server_domain_name'] }} initrd=initrd.gz {{ server_vars['server_extra_options'] | default('') }} +{% endif %} +boot diff --git a/multi-node-aio/playbooks/pxe/tftp/menu.cfg.j2 b/multi-node-aio/playbooks/pxe/tftp/menu.cfg.j2 deleted file mode 100644 index c19531ab..00000000 --- a/multi-node-aio/playbooks/pxe/tftp/menu.cfg.j2 +++ /dev/null @@ -1,24 +0,0 @@ -menu hshift 13 -menu width 49 -menu margin 8 -menu tabmsg - -menu title Boot Menu -label local - menu label ^Boot local hard drive - LOCALBOOT 0 - -{% for key, value in images.items() %} -{% for _key, _value in value.image_preseeds.items() %} -label {{ key }}-{{ _key }} - menu label ^{{ key }}-{{ _key }} automated install - kernel {{ value.image_kernel }} -{% if value.image_type == 'debian' %} - append {{ value.image_kernel_options }} initrd={{ value.image_initrd }} preseed/url={{ _value.url }} preseed/interactive=false netcfg/choose_interface={{ default_interface }} -{% endif %} - -{% endfor %} - -{% endfor %} - -menu end diff --git a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.default b/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.default deleted file mode 100644 index db9ea4e2..00000000 --- a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.default +++ /dev/null @@ -1,5 +0,0 @@ -path boot-screens -include boot-screens/menu.cfg -default boot-screens/vesamenu.c32 -prompt 0 -timeout 100 \ No newline at end of file diff --git a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 b/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 deleted file mode 100644 index 24cfe4e2..00000000 --- a/multi-node-aio/playbooks/pxe/tftp/pxelinux.cfg.macaddr.j2 +++ /dev/null @@ -1,11 +0,0 @@ -{% set server_vars = hostvars[item] %} -{% set image_properties = images[server_vars['server_image']] %} - -default linux -prompt 0 -timeout 1 -label linux - kernel {{ image_properties['image_kernel'] }} -{% if image_properties['image_type'] == 'debian' %} - append hostname={{ server_vars['server_hostname'] }} {{ image_properties['image_kernel_options'] }} initrd={{ image_properties['image_initrd'] }} preseed/url={{ image_properties['image_preseeds'][server_vars['server_preseed_ks']]['url'] }} preseed/interactive=false netcfg/choose_interface={{ server_vars['server_default_interface'] }} netcfg/get_domain={{ server_vars['server_domain_name'] }} {{ server_vars['server_extra_options'] | default('') }} -{% endif %} diff --git a/multi-node-aio/playbooks/setup-host.yml b/multi-node-aio/playbooks/setup-host.yml index 99ac8fe8..a7c55afa 100644 --- a/multi-node-aio/playbooks/setup-host.yml +++ b/multi-node-aio/playbooks/setup-host.yml @@ -129,7 +129,7 @@ - name: Drop host network interfaces template: - src: "pxe/{{ ansible_os_family | lower }}/mnaio-bridges.cfg.j2" + src: "pxe/configs/{{ ansible_os_family | lower }}/mnaio-bridges.cfg.j2" dest: /etc/network/interfaces.d/mnaio-bridges.cfg mode: "0644" owner: root