Ansible stdout Formatting

后端 未结 4 2152
终归单人心
终归单人心 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:35

    Another option:

    https://blog.alexgittings.com/improving-the-ansible-output-with-anstomlog/

    just store it inside ansible/ansible.cfg

    ➜ tree ansible     
    ansible
    ├── ansible.cfg
    ├── callbacks
    │   ├── anstomlog.py
    └── playbooks
        └── nginx.yaml
    
    
    ANSIBLE_CONFIG=ansible/ansible.cfg ansible-playbook -u centos --private-key .ssh/key -i `terraform output bastion_ip`, ansible/playbooks/nginx.yaml
    

提交回复
热议问题