Scan role

Now that we have the OpenSCAP packages installed, we can create a role that performs the scan:

$ ansible-galaxy init roles/scan

As already mentioned, we will be reusing this role throughout the playbook, which presents us with an easily resolved problem. By default, even if you define the role several times, Ansible will only execute a role once during a playbook run. To allow the role to execute more than once, we need to add the following line to the top of the roles/scan/meta/main.yml file:

allow_duplicates: true

This instructs Ansible to execute this one role multiple times during the playbook run. Next up, we need to add some variables to the group_vars/common.yml file. These key values will be shared across all of the roles ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.