Skip to content

Commit

Permalink
Add CentOS Stream 9 provisioning using theforeman.foreman modules
Browse files Browse the repository at this point in the history
This PR refactors the CentOS Stream 9 provisioning tasks by replacing
Hammer CLI commands with theforeman.foreman Ansible modules.
  • Loading branch information
archanaserver committed Sep 19, 2024
1 parent 316b107 commit 9f12d3b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions playbooks/foreman_provisioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
become: true
vars:
libvirt_tftp: true
module_defaults:
group/theforeman.foreman.foreman:
username: admin
password: changeme
server_url: "https://localhost/"
validate_certs: false
roles:
- foreman
- libvirt
Expand Down
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
collections:
- name: https://github.com/theforeman/foreman-ansible-modules.git
type: git

- name: https://github.com/theforeman/foreman-operations-collection
type: git

Expand Down
21 changes: 21 additions & 0 deletions roles/foreman_provisioning/tasks/configure_centos_9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: "Ensure CentOS Stream 9" # noqa: args[module]
theforeman.foreman.operatingsystem:
name: CentOS_Stream
family: Redhat
major: 9
architectures:
- x86_64
media:
- CentOS Stream 9 mirror
provisioning_templates:
- Kickstart default
ptables:
- Kickstart default
state: present

- 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"
state: present
2 changes: 1 addition & 1 deletion roles/foreman_provisioning/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
- name: 'Setup CentOS 7 provisioning'
import_tasks: configure_centos_7.yml
import_tasks: configure_centos_9.yml

- name: 'Setup Fedora 27 provisioning'
import_tasks: configure_fedora_27.yml
Expand Down

0 comments on commit 9f12d3b

Please sign in to comment.