In this tutorial, we will learn to ignore the warning message in ansible logs
While working with ansible playbooks, we will get some annoying warning message which makes us uncomfortable.
Below is the useful code snippet to get rid of ansible warning logs
args:
warn: false
Example
---
- name: Network Getting Started First Playbook
gather_facts: false
hosts: all
tasks:
- name: Download java file from github using curl
shell: curl https://github.com/rkumar9090/BeginnersBug/blob/master/BegineersBug/src/com/geeks/example/AddDaysToDate.java --output sample.java
args:
warn: false
Output
PLAY [Network Getting Started First Playbook] ********************************************************************************************************
TASK [Download java file from github using curl] *****************************************************************************************************
PLAY RECAP *******************************************************************************************************************************************
127.0.01 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Previous Output
PLAY [Network Getting Started First Playbook] ********************************************************************************************************
TASK [Download java file from github using curl] *****************************************************************************************************
[WARNING]: Consider using the get_url or uri module rather than running 'curl'. If you need to use command because get_url or uri is insufficient
you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
PLAY RECAP *******************************************************************************************************************************************
127.0.01 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Command
ansible-playbook first_playbook.yml
Related Articles
Ignore Error in Ansible playbook