Ansible stdout Formatting

后端 未结 4 2161
终归单人心
终归单人心 2021-02-14 01:03

Assuming the below tasks:

shell: \"some_script.sh\" register: \"some_script_result\"

debug: msg: \"Output: {{ some_script_result.stdout_li

4条回答
  •  我寻月下人不归
    2021-02-14 01:53

    I was trying do the following changes, still i did not got the output format of yaml or debug options output properly. Later i found the ansible user configuration pick up it from user's config file. So i changed callbacks at user specific location and it worked.

    [automation@ansibleserver ~]$ ansible --version
       ansible 2.9.9
       config file = /home/automation/ansible.cfg
    
    
    # Use the YAML callback plugin.
       stdout_callback = yaml
    # Use the stdout_callback when running ad-hoc commands.
    bin_ansible_callbacks = True
    

    So ensure, even though you changed at /etc/ansible/ansible.conf , try at user's config file too to get the good result. instead of yaml , debug also gives good helpful format ( for linux users)

提交回复
热议问题