Setup Ansible control node
To set up an Ansible control node, execute the following steps from the SUSE Manager Web UI.
-
In the SUSE Manager Web UI, navigate to , verify that
SUSE Linux Enterprise Server 15 SP5 x86_64andSUSE Manager Client Tools for SLE 15 x86_64are selected and synchronized. -
Deploy a SUSE Linux Enterprise Server 15 SP5 client.
-
In the SUSE Manager Web UI, navigate to the page of the client. Select and subscribe the client to the
SUSE Linux Enterprise Server 15 SP5 x86_64andSUSE Manager Client Tools for SLE 15 x86_64channels.The SUSE Manager client tools contain the
ansiblepackage. -
Select of your client. From the
Add-On System Typeslist enableAnsible Control Nodeand click Update Properties. -
Navigate to the client overview page, select , and click Apply Highstate.
-
Select the Events tab and verify the status of the highstate.
1. Install the SCAP security guide package
For executing remediations you need to install the SCAP security guide package on the Ansible control node.
-
From , select the client. Then click .
-
Search for
scap-security-guideand install the package suitable for your system. See the following table for package distribution requirements:Table 1. SCAP security guide package requirements Package name Supported Systems scap-security-guide
openSUSE, SLES12, SLES15
scap-security-guide-redhat
CentOS 7, CentOS 8, Fedora, Oracle Linux 7, Oracle Linux 8, RHEL7, RHEL8, RHEL9, Red Hat OpenStack Platform 10, Red Hat OpenStack Platform 13, Red Hat Virtualization 4, Scientific Linux
scap-security-guide-debian
Debian 9, Debian 10
scap-security-guide-ubuntu
Ubuntu 16.04. Ubuntu 18.04, Ubuntu 20.04
2. Create Ansible inventory files
Ansible Integration tools deploy a playbook as an inventory file. Create one inventory file for each operating system listed in Table 1.
-
Create and add your hosts to an inventory file to be managed by Ansible. The default path for an Ansible inventory is
/etc/ansible/hosts.Listing 1. Inventory Exampleclient240.mgr.example.org client241.mgr.example.org client242.mgr.example.org client243.mgr.example.org ansible_ssh_private_key_file=/etc/ansible/some_ssh_key [mygroup1] client241.mgr.example.org client242.mgr.example.org [mygroup2] client243.mgr.example.org [all:vars] ansible_ssh_private_key_file=/etc/ansible/my_ansible_private_key
-
In the SUSE Manager Web UI, from the
Ansibletab navigate to to add inventory files to the control node. -
Under the
Playbook Directoriessection add/usr/share/scap-security-guide/ansibleto theAdd a Playbook Directoriesfield and click Save. -
Under
Inventory Filesadd your inventory file locations to theAdd an Inventory filefield and click Save.Listing 2. Examples/etc/ansible/sles15 /etc/ansible/sles12 /etc/ansible/centos7
For additional playbook examples, see https://github.com/ansible/ansible-examples.
3. Establish communication with the Ansible nodes
-
Create the SSH keys that you are using in your inventory.
ssh-keygen -f /etc/ansible/my_ansible_private_key
-
Copy the generated SSH keys to the Ansible managed clients. Example:
ssh-copy-id -i /etc/ansible/my_ansible_private_key root@client240.mgr.example.org
-
Declare the private key in
/etc/ansible/ansible.cfgas follows:private_key_file = /etc/ansible/my_ansible_private_key
Replace
my_ansible_private_keywith the name of the file containing the private key. -
Test that Ansible is working by executing the following commands from the control node:
ansible all -m ping ansible mygroup1 -m ping ansible client240.mgr.example.org -m ping
You may now run remediations.
For more information, see Compliance as code.