diff options
| author | spmfox <spmfox@foxwd.com> | 2025-07-15 18:29:03 -0400 |
|---|---|---|
| committer | spmfox <spmfox@foxwd.com> | 2025-07-15 18:29:03 -0400 |
| commit | 167b3da9926db3a4f507533427b72933c008dee6 (patch) | |
| tree | 0becf90d8e9da037d8b02a0b1f69ce41e6730df3 /roles | |
| parent | 57dba39ce3df4a84e05138a7b42e37615d58abc8 (diff) | |
adding EL10, enhancing rhsm
Diffstat (limited to 'roles')
| -rw-r--r-- | roles/guest-configure/tasks/main.yml | 3 | ||||
| -rw-r--r-- | roles/guest-configure/tasks/rhsm-register.yml | 15 | ||||
| -rw-r--r-- | roles/guest-configure/tasks/undo.yml | 2 | ||||
| -rw-r--r-- | roles/guest-configure/vars/main.yml | 1 | ||||
| -rw-r--r-- | roles/libvirt/templates/kickstart/el10.ks | 51 |
5 files changed, 64 insertions, 8 deletions
diff --git a/roles/guest-configure/tasks/main.yml b/roles/guest-configure/tasks/main.yml index 0874b4b..76bf2b1 100644 --- a/roles/guest-configure/tasks/main.yml +++ b/roles/guest-configure/tasks/main.yml @@ -13,7 +13,8 @@ - name: Import Red Hat Subscription Manager task ansible.builtin.import_tasks: rhsm-register.yml - when: (guest_configure_rhsm_username | length > 0) and (guest_configure_rhsm_password | length > 0) + when: ((guest_configure_rhsm_username | length > 0) and (guest_configure_rhsm_password | length > 0)) or + ((guest_configure_rhsm_org_id | length > 0) and (guest_configure_rhsm_activation_key | length > 0)) - name: Import update task ansible.builtin.import_tasks: update.yml diff --git a/roles/guest-configure/tasks/rhsm-register.yml b/roles/guest-configure/tasks/rhsm-register.yml index ad09b17..50af690 100644 --- a/roles/guest-configure/tasks/rhsm-register.yml +++ b/roles/guest-configure/tasks/rhsm-register.yml @@ -1,14 +1,17 @@ -- name: Register guest with Red Hat Subscription Manager (without Activation Key) +- name: Register guest with Red Hat Subscription Manager (username/password) community.general.redhat_subscription: username: "{{ guest_configure_rhsm_username }}" password: "{{ guest_configure_rhsm_password }}" state: present - when: guest_configure_rhsm_activation_key | length == 0 + when: + - (guest_configure_rhsm_username | length > 0) and (guest_configure_rhsm_password | length > 0) + - (guest_configure_rhsm_activation_key | length == 0) and (guest_configure_rhsm_org_id | length == 0) -- name: Register guest with Red Hat Subscription Manager (with Activation Key) +- name: Register guest with Red Hat Subscription Manager (org_id/activation_key) community.general.redhat_subscription: - username: "{{ guest_configure_rhsm_username }}" - password: "{{ guest_configure_rhsm_password }}" + org_id: "{{ guest_configure_rhsm_org_id }}" activationkey: "{{ guest_configure_rhsm_activation_key }}" state: present - when: guest_configure_rhsm_activation_key | length > 0 + when: + - (guest_configure_rhsm_username | length == 0) and (guest_configure_rhsm_password | length == 0) + - (guest_configure_rhsm_activation_key | length > 0) and (guest_configure_rhsm_org_id | length > 0) diff --git a/roles/guest-configure/tasks/undo.yml b/roles/guest-configure/tasks/undo.yml index 22889f1..e01c95e 100644 --- a/roles/guest-configure/tasks/undo.yml +++ b/roles/guest-configure/tasks/undo.yml @@ -1,3 +1,3 @@ - name: Import Red Hat Subscription Manager unregister task ansible.builtin.import_tasks: rhsm-unregister.yml - when: (guest_configure_rhsm_username | length > 0) and (guest_configure_rhsm_password | length > 0) + when: (guest_configure_rhsm_username | length > 0) or (guest_configure_rhsm_org_id | length > 0) diff --git a/roles/guest-configure/vars/main.yml b/roles/guest-configure/vars/main.yml index 41a4bcf..77c2cac 100644 --- a/roles/guest-configure/vars/main.yml +++ b/roles/guest-configure/vars/main.yml @@ -11,3 +11,4 @@ guest_configure_services: "{{ services if services is defined }}" guest_configure_rhsm_username: "{{ redhat_user if redhat_user is defined }}" guest_configure_rhsm_password: "{{ redhat_password if redhat_password is defined }}" guest_configure_rhsm_activation_key: "{{ redhat_activation_key if redhat_activation_key is defined }}" +guest_configure_rhsm_org_id: "{{ redhat_org_id if redhat_org_id is defined }}" diff --git a/roles/libvirt/templates/kickstart/el10.ks b/roles/libvirt/templates/kickstart/el10.ks new file mode 100644 index 0000000..5a95014 --- /dev/null +++ b/roles/libvirt/templates/kickstart/el10.ks @@ -0,0 +1,51 @@ +#version=RHEL10 +text +reboot + +repo --name="AppStream" --baseurl=file:///run/install/sources/mount-0000-cdrom/AppStream + +%packages +@^server-product-environment +kexec-tools + +%end + +# Keyboard layouts +keyboard --xlayouts='us' +# System language +lang en_US.UTF-8 + +# Network information +network --bootproto=dhcp --device=enp1s0 --noipv6 --activate +network --hostname={{ libvirt_kickstart_hostname }} + +# Use CDROM installation media +cdrom + +# Run the Setup Agent on first boot +firstboot --enable + +ignoredisk --only-use=vda +autopart +# Partition clearing information +clearpart --none --initlabel + +# System timezone +timezone {{ libvirt_kickstart_timezone }} --utc + +rootpw --iscrypted {{ libvirt_kickstart_root_password | password_hash("sha512") }} + +%post +mkdir -m0700 /root/.ssh/ + +cat <<EOF >/root/.ssh/authorized_keys +{{ libvirt_kickstart_root_ssh_key }} +EOF + +chmod 0600 /root/.ssh/authorized_keys + +restorecon -R /root/.ssh/ + +{{ libvirt_kickstart_allow_root_ssh }} + +%end |
