Skip to content
Snippets Groups Projects
Commit e7ad959c authored by Jörg Sachse's avatar Jörg Sachse
Browse files

feat: create Kickstart config files from template to facilitate RHEL install automation

parent 61ac5621
No related branches found
No related tags found
No related merge requests found
--- ---
- hosts: "*" - hosts: localhost
pre_tasks: connection: local
- name: Verify that the installed version of Ansible meets this playbook's version requirements. tasks:
assert: - name: check if listfile for networking exists
that: "ansible_version.full is version_compare('2.5', '>=')" find:
msg: > paths: "{{ playbook_dir }}/vars/"
"You must update Ansible to at least 2.5 to use this playbook." patterns: "network.yml"
# Collect facts from remote system? Possible values: true, false register: result_network
gather_facts: true - debug:
# Gather only certain subsects of facts. Ansible supports network, hardware, virtual, facter, ohai as subset. msg: "{{ item.path }}"
gather_subset: loop: "{{ result_network.files }}"
- network - name: bail out if config file doesn't exist
- virtual fail:
- hardware msg: "The required config file 'vars/network.yml' couldn't be found. Please refer to vars/network.yml.example for further documentation."
# any_error_fatal will mark all the hosts as failed if fails and immediately abort the playbook execution. Possible values: true, false when: "result_network.matched < 1"
any_errors_fatal: false - name: include networking variables
# max_fail_percentage allows you to abort the play if certain threshold of failures have been reached. include_vars: "{{ item.path }}"
max_fail_percentage: 30 loop: "{{ result_network.files }}"
serial: 30 - name: create build directory
# hide sensitive information in verbose/debugging output from others. Possible values: true, false file:
no_log: false path: "{{ playbook_dir }}/build/"
# execution strategy, possible values: debug, linear, serial, free (https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html) state: directory
strategy: linear - name: write Kickstart files
template:
src: "kickstart.cfg.j2"
dest: "build/{{ item.hostname }}"
loop: "{{ hosts }}"
roles: #- hosts: "*"
- { role: ansible_lza_bootstrap_rhel_server } # pre_tasks:
# - { role: ansible_lza_install_common, become: true } # - name: Verify that the installed version of Ansible meets this playbook's version requirements.
# - { role: ansible_lza_server_hardening, become: true } # assert:
# - { role: ansible_lza_rosetta_app, become: true } # that: "ansible_version.full is version_compare('2.5', '>=')"
# msg: >
# "You must update Ansible to at least 2.5 to use this playbook."
# # Collect facts from remote system? Possible values: true, false
# gather_facts: true
# # Gather only certain subsects of facts. Ansible supports network, hardware, virtual, facter, ohai as subset.
# gather_subset:
# - network
# - virtual
# - hardware
# # any_error_fatal will mark all the hosts as failed if fails and immediately abort the playbook execution. Possible values: true, false
# any_errors_fatal: false
# # max_fail_percentage allows you to abort the play if certain threshold of failures have been reached.
# max_fail_percentage: 30
# serial: 30
# # hide sensitive information in verbose/debugging output from others. Possible values: true, false
# no_log: false
# # execution strategy, possible values: debug, linear, serial, free (https://docs.ansible.com/ansible/latest/user_guide/playbooks_strategies.html)
# strategy: linear
#
# roles:
# - { role: ansible_lza_bootstrap_rhel_server }
# # - { role: ansible_lza_install_common, become: true }
# # - { role: ansible_lza_server_hardening, become: true }
# # - { role: ansible_lza_rosetta_app, become: true }
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=de-nodeadkeys --xlayouts='de (nodeadkeys)'
# System language
lang de_DE.UTF-8
# Network information
network --bootproto=static --device=ens192 --ethtool="autoneg on" --gateway=212.201.61.1 --ip={{ item.ip_address }} --nameserver=194.95.142.157,194.95.142.203,194.95.142.200 --netmask=255.255.255.192 --ipv6=auto --activate
network --hostname={{ item.hostname }}.slub-dresden.de
repo --name="Server-HighAvailability" --baseurl=file:///run/install/repo/addons/HighAvailability
repo --name="Server-ResilientStorage" --baseurl=file:///run/install/repo/addons/ResilientStorage
# Root password
rootpw --iscrypted $6$67rCX4MFo0HPCG0T$7DsUx/fFJ067LS5QDtRMDTIcMrq1FejZOp/Ei4o.L08cbYC2FVsJ4Tp45iKrZDfL0df7qgeWpY7ylBfI3k/7b1
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/Berlin --isUtc
#user --groups=wheel --name=jsachse --password=$6$OVScoE8L9aqJgECe$N80BzeVCZV43CpUZtxL5KDI0VQzuy6P4FId3NLJE9gw0nOMf9Z2oxscwnjGg2LeG8DMhY0Z2c.mTtIWRcXsiK/ --iscrypted --gecos="Jörg Sachse"
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part / --fstype="ext4" --ondisk=sda --size=143360
part swap --fstype="swap" --ondisk=sda --size=5120
part /boot --fstype="xfs" --ondisk=sda --size=1024
%packages
@^minimal
@core
chrony
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
---
- hostname: localhost
ip_address: 127.0.0.1
- hostname: example_host
ip_address: 123.234.213.132
# add/edit more hosts as necessary
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment