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

doc: add documentation to clarify context

parent 323d21a1
No related branches found
No related tags found
No related merge requests found
...@@ -16,10 +16,10 @@ To deploy this role to a managed host, the following software must be installed ...@@ -16,10 +16,10 @@ To deploy this role to a managed host, the following software must be installed
## Quick start ## Quick start
``` ```
ansible-playbook site.yml -b -K ansible-playbook site.yml -i ~/inventory_tmp.yml --become
``` ```
## General usage ## General Ansible usage
Most options already have sensible defaults in `ansible.cfg`. However, you can override these defaults using CLI options/flags if you want to. Most options already have sensible defaults in `ansible.cfg`. However, you can override these defaults using CLI options/flags if you want to.
......
--- ---
- hosts: localhost - hosts: localhost
connection: local connection: local
vars:
- ISO: "RHEL79"
vars_prompt: vars_prompt:
- name: install_hostname - name: install_hostname
prompt: "What's the hostname of the system that you're trying to install? Use ONLY the hostname, NOT the FQDN!" prompt: "What's the hostname of the system that you're trying to install? Use ONLY the hostname, NOT the FQDN!"
......
--- ---
### PREPARATION ### PREPARATION
# Create a separate build directory so the role directory is not overly polluted
- name: create build directory - name: create build directory
file: file:
path: "{{ playbook_dir }}/build/" path: "{{ playbook_dir }}/build/"
state: directory state: directory
# Mount the RHEL ISO image to a temporary mountpoint. That mountpoint is
# automatically removed on unmount.
# To not pollute the system's fstab file, we use a separate on below /tmp/.
- name: mount boot ISO - name: mount boot ISO
mount: mount:
fstype: "iso9660" fstype: "iso9660"
opts: "loop" opts: "loop"
path: "{{ playbook_dir }}/iso/" path: "{{ playbook_dir }}/iso/"
src: "{{ playbook_dir }}/rhel-server-7.9-x86_64-dvd.iso" src: "{{ playbook_dir }}/rhel-server-{{ rhel_version_long }}-x86_64-dvd.iso"
fstab: "/tmp/fstab" fstab: "/tmp/fstab"
state: mounted state: mounted
# Copy contents of ISO image to the build directory, because they will need to
# be included in the new image.
- name: copy ISO contents - name: copy ISO contents
shell: shell:
cmd: 'cp -avRf "{{ playbook_dir }}/iso" "{{ playbook_dir }}/build"' cmd: 'cp -avRf "{{ playbook_dir }}/iso" "{{ playbook_dir }}/build"'
...@@ -31,11 +37,17 @@ ...@@ -31,11 +37,17 @@
### CREATE CONFIGS ### CREATE CONFIGS
# Write Kickstart files for all servers listed in the network.yml vars file.
# The Kickstart file contains configurations for the RHEL Anaconda installer
# that determine what the future system will look like in terms of packages,
# partitioning, network configuration etc.
- name: write Kickstart files - name: write Kickstart files
template: template:
src: "kickstart.cfg.j2" src: "kickstart.cfg.j2"
dest: "build/iso/{{ item.hostname }}.cfg" dest: "build/iso/{{ item.hostname }}.cfg"
loop: "{{ hosts }}" loop: "{{ hosts }}"
# Write isolinux config file that contains references to the installation media
# and the Kickstart file.
- name: template isolinux config - name: template isolinux config
template: template:
src: "isolinux.cfg.j2" src: "isolinux.cfg.j2"
...@@ -45,6 +57,8 @@ ...@@ -45,6 +57,8 @@
### CREATE ISO INSTALLATION IMAGE ### CREATE ISO INSTALLATION IMAGE
# Create the custom ISO installation DVD image. When it's finished, it can be
# found below "./build/".
- name: create ISO image - name: create ISO image
command: command:
cmd: 'xorrisofs -output {{ playbook_dir }}/build/{{ ISO }}.iso -eltorito-boot isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -volid "{{ ISO }}" -rational-rock {{ playbook_dir }}/build/iso/' cmd: 'xorrisofs -output {{ playbook_dir }}/build/{{ ISO }}.iso -eltorito-boot isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -volid "{{ ISO }}" -rational-rock {{ playbook_dir }}/build/iso/'
...@@ -58,7 +72,7 @@ ...@@ -58,7 +72,7 @@
mount: mount:
path: "{{ playbook_dir }}/iso" path: "{{ playbook_dir }}/iso"
state: unmounted state: unmounted
- name: clean up - name: clean up temporary files and directories
file: file:
path: "{{ item }}" path: "{{ item }}"
state: absent state: absent
......
...@@ -60,7 +60,7 @@ menu separator # insert an empty line ...@@ -60,7 +60,7 @@ menu separator # insert an empty line
##### Begin INSERTED FOR ANSIBLE ROLE ##### ##### Begin INSERTED FOR ANSIBLE ROLE #####
label netinstall label netinstall
menu label Install Red Hat Enterprise Linux 7.9 ^Netinstall Server menu label Install Red Hat Enterprise Linux {{ rhel_version_long }} ^Netinstall Server
menu default menu default
kernel vmlinuz kernel vmlinuz
append initrd=initrd.img inst.ks=cdrom:/{{ item.hostname }}.cfg inst.stage2=hd:LABEL=RHEL79 quiet append initrd=initrd.img inst.ks=cdrom:/{{ item.hostname }}.cfg inst.stage2=hd:LABEL=RHEL79 quiet
......
--- ---
# vars file for ansible_lza_create_rhel_iso # vars file for ansible_lza_create_rhel_iso
rhel_version_long: "7.9"
rhel_version_short: "79"
ISO: "RHEL{{ rhel_version_short }}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment