Skip to content

Instantly share code, notes, and snippets.

@dmsimard
Last active March 23, 2022 00:51
Show Gist options
  • Save dmsimard/8c77ea6db405fbf7b11e8f78f8818afb to your computer and use it in GitHub Desktop.
Save dmsimard/8c77ea6db405fbf7b11e8f78f8818afb to your computer and use it in GitHub Desktop.
include_role runner_on_ok
$ ansible-playbook failed.yml || echo $?
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
2022-03-22 20:40:05,541 DEBUG ara.plugins.callback.default: v2_playbook_on_start
PLAY [Reproducer that fails] ****************************************************************************************************************************************************************************************************************************
2022-03-22 20:40:05,592 DEBUG ara.plugins.callback.default: v2_playbook_on_play_start
TASK [Include a role that does not exist] ***************************************************************************************************************************************************************************************************************
2022-03-22 20:40:05,741 DEBUG ara.plugins.callback.default: v2_playbook_on_task_start
2022-03-22 20:40:05,767 DEBUG ara.plugins.callback.default: v2_runner_on_start
2022-03-22 20:40:05,776 DEBUG ara.plugins.callback.default: v2_runner_on_ok
ERROR! the role 'does_not_exist' was not found in /home/dmsimard/dev/sandbox/include_role/roles:/home/dmsimard/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/dmsimard/dev/sandbox/include_role
The error appears to be in '/home/dmsimard/dev/sandbox/include_role/failed.yml': line 7, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
include_role:
name: does_not_exist
^ here
PLAY RECAP **********************************************************************************************************************************************************************************************************************************************
2022-03-22 20:40:05,843 DEBUG ara.plugins.callback.default: v2_playbook_on_stats
2 # <-- Exit code 2 (non-zero)
- name: Reproducer that fails
hosts: localhost
gather_facts: false
tasks:
- name: Include a role that does not exist
include_role:
name: does_not_exist
$ ansible-playbook successful.yml || echo $?
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
2022-03-22 20:38:43,314 DEBUG ara.plugins.callback.default: v2_playbook_on_start
PLAY [Reproducer that does not fail] ********************************************************************************************************************************************************************************************************************
2022-03-22 20:38:43,357 DEBUG ara.plugins.callback.default: v2_playbook_on_play_start
TASK [A successful task] ********************************************************************************************************************************************************************************************************************************
2022-03-22 20:38:43,448 DEBUG ara.plugins.callback.default: v2_playbook_on_task_start
2022-03-22 20:38:43,469 DEBUG ara.plugins.callback.default: v2_runner_on_start
ok: [localhost] => {
"msg": "Hello o/"
}
2022-03-22 20:38:43,480 DEBUG ara.plugins.callback.default: v2_runner_on_ok
TASK [Include a role that does not exist] ***************************************************************************************************************************************************************************************************************
2022-03-22 20:38:43,566 DEBUG ara.plugins.callback.default: v2_playbook_on_task_start
2022-03-22 20:38:43,609 DEBUG ara.plugins.callback.default: v2_runner_on_start
2022-03-22 20:38:43,617 DEBUG ara.plugins.callback.default: v2_runner_on_ok
ERROR! the role 'does_not_exist' was not found in /home/dmsimard/dev/sandbox/include_role/roles:/home/dmsimard/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/dmsimard/dev/sandbox/include_role
The error appears to be in '/home/dmsimard/dev/sandbox/include_role/successful.yml': line 11, column 15, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
include_role:
name: does_not_exist
^ here
PLAY RECAP **********************************************************************************************************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
2022-03-22 20:38:43,693 DEBUG ara.plugins.callback.default: v2_playbook_on_stats
2 # <-- Exit code 2 (non-zero)
- name: Reproducer that does not fail
hosts: localhost
gather_facts: false
tasks:
- name: A successful task
debug:
msg: Hello o/
- name: Include a role that does not exist
include_role:
name: does_not_exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment