-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix foreman_provisioning role #1866
base: master
Are you sure you want to change the base?
Changes from all commits
57b6842
66ad55a
d38aefa
9dec420
4a3404b
ce85689
62cc747
0cd5277
6a33c85
578f05d
d0c74e9
605a7cf
954d5c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
- 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: "Ensure Debian 12.7" # noqa: args[module] | ||
theforeman.foreman.operatingsystem: | ||
name: Debian | ||
family: Debian | ||
major: 12 | ||
minor: 7 | ||
release_name: bookworm | ||
architectures: | ||
- x86_64 | ||
media: | ||
- Debian mirror | ||
provisioning_templates: "{{ result.resources | map(attribute='name') }}" | ||
ptables: | ||
- Preseed default | ||
state: present | ||
password_hash: "SHA256" | ||
|
||
- name: "Set default template for Debian 12.7" # noqa: args[module] | ||
theforeman.foreman.os_default_template: | ||
operatingsystem: "Debian 12.7" | ||
template_kind: "{{ item.template_kind_name }}" | ||
provisioning_template: "{{ item.name }}" | ||
state: present | ||
loop: "{{ result.resources | sort(attribute='name') | unique(attribute='template_kind_name') }}" |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,28 @@ | ||||||
- 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 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" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
- 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') }}" |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
- 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: "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: "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', reverse=True) | unique(attribute='template_kind_name') }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,20 @@ | |
- name: 'Setup CentOS 9 provisioning' | ||
import_tasks: configure_centos_9.yml | ||
|
||
- name: 'Setup Fedora 27 provisioning' | ||
import_tasks: configure_fedora_27.yml | ||
- name: 'Setup Fedora 40 provisioning' | ||
import_tasks: configure_fedora_40.yml | ||
|
||
- name: 'Setup Debian 9.3 provisioning' | ||
import_tasks: configure_debian_9_3.yml | ||
- name: 'Setup Debian 12.7 provisioning' | ||
import_tasks: configure_debian_12_7.yml | ||
|
||
- name: 'Setup Ubuntu 17.10 provisioning' | ||
import_tasks: configure_ubuntu_17_10.yml | ||
- name: 'Setup Ubuntu 24.04 provisioning' | ||
import_tasks: configure_ubuntu_24_04.yml | ||
|
||
# TODO verify - should not be needed, DNS should work just fine | ||
- name: 'set unattended_url' | ||
Check warning on line 15 in roles/foreman_provisioning/tasks/main.yml GitHub Actions / ansible-lintargs[module]
|
||
shell: > | ||
{{ foreman_provisioning_hammer }} settings set --name unattended_url --value 'http://{{ foreman_provisioning_ip_address }}' | ||
theforeman.foreman.setting: | ||
name: unattended_url | ||
value: "http://{{ foreman_provisioning_ip_address }}" | ||
|
||
- name: 'find hostgroup Base' | ||
shell: > | ||
|
@@ -37,30 +38,30 @@ | |
--name 'Base' | ||
--architecture x86_64 | ||
--domain {{ foreman_provisioning_domain }} | ||
--environment production | ||
--puppet-environment production | ||
--puppet-ca-proxy-id {{ foreman_provisioning_smart_proxy.Id }} | ||
--puppet-proxy-id {{ foreman_provisioning_smart_proxy.Id }} | ||
--subnet '{{ foreman_provisioning_network }}/24' | ||
{{ foreman_provisioning_compute_profile_option }} | ||
{{ foreman_provisioning_compute_resource_option }} | ||
--root-pass changeme | ||
--root-password changeme | ||
--pxe-loader "PXELinux BIOS" | ||
--organization '{{ foreman_provisioning_organization }}' | ||
{{ foreman_provisioning_hammer_taxonomy_params }} | ||
when: foreman_provisioning_hostgroup_base.stderr.find('not found') != -1 | ||
|
||
- name: 'find hostgroup CentOS 7' | ||
- name: 'find hostgroup CentOS 9' | ||
shell: > | ||
{{ foreman_provisioning_hammer }} hostgroup info --name 'CentOS 7 Mirror' | ||
{{ foreman_provisioning_hammer }} hostgroup info --name 'CentOS 9 Mirror' | ||
register: foreman_provisioning_hostgroup_centos_mirror | ||
ignore_errors: True | ||
|
||
- name: 'create hostgroup CentOS 7 Mirror' | ||
- name: 'create hostgroup CentOS 9 Mirror' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we replace the hammer logic with FAM here too? theforeman.foreman.hostgroup should be way easier to maintain: - name: "Ensure CentOS 9 Mirror hostgroup"
theforeman.foreman.hostgroup:
name: 'CentOS 9 Mirror'
operatingsystem: 'CentOS_Stream 9'
medium: '{{ foreman_provisioning_centos_medium_name }}'
ptable: 'Kickstart default'
parent: 'Base' Not sure how to convert And the same for the |
||
shell: > | ||
{{ foreman_provisioning_hammer }} hostgroup create | ||
--name 'CentOS 7 Mirror' | ||
--operatingsystem 'CentOS 7' | ||
--medium '{{ centos_medium_name }}' | ||
--name 'CentOS 9 Mirror' | ||
--operatingsystem 'CentOS_Stream 9' | ||
--medium '{{ foreman_provisioning_centos_medium_name }}' | ||
--partition-table 'Kickstart default' | ||
--parent 'Base' | ||
{{ foreman_provisioning_hammer_taxonomy_params }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #1888 I had a go at rewriting much of this file to also use FAM. I'd appreciate if you could take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like CentOS