-
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
6a33c85
commit 578f05d
Showing
1 changed file
with
27 additions
and
34 deletions.
There are no files selected for viewing
61 changes: 27 additions & 34 deletions
61
roles/foreman_provisioning/tasks/configure_ubuntu_24_04.yml
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,29 @@ | ||
- name: 'create Ubuntu 24.04' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} os info --title "Ubuntu 24.04" || | ||
{{ foreman_provisioning_hammer }} os create | ||
--name Ubuntu --major 24 --minor 04 --release-name 'artful' --architectures x86_64 --family 'Debian' --media 'Ubuntu mirror' --partition-tables 'Preseed default' | ||
- name: "Find all relevant templates" # noqa: args[module] | ||
theforeman.foreman.resource_info: | ||
resource: provisioning_templates | ||
search: name ~ "Preseed default" or name = "Linux host_init_config default" | ||
register: result | ||
|
||
- name: 'find Ubuntu 24.04' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} --output json os info --name "Ubuntu 24.04" || | ||
{{ foreman_provisioning_hammer }} --output json os info --title "Ubuntu 24.04" | ||
register: foreman_provisioning_ubuntu2404_json | ||
ignore_errors: True | ||
- name: "Ensure Ubuntu 24.04" # noqa: args[module] | ||
theforeman.foreman.operatingsystem: | ||
name: Ubuntu | ||
family: Debian | ||
major: "24.04" | ||
release_name: artful | ||
architectures: | ||
- x86_64 | ||
media: | ||
- Ubuntu mirror | ||
provisioning_templates: "{{ result.resources | map(attribute='name') }}" | ||
ptables: | ||
- Preseed default | ||
state: present | ||
password_hash: "SHA256" | ||
|
||
- name: 'get Ubuntu 24.04 info' | ||
set_fact: | ||
foreman_provisioning_ubuntu2404: "{{ foreman_provisioning_ubuntu2404_json.stdout|from_json }}" | ||
|
||
- name: 'find preseed templates' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} --output=json template list | ||
--search 'name ~ "Preseed default"' | ||
register: preseed_templates_json | ||
|
||
- name: 'set preseed templates' | ||
set_fact: | ||
preseed_templates: "{{ preseed_templates_json.stdout|from_json }}" | ||
|
||
- name: 'associate preseed templates to Ubuntu 24.04' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'Ubuntu 24.04' | ||
with_items: "{{ preseed_templates }}" | ||
|
||
- name: 'set default templates for Ubuntu 24.04' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} os set-default-template --id {{ foreman_provisioning_ubuntu2404.Id }} --provisioning-template-id {{ item.Id }} | ||
with_items: "{{ preseed_templates }}" | ||
- name: "Set default template for Ubuntu 24.04" # noqa: args[module] | ||
theforeman.foreman.os_default_template: | ||
operatingsystem: "Ubuntu 24.04" | ||
template_kind: "{{ item.template_kind_name }}" | ||
provisioning_template: "{{ item.name }}" | ||
state: present | ||
loop: "{{ result.resources | sort(attribute='name') | unique(attribute='template_kind_name') }}" |