Ansible Pull Configuration to get the status of each node

Hello Everyone,

I want to know is there any configuration available in ansible so that we can track the status of playbook for each node while using ansible-pull.

I want to run ansible-pull for 100 of nodes, and if ansible pull not work for some of the node, so that I want to capture the status of each node in master or we can say in the ansible control server. I am using the below command to run the ansible pull, it is working no issue on that but somewhere I want to capture the status of each node in master or ansible control server so that I can use this for audit purpose.

ansible-pull -U [git_url] --inventory=hosts -k hello_ansible_pull.yml -vvvvv --limit remote_host1-remote_host2

Looking forward for reply.

Thanks & Regards
Sumit Sahay
7044112109

So there is not 'official' way to do this as `ansible-pull` runs w/o a
'controller', it just needs a 'source of playbooks'. It is normally
git, but could basically be anything.

The simplest setup, if you are already using cron, is to use it's mail
to facility or aggregate it's logs.

You could change your setup to have a centralized controller via
Awx/Tower and trigger play runs via it's 'host callback' mechanism.
this would have a fully centralized execution and reporting on all
your plays.

Another option is to use Ansible callback plugins, which can integrate
easily with other tools to do this. They enable you to send playbook
output to many different services (log aggregation, metrics
monitoring, ARA, etc).

Hi Brian,

As of now I am storing the status as log, as I am not getting any configuration to get the status of the playbook for each node.
Below are the module I am using to store the status of the playbook.

  • name: store the information in local
    lineinfile:
    dest: /tmp/status_files/status-{{ inventory_hostname }}.log
    line: ‘{{ inventory_hostname }} status of {{ inventory_hostname }} is failed={{rc.failed}} and changed={{rc.changed}}’
    create: yes
    insertafter: EOF
    state: present
    #register: line
    delegate_to: localhost

Regards
Sumit Sahay
07044112109

that will only store the status of a task, you need to use a callback
to store the whole playbook.