Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Check Mode #84

Merged
merged 1 commit into from
Jun 5, 2024
Merged

Support Check Mode #84

merged 1 commit into from
Jun 5, 2024

Conversation

simensen
Copy link
Contributor

@simensen simensen commented Jun 4, 2024

The uri module does not support Check Mode. This means any playbook run in Check Mode will fail if Composer has not been installed previously.

The error looks like this:

The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'content'. 'dict object' has no attribute 'content'

The object in question is composer_installer_signature. It is empty/undefined since the "Get Composer installer signature." task isn't executed in Check Mode.

By adding check_mode: false to the uri call, this will signal that it should run in check mode to satisfy the composer_installer_signature dependency for the "Download Composer installer." task.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html#attribute-check_mode

The `uri` module does not support Check Mode. This means any playbook run in Check Mode will fail if Composer has not been installed previously.

The error looks like this:

> The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'content'. 'dict object' has no attribute 'content'

The object in question is `composer_installer_signature`. It is empty/undefined since the "Get Composer installer signature." task isn't executed in Check Mode.

By adding `check_mode: false` to the `uri` call, this will signal that it should run in check mode to satisfy the `composer_installer_signature` dependency for the "Download Composer installer." task.

https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html#attribute-check_mode
@simensen
Copy link
Contributor Author

simensen commented Jun 4, 2024

@simensen
Copy link
Contributor Author

simensen commented Jun 4, 2024

My bad for the multiple comments. I think this will be the last for a while. :)

For some context, our team has a CI pipeline for its playbooks. One of the stages checks to ensure that the playbook can be run in Check Mode against a snapshot of a known current state. When we introduced this role, that CI process failed, even though we could run it normally just fine. It will continue to fail until the known current state snapshot already has Composer installed.

@geerlingguy geerlingguy merged commit 7adeca4 into geerlingguy:master Jun 5, 2024
1 of 4 checks passed
@simensen simensen deleted the patch-1 branch June 5, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants