-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cd5277
commit 6a33c85
Showing
1 changed file
with
26 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,28 @@ | ||
- name: 'create Fedora 40' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} os info --title "Fedora 40" || | ||
{{ foreman_provisioning_hammer }} os create | ||
--name Fedora --major 40 --architectures x86_64 --family 'Redhat' --media 'Fedora mirror' --partition-tables 'Kickstart default' | ||
- name: "Find all relevant templates" # noqa: args[module] | ||
theforeman.foreman.resource_info: | ||
resource: provisioning_templates | ||
search: name ~ "Kickstart default" or name = "Linux host_init_config default" | ||
register: result | ||
|
||
- name: 'find Fedora 40' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} --output json os info --name "Fedora 40" || | ||
{{ foreman_provisioning_hammer }} --output json os info --title "Fedora 40" | ||
register: foreman_provisioning_fedora40_json | ||
ignore_errors: True | ||
- name: "Ensure Fedora 40" # noqa: args[module] | ||
theforeman.foreman.operatingsystem: | ||
name: Fedora | ||
family: Redhat | ||
major: 40 | ||
architectures: | ||
- x86_64 | ||
media: | ||
- Fedora mirror | ||
provisioning_templates: "{{ result.resources | map(attribute='name') }}" | ||
ptables: | ||
- Kickstart default | ||
state: present | ||
password_hash: "SHA256" | ||
|
||
- name: 'get Fedora 40 info' | ||
set_fact: | ||
foreman_provisioning_fedora40: "{{ foreman_provisioning_fedora40_json.stdout|from_json }}" | ||
|
||
- name: 'find kickstart templates' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} --output=json template list | ||
--search 'name ~ "Kickstart default"' | ||
register: kickstart_templates_json | ||
|
||
- name: 'set kickstart templates' | ||
set_fact: | ||
kickstart_templates: "{{ kickstart_templates_json.stdout|from_json }}" | ||
|
||
- name: 'associate kickstart templates to Fedora 40' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'Fedora 40' | ||
with_items: "{{ kickstart_templates }}" | ||
|
||
- name: 'set default templates for Fedora 40' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} os set-default-template --id {{ foreman_provisioning_fedora40.Id }} --provisioning-template-id {{ item.Id }} | ||
with_items: "{{ kickstart_templates }}" | ||
- name: "Set default template for Fedora 40" # noqa: args[module] | ||
theforeman.foreman.os_default_template: | ||
operatingsystem: "Fedora 40" | ||
template_kind: "{{ item.template_kind_name }}" | ||
provisioning_template: "{{ item.name }}" | ||
state: present | ||
loop: "{{ result.resources | sort(attribute='name') | unique(attribute='template_kind_name') }}" |