Running a standalone scan

When we created the scan role, it was mentioned that the role should be reusable. We also added tags to the role when we defined it in the site.yml file. Let's take a quick look at how we can run just a scan outside of a full playbook run. To kick off the scan, run the following command:

$ ansible-playbook -i production --tags "scan" --extra-vars "report_name=scan-only" site.yml

This will run only the parts of the playbook that are tagged scan, and we are also overriding the report_name variable that we are setting as part of calling the role in the site.yml file to call our report box1_report_scan-only.html:

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.