Remove TFTP and HTTP server

Sidero already handle those
This commit is contained in:
Khue Doan 2021-07-21 00:23:44 +07:00
parent 59fbd17a14
commit 565de93c0d
No known key found for this signature in database
GPG Key ID: 4C1A90A461B3C27B
6 changed files with 0 additions and 190 deletions

View File

@ -12,25 +12,6 @@
- "{{ role_path }}/files/images"
- "{{ role_path }}/build/mnt"
- name: Download ISO
get_url:
url: "{{ iso_url }}"
dest: "{{ role_path }}/files/images/{{ iso_file_name }}"
checksum: "{{ iso_checksum }}"
register: iso
- name: Extract the ISO
command:
cmd: "xorriso -osirrox on -indev {{ iso.dest }} -extract / {{ role_path }}/build/mnt"
creates: "{{ role_path }}/build/mnt/.treeinfo"
- name: Extract bootloader
iso_extract:
image: "{{ role_path }}/build/mnt/images/efiboot.img"
dest: "{{ role_path }}/build/mnt/EFI/fedora"
files:
- EFI/fedora/grubx64.efi
- name: Copy configs
copy:
src: "{{ role_path }}/templates/"
@ -41,33 +22,6 @@
src: dhcp/dhcpd.conf.j2
dest: "{{ role_path }}/build/dhcp/dhcpd.conf"
- name: Render GRUB config
template:
src: tftp/tftpboot/grub.cfg.j2
dest: "{{ role_path }}/build/tftp/tftpboot/grub.cfg"
- name: Render machine specific Butane config
template:
src: http/ignition/ignition.yaml.j2
dest: "{{ role_path }}/build/http/ignition/{{ hostvars[item]['mac'] }}.yaml"
loop: "{{ groups['metal'] }}"
- name: Render Ignition config from Butane config
docker_container:
name: butane
image: quay.io/coreos/butane:release
auto_remove: yes
volumes:
- "{{ role_path }}/build/http/ignition:/local/src"
working_dir: /local/src
command:
- --pretty
- --strict
- "{{ hostvars[item]['mac'] }}.yaml"
- --output
- "{{ hostvars[item]['mac'] }}.json"
loop: "{{ groups['metal'] }}"
- name: Start ephemeral PXE server
docker_compose:
project_src: "{{ role_path }}/build"

View File

@ -4,19 +4,3 @@ services:
dhcp:
build: ./dhcp
network_mode: host
tftp:
build: ./tftp
network_mode: host
volumes:
- ./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

View File

@ -1 +0,0 @@
FROM nginx:1.19-alpine

View File

@ -1,109 +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
# TODO (bug) ostree-remount bug workaround
- name: ostree-remount.service
enabled: true
contents: |
[Unit]
Description=OSTree Remount OS/ Bind Mounts
Documentation=man:ostree(1)
DefaultDependencies=no
ConditionKernelCommandLine=ostree
OnFailure=emergency.target
Conflicts=umount.target
# Run after core mounts
After=-.mount var.mount
After=systemd-remount-fs.service
# But we run *before* most other core bootup services that need write access to /etc and /var
Before=local-fs.target umount.target
Before=systemd-random-seed.service plymouth-read-write.service systemd-journal-flush.service
Before=systemd-tmpfiles-setup.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/bin/sleep 10
ExecStart=/usr/lib/ostree/ostree-remount
StandardInput=null
StandardOutput=journal
StandardError=journal+console
[Install]
WantedBy=local-fs.target
{% 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 %}

View File

@ -1,7 +0,0 @@
FROM alpine:3
RUN apk add tftp-hpa
COPY ./tftpboot /var/lib/tftpboot
CMD [ "in.tftpd", "--foreground", "--secure", "/var/lib/tftpboot" ]

View File

@ -1,11 +0,0 @@
set timeout=1
menuentry '{{ os_name }} (Live)' {
linux vmlinuz \
ip=dhcp \
ignition.platform.id=metal \
coreos.live.rootfs_url=http://{{ ansible_default_ipv4.address }}/{{ os_name }}/images/pxeboot/rootfs.img \
coreos.inst.install_dev=/dev/{{ disk }} \
coreos.inst.ignition_url=http://{{ ansible_default_ipv4.address }}/ignition/${net_default_mac}.json
initrd initrd.img ignition.img
}