Advertisement
alexander_bazhenov

Untitled

Mar 24th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. ---
  2. - hosts: 127.0.0.1
  3. connection: local
  4. gather_facts: true
  5.  
  6. tasks:
  7. - name: Block task
  8. block:
  9. - name: Do nothing
  10. ansible.builtin.shell: exit 1
  11. rescue:
  12. - name: Rescue tasks
  13. ansible.builtin.debug:
  14. msg: "Rescue task done."
  15. always:
  16. - name: Always task
  17. ansible.builtin.debug:
  18. msg: "Always task done."
  19.  
  20.  
  21. 2.10:
  22.  
  23.  
  24. PLAY [127.0.0.1] ***********************************************************************************************************************
  25.  
  26. TASK [Gathering Facts] *****************************************************************************************************************
  27. ok: [127.0.0.1]
  28.  
  29. TASK [Do nothing] **********************************************************************************************************************
  30. fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "exit 1", "delta": "0:00:00.002001", "end": "2024-03-25 01:49:50.398914", "msg": "non-zero return code", "rc": 1, "start": "2024-03-25 01:49:50.396913", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
  31.  
  32. TASK [Rescue tasks] ********************************************************************************************************************
  33. ok: [127.0.0.1] => {
  34. "msg": "Rescue task done."
  35. }
  36.  
  37. TASK [Always task] *********************************************************************************************************************
  38. ok: [127.0.0.1] => {
  39. "msg": "Always task done."
  40. }
  41.  
  42. PLAY RECAP *****************************************************************************************************************************
  43. 127.0.0.1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=1 ignored=0
  44.  
  45.  
  46. 2.9: не поддерживает FQCN и хочет просто shell иначе:
  47.  
  48. ERROR! this task 'ansible.builtin.shell' has extra params, which is only allowed in the following modules: import_role, win_shell, command, include, win_command, import_tasks, include_role, script, include_vars, add_host, group_by, raw, shell, include_tasks, meta, set_fact
  49.  
  50. The error appears to be in '/home/gitlab-runner/playbook.yml': line 9, column 11, but may
  51. be elsewhere in the file depending on the exact syntax problem.
  52.  
  53. The offending line appears to be:
  54.  
  55. block:
  56. - name: Do nothing
  57. ^ here
  58.  
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement