diff --git a/roles/foreman_provisioning/tasks/configure_centos_9.yml b/roles/foreman_provisioning/tasks/configure_centos_9.yml index 611087920..adfac4856 100644 --- a/roles/foreman_provisioning/tasks/configure_centos_9.yml +++ b/roles/foreman_provisioning/tasks/configure_centos_9.yml @@ -1,3 +1,9 @@ +- 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: "Ensure CentOS Stream 9" # noqa: args[module] theforeman.foreman.operatingsystem: name: CentOS_Stream @@ -7,15 +13,16 @@ - x86_64 media: - CentOS Stream 9 mirror - provisioning_templates: - - Kickstart default + provisioning_templates: "{{ result.resources | map(attribute='name') }}" ptables: - Kickstart default state: present + password_hash: "SHA256" - name: "Set default template for CentOS Stream 9" # noqa: args[module] theforeman.foreman.os_default_template: operatingsystem: "CentOS_Stream 9" - template_kind: "provision" - provisioning_template: "Kickstart default" + template_kind: "{{ item.template_kind_name }}" + provisioning_template: "{{ item.name }}" state: present + loop: "{{ result.resources | sort(attribute='name') | unique(attribute='template_kind_name') }}"