mirror of
https://github.com/khuedoan/homelab.git
synced 2025-01-05 21:11:52 +07:00
Split init config to a separate role
This commit is contained in:
parent
32b86b6c68
commit
25de291c71
1
metal/roles/init-config/defaults/main.yml
Normal file
1
metal/roles/init-config/defaults/main.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
timezone: Asia/Ho_Chi_Minh
|
4
metal/roles/init-config/tasks/main.yml
Normal file
4
metal/roles/init-config/tasks/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
- name: Render machine specific init config
|
||||||
|
template:
|
||||||
|
src: kickstart.ks.j2
|
||||||
|
dest: "{{ playbook_dir }}/build/data/init-config/{{ hostvars[item]['mac'] }}.ks"
|
49
metal/roles/init-config/templates/kickstart.ks
Normal file
49
metal/roles/init-config/templates/kickstart.ks
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#version=DEVEL
|
||||||
|
|
||||||
|
# Do not use graphical install
|
||||||
|
text
|
||||||
|
|
||||||
|
# Keyboard layouts
|
||||||
|
keyboard --xlayouts='us'
|
||||||
|
# System language
|
||||||
|
lang en_US.UTF-8
|
||||||
|
|
||||||
|
# Partition clearing information
|
||||||
|
clearpart --all --drives={{ disk }}
|
||||||
|
# Partitioning
|
||||||
|
ignoredisk --only-use={{ disk }}
|
||||||
|
autopart
|
||||||
|
|
||||||
|
# Network information
|
||||||
|
network --bootproto=static --device={{ network_interface }} --ip={{ hostvars[item]['ansible_host'] }} --gateway={{ ansible_default_ipv4.gateway }} --nameserver={{ dns_server }} --netmask={{ ansible_default_ipv4.netmask }} --ipv6=auto --hostname={{ hostvars[item]['inventory_hostname'] }} --activate
|
||||||
|
|
||||||
|
# Use network installation
|
||||||
|
url --url="http://{{ ansible_default_ipv4.address }}/iso/"
|
||||||
|
# Disable Setup Agent on first boot
|
||||||
|
firstboot --disable
|
||||||
|
# Do not configure the X Window System
|
||||||
|
skipx
|
||||||
|
# System services
|
||||||
|
services --enabled="chronyd"
|
||||||
|
# System timezone
|
||||||
|
timezone {{ timezone }} --utc
|
||||||
|
|
||||||
|
# Create user (locked by default)
|
||||||
|
user --groups=wheel --name={{ os_username }}
|
||||||
|
# Add SSH key
|
||||||
|
sshkey --username=root "{{ ssh_public_key }}"
|
||||||
|
|
||||||
|
# SELinux
|
||||||
|
selinux --disabled
|
||||||
|
|
||||||
|
# Firewall
|
||||||
|
firewall --disabled
|
||||||
|
|
||||||
|
%packages
|
||||||
|
@^server-product-environment
|
||||||
|
%end
|
||||||
|
|
||||||
|
# Enable some services for Kubernetes
|
||||||
|
services --enable=iscsid
|
||||||
|
|
||||||
|
reboot
|
@ -46,28 +46,6 @@
|
|||||||
src: tftp/tftpboot/grub.cfg.j2
|
src: tftp/tftpboot/grub.cfg.j2
|
||||||
dest: "{{ role_path }}/build/tftp/tftpboot/grub.cfg"
|
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
|
- name: Start ephemeral PXE server
|
||||||
docker_compose:
|
docker_compose:
|
||||||
project_src: "{{ role_path }}/build"
|
project_src: "{{ role_path }}/build"
|
||||||
|
Loading…
Reference in New Issue
Block a user