Ansible Pull Configuration to get the status of each node

57 views
Skip to first unread message

SUMIT SAHAY

unread,
Aug 31, 2018, 3:16:14 AM8/31/18
to Ansible Project
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

Brian Coca

unread,
Aug 31, 2018, 11:36:46 AM8/31/18
to Ansible Project
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).



----------
Brian Coca

SUMIT SAHAY

unread,
Sep 3, 2018, 2:50:47 AM9/3/18
to Ansible Project
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

Brian Coca

unread,
Sep 4, 2018, 9:07:24 AM9/4/18
to Ansible Project
that will only store the status of a task, you need to use a callback
to store the whole playbook.


--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages