Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- - name: Test any errors fatal
- hosts: all
- any_errors_fatal: True
- tasks:
- - include: roles/test/tasks/main.yaml
- ---
- - set_fact:
- test: "test value"
- when: "inventory_hostname == groups.all.0"
- - shell: "echo {{ test }}"
- - debug:
- msg: "This should never be reached"
- === DEMO ===
- PLAY [Test any errors fatal] ******************************************************************************************************
- TASK [Gathering Facts] ************************************************************************************************************
- ok: [192.168.2.247]
- ok: [192.168.2.248]
- ok: [192.168.2.249]
- ok: [192.168.2.245]
- ok: [192.168.2.246]
- TASK [set_fact] *******************************************************************************************************************
- ok: [192.168.2.248]
- TASK [command] ********************************************************************************************************************
- fatal: [192.168.2.249]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'test' is undefined\n\nThe error appears to have been in '/jirotech/ansible-postgresql/test_include.yaml': line 5, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n when: \"inventory_hostname == groups.all.0\"\n- shell: \"echo {{ test }}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
- fatal: [192.168.2.246]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'test' is undefined\n\nThe error appears to have been in '/jirotech/ansible-postgresql/test_include.yaml': line 5, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n when: \"inventory_hostname == groups.all.0\"\n- shell: \"echo {{ test }}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
- fatal: [192.168.2.245]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'test' is undefined\n\nThe error appears to have been in '/jirotech/ansible-postgresql/test_include.yaml': line 5, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n when: \"inventory_hostname == groups.all.0\"\n- shell: \"echo {{ test }}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
- fatal: [192.168.2.247]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'test' is undefined\n\nThe error appears to have been in '/jirotech/ansible-postgresql/test_include.yaml': line 5, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n when: \"inventory_hostname == groups.all.0\"\n- shell: \"echo {{ test }}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
- changed: [192.168.2.248]
- TASK [debug] **********************************************************************************************************************
- ok: [192.168.2.248] => {
- "changed": false,
- "msg": "This should never be reached"
- }
- to retry, use: --limit @/root/.ansible-retry/test.retry
- PLAY RECAP ************************************************************************************************************************
- 192.168.2.245 : ok=1 changed=0 unreachable=0 failed=1
- 192.168.2.246 : ok=1 changed=0 unreachable=0 failed=1
- 192.168.2.247 : ok=1 changed=0 unreachable=0 failed=1
- 192.168.2.248 : ok=4 changed=1 unreachable=0 failed=0
- 192.168.2.249 : ok=1 changed=0 unreachable=0 failed=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement