Get Started with Ansible Foreman Modules
There has, evidently, been some shakeup in how to use Ansible to manage a Red Hat Satellite server.
The new way is to use the Foreman Ansible modules. I need to do so from a Red Hat 8 client, so these brief instructions are suitable for that platform. This is a quick four-step process to ensure that your Ansible installation can use the foreman modules.
First, make sure that your client machine has the EPEL package repository configured.
Second, install the necessary system packages:
sudo dnf install ansible
sudo dnf install \
http://yum.theforeman.org/client/latest/el8/x86_64/foreman-client-release.rpm
sudo dnf install ansible-collection-theforeman-foreman
Third, write a simple playbook and save it as test.yml
. You’ll
want to adjust the two variables in the vars
stanza; my sample
values are unlikely to be appropriate to your situation.
- name: Test Foreman Modules
hosts: localhost
gather_facts: false
collections:
- theforeman.foreman
vars:
certvalidate: "no"
myserver: "https://satellite.your.com"
vars_prompt:
- name: myuser
prompt: "Enter Satellite user name"
private: no
- name: mypass
prompt: "Enter password"
tasks:
- name: ping server
status_info:
server_url: '{{ myserver }}'
validate_certs: '{{ certvalidate }}'
username: '{{ myuser }}'
password: '{{ mypass }}'
Fourth, run the playbook!
ansible-playbook test.yml
This playbook doesn’t do anything useful other than verify contact with your Satellite server, but if the output ends with an ‘ok’ message, everything should be in shape to begin getting real work started.