Upgrade Playbooks
You’ll find Spotter to become your best friend when dealing with Ansible upgrades. It checks if your playbooks are compatible with the latest Ansible version, advises you on what to do to avoid breaking them and helps you speed up the upgrade itself using the rewrite function and other features. To learn more about how to use Spotter to speed up and simplify Ansible upgrades,
watch this webinar
or this
short demo
.
> spotter scan playbook.yml
playbook.yml:8:3: ERROR: [E903] Use a fully-qualified name, such as ansibbuiltin.pip instead
of pip.
playbook.yml:17:3: ERROR: [E903] Use a fully-qualified name, such ansible.builtin.shell
instead of shell.
playbook.yml:34:3: ERROR: [E903] Ua fully-qualified name, such as
community.crypto.x509_certificate instead of openssl_certificatspan>. View docs at https://
docs.steampunk.si/plugins/community/crypto/latest/module/x509_certificate.html.
playbook.yml:34:HINT: [H1900] Required collection community.crypto is missing from
requirements.yml or requirements.yml is missing.
playboyml:41:3: ERROR: [E903] Use a fully-qualified name, such as
community.crypto.x509_certificate> instead ofopenssl_certificate . View docs at https://
docs.steampunk.si/plugins/community/crypto/latest/module/x509_certificate.ht
playbook.yml:41:3: HINT: [H1900] Required collection community.crypto is missing from
requirements.yml or requirements.yml missing.
playbook.yml:47:3: ERROR: [E903] Use a fully-qualified name, such as ansible.builtin.template instead of template.
playbook.yml:54:3: ERROR: [E903] Use a fully-qualified name, such as ansibbuiltin.template
instead of template.
playbook.yml:54:3: HINT: [H805] For module templatconsider explicitly using the mode
parameter as a best practice.------------------------------------------------------------------------
Spotter took 0.215 s to scan your input. It resulted in6 error(s), 0 warning(s) and 3 hint(s).
Overall status: ERROR >
Check Compatibility with Specific Ansible Version
To see if your playbook is compatible with a specific Ansible version, use the--ansible-version
argument and add the version you want Spotter to scan against. You can also set the target version using a configuration file.
Note
Scan in full profile mode (spotter scan –profile-full) to run all upgrades related checks. Learn more about using scan profiles .
So, to check if your playbook is compatible with Ansible 2.15 and which issues you need to fix to make it compatible, run:
spotter scan --profile full --ansible-version 2.15 playbook.yml
Copied!Unify Version of Ansible Collections
Another helpful feature Spotter offers when dealing with Ansible upgrades is the Inputs report, which you can find on the Reporting tab. There you can see all the versions of the collections and modules you’re using. If you see that you’re using different versions of the same Ansible Collection, you can identify the most recent and highest quality one and upgrade your playbook to include only one version to optimize and unify your playbooks, further increasing your efficiency.