streda 9. februára 2022

How to enable logs in ansible?

logs in ansible:






- comment out in configuration file ansible


- (in my configuration file: 111 line)




[root@localhost ~]# cat -n  /etc/ansible/ansible.cfg  | grep -in /var/log

111:   111      log_path = /var/log/ansible.log

[root@localhost ~]# sed -n 111p /etc/ansible/ansible.cfg

log_path = /var/log/ansible.log

[root@localhost ~]#


I commented out line 111 and we see logs:





[root@localhost ~]# ll /var/log/ans*

-rw-r--r--. 1 root root 883 Feb  7 17:07 /var/log/ansible.log

[root@localhost ~]#

[root@localhost ~]# cat /var/log/ansible.log

2022-02-07 17:06:36,078 p=32026 u=root n=ansible |   hosts (3):

2022-02-07 17:06:36,078 p=32026 u=root n=ansible |     10.0.2.8

2022-02-07 17:06:36,079 p=32026 u=root n=ansible |     10.0.2.7

2022-02-07 17:06:36,079 p=32026 u=root n=ansible |     10.0.2.6

2022-02-07 17:07:22,222 p=32033 u=root n=ansible | 10.0.2.6 | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/usr/bin/python"

    },

    "changed": false,

    "ping": "pong"

}

2022-02-07 17:07:22,233 p=32033 u=root n=ansible | 10.0.2.7 | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/usr/bin/python"

    },

    "changed": false,

    "ping": "pong"

}

2022-02-07 17:07:22,240 p=32033 u=root n=ansible | 10.0.2.8 | SUCCESS => {

    "ansible_facts": {

        "discovered_interpreter_python": "/usr/bin/python"

    },

    "changed": false,

    "ping": "pong"

}

[root@localhost ~]#


Žiadne komentáre:

Zverejnenie komentára