diff --git a/metal/roles/pxe-server/templates/dhcp/Dockerfile b/metal/roles/pxe-server/files/dhcp/Dockerfile similarity index 100% rename from metal/roles/pxe-server/templates/dhcp/Dockerfile rename to metal/roles/pxe-server/files/dhcp/Dockerfile diff --git a/metal/roles/pxe-server/files/docker-compose.yml b/metal/roles/pxe-server/files/docker-compose.yml new file mode 100644 index 00000000..cd59d683 --- /dev/null +++ b/metal/roles/pxe-server/files/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3" + +services: + dhcp: + build: ./dhcp + volumes: + - ./dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf + network_mode: host + tftp: + build: ./tftp + network_mode: host + volumes: + - ./tftp/grub.cfg:/var/lib/tftpboot/grub.cfg + http: + build: ./http + network_mode: host + volumes: + - ./data/iso:/usr/share/nginx/html/iso + - ./data/init-config/:/usr/share/nginx/html/init-config + environment: + NGINX_PORT: 80 diff --git a/metal/roles/pxe-server/templates/http/Dockerfile b/metal/roles/pxe-server/files/http/Dockerfile similarity index 100% rename from metal/roles/pxe-server/templates/http/Dockerfile rename to metal/roles/pxe-server/files/http/Dockerfile diff --git a/metal/roles/pxe-server/templates/tftp/Dockerfile b/metal/roles/pxe-server/files/tftp/Dockerfile similarity index 100% rename from metal/roles/pxe-server/templates/tftp/Dockerfile rename to metal/roles/pxe-server/files/tftp/Dockerfile diff --git a/metal/roles/pxe-server/templates/dhcp/dhcpd.conf.j2 b/metal/roles/pxe-server/templates/dhcpd.conf.j2 similarity index 100% rename from metal/roles/pxe-server/templates/dhcp/dhcpd.conf.j2 rename to metal/roles/pxe-server/templates/dhcpd.conf.j2 diff --git a/metal/roles/pxe-server/templates/docker-compose.yml b/metal/roles/pxe-server/templates/docker-compose.yml deleted file mode 100644 index dcacf065..00000000 --- a/metal/roles/pxe-server/templates/docker-compose.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: "3" - -services: - dhcp: - build: ./dhcp - volumes: - - ./dhcp/dhcpd.conf:/etc/dhcp/dhcpd.conf - network_mode: host - tftp: - build: ./tftp - network_mode: host - volumes: - - ./tftp/tftpboot/grub.cfg:/var/lib/tftpboot/grub.cfg - - ./mnt/EFI/fedora/grubx64.efi:/var/lib/tftpboot/grubx64.efi - - ./mnt/images/ignition.img:/var/lib/tftpboot/ignition.img - - ./mnt/images/pxeboot/initrd.img:/var/lib/tftpboot/initrd.img - - ./mnt/images/pxeboot/vmlinuz:/var/lib/tftpboot/vmlinuz - http: - build: ./http - network_mode: host - volumes: - - ./mnt:/usr/share/nginx/html/CoreOS - - ./http/ignition/:/usr/share/nginx/html/ignition - environment: - NGINX_PORT: 80 diff --git a/metal/roles/pxe-server/templates/tftp/tftpboot/grub.cfg.j2 b/metal/roles/pxe-server/templates/grub.cfg.j2 similarity index 86% rename from metal/roles/pxe-server/templates/tftp/tftpboot/grub.cfg.j2 rename to metal/roles/pxe-server/templates/grub.cfg.j2 index 6a79aa9b..a09cad0d 100644 --- a/metal/roles/pxe-server/templates/tftp/tftpboot/grub.cfg.j2 +++ b/metal/roles/pxe-server/templates/grub.cfg.j2 @@ -1,6 +1,6 @@ set timeout=1 -menuentry '{{ os_name }} (Live)' { +menuentry '{{ iso_url | basename | splitext | first }} (PXE)' { linux vmlinuz \ ip=dhcp \ ignition.platform.id=metal \ diff --git a/metal/roles/pxe-server/templates/http/ignition/ignition.yaml.j2 b/metal/roles/pxe-server/templates/http/ignition/ignition.yaml.j2 deleted file mode 100644 index 91d0ae67..00000000 --- a/metal/roles/pxe-server/templates/http/ignition/ignition.yaml.j2 +++ /dev/null @@ -1,79 +0,0 @@ -variant: fcos -version: 1.3.0 - -passwd: - users: - - name: root - ssh_authorized_keys: - - {{ ssh_public_key }} - -storage: - files: - # Set hostname - - path: /etc/hostname - mode: 0644 - contents: - inline: {{ hostvars[item]['inventory_hostname'] }} - # Set static IP - - path: /etc/NetworkManager/system-connections/{{ network_interface }}.nmconnection - mode: 0600 - contents: - inline: | - [connection] - id={{ network_interface }} - type=ethernet - interface-name={{ network_interface }} - permissions= - [ipv4] - address1={{ (hostvars[item]['ansible_host'] + '/' + ansible_default_ipv4.netmask) | ansible.netcommon.ipaddr('host/prefix') }},{{ ansible_default_ipv4.gateway }} - dns={{ dns_server }}; - dns-search= - method=manual - # Make audit logs less verbose - - path: /etc/sysctl.d/20-silence-audit.conf - contents: - inline: | - kernel.printk=4 - # Fix flannel support - - path: /etc/systemd/network/50-flannel.link - contents: - inline: | - [Match] - OriginalName=flannel* - [Link] - MACAddressPolicy=none - links: - # Set timezone - - path: /etc/localtime - target: /usr/share/zoneinfo/{{ timezone }} - -systemd: - units: - # iSCSI for Longhorn distributed block storage - - name: iscsid.service - enabled: true -{% if item == "metal0" %} - # Terraform state backend - - name: tfstate.service - enabled: true - contents: | - [Unit] - Description=Run etcd for Terraform state backend - After=network-online.target - Wants=network-online.target - - [Service] - ExecStartPre=-/usr/bin/docker kill tfstate - ExecStartPre=-/usr/bin/docker rm tfstate - ExecStart=/usr/bin/docker run --name tfstate \ - --volume tfstate:/bitnami/etcd/data \ - --env ALLOW_NONE_AUTHENTICATION=yes \ - --publish 23799:2379 \ - --restart always \ - bitnami/etcd - ExecStop=/usr/bin/docker stop tfstate - Restart=always - - [Install] - WantedBy=multi-user.target -{% endif %}