How to debug Ansible issues?

后端 未结 7 1938
滥情空心
滥情空心 2020-12-08 04:26

Sometimes, ansible doesn\'t do what you want. And increasing verbosity doesn\'t help. For example, I\'m now trying to start coturn server, which co

7条回答
  •  不知归路
    2020-12-08 05:12

    You could use register module, and debug module to print the return values. For example, I want to know what is the return code of my script execution called "somescript.sh", so I will have my tasks inside the play such as:

    - name: my task
      shell: "bash somescript.sh"
      register: output
    
    - debug:
      msg: "{{ output.rc }}"
    

    For full return values you can access in Ansible, you can check this page: http://docs.ansible.com/ansible/latest/common_return_values.html

提交回复
热议问题