Skip to content

Commit

Permalink
Get the list of templates from the server
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Dec 3, 2024
1 parent f13ab54 commit 3e5bc56
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions roles/foreman_provisioning/tasks/configure_centos_9.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
- name: 'Set templates fact'
set_fact:
templates:
- kind: 'host_init_config'
name: 'Linux host_init_config default'
- kind: 'provision'
name: 'Kickstart default'
- kind: 'PXEGrub'
name: 'Kickstart default PXEGrub'
- kind: 'PXEGrub2'
name: 'Kickstart default PXEGrub2'
- kind: 'PXELinux'
name: 'Kickstart default PXELinux'
- kind: 'finish'
name: 'Kickstart default finish'
- kind: 'iPXE'
name: 'Kickstart default iPXE'
- kind: 'user_data'
name: 'Kickstart default user data'
- name: "Find all relevant templates"

Check warning on line 1 in roles/foreman_provisioning/tasks/configure_centos_9.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

args[module]

missing required arguments: password, server_url, username

Check warning on line 1 in roles/foreman_provisioning/tasks/configure_centos_9.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

args[module]

missing required arguments: password, server_url, username
theforeman.foreman.resource_info:
resource: provisioning_templates
search: name ~ "Kickstart default" or name = "Linux host_init_config default"
register: result

- name: "Ensure CentOS Stream 9" # noqa: args[module]
theforeman.foreman.operatingsystem:
Expand All @@ -27,16 +13,16 @@
- x86_64
media:
- CentOS Stream 9 mirror
provisioning_templates: "{{ templates | map(attribute='name') }}"
provisioning_templates: "{{ result.resources | map(attribute='name') }}"
ptables:
- Kickstart default
state: present
password_hash: "SHA256"

- name: "Set default templates for CentOS Stream 9" # noqa: args[module]
- name: "Set default template for CentOS_Stream 9" # noqa: args[module]
theforeman.foreman.os_default_template:
operatingsystem: "CentOS_Stream 9"
template_kind: "{{ item.kind }}"
template_kind: "{{ item.template_kind_name }}"
provisioning_template: "{{ item.name }}"
state: present
loop: "{{ templates }}"
loop: "{{ result.resources | sort(attribute='name') | unique(attribute='template_kind_name') }}"

0 comments on commit 3e5bc56

Please sign in to comment.