Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible-pull support ? #193

Closed
eoli3n opened this issue Dec 3, 2020 · 6 comments
Closed

ansible-pull support ? #193

eoli3n opened this issue Dec 3, 2020 · 6 comments
Milestone

Comments

@eoli3n
Copy link

eoli3n commented Dec 3, 2020

I configure 800 hosts with a 400 tasks playbook, so i'm using ansible-pull script : https://docs.ansible.com/ansible/latest/cli/ansible-pull.html

I can configure ara callback plugin to send logs through http, but in live demo i can not found any field to filter "source" host.
Will you implement ability to see and query host log source ?

@dmsimard
Copy link
Contributor

dmsimard commented Dec 3, 2020

Hi @eoli3n !

ara should "just work" with ansible-pull but let us know if you encounter any issues.

There is no equivalent implementation in the web frontend yet but filtering by host is supported by the API (i.e, https://api.demo.recordsansible.org/api/v1/hosts?name=localhost) as well as the CLI:
Screenshot from 2020-12-03 09-58-48

There is a WIP patch to implement a "host index" (as opposed to the current playbook index) that I have not had the chance to complete: https://review.opendev.org/c/recordsansible/ara/+/682778

@eoli3n
Copy link
Author

eoli3n commented Dec 3, 2020

Thanks

It would be great if ara could handle natively source host, it would answer to 2 cases:

  • ansible-pull, every hosts will send logs as
    source: client hostname
    playbook hosts: localhost
  • multiple ansible server will send logs as
    source: server hostname
    playbook hosts: pattern

An extra filter in playbooks web ui view could do that.

As we said on IRC, I will try to use labels to filter source hosts as a first workaround, with extra-vars pass to ansible-pull:

ansible-pull [...] -e "ara_playbook_labels='source_host:$(hostname -f)'"

@dmsimard
Copy link
Contributor

dmsimard commented Dec 4, 2020

Yes, that's a good idea 👍

I have a WIP patch that works for saving the controller hostname here: https://review.opendev.org/c/recordsansible/ara/+/765434

Feel free to review and try it out in a virtualenv or something like that:

git clone https://github.com/ansible-community/ara
cd ara
git fetch "https://review.opendev.org/recordsansible/ara" refs/changes/34/765434/2 && git checkout FETCH_HEAD
pip install .[server]
# it adds sql migrations that are run automatically by the callback, otherwise:
ara-manage migrate

Then run the playbook with the callback enabled and you'll find something like this:
Screenshot from 2020-12-03 23-51-45

Mine is localhost because I'm funny and my laptop's FQDN is "localhost" but it should work if you have a real hostname :)

Searching by controller works so you can do /api/v1/playbooks?controller=hostname and we can add support for it in the CLI too. Need to add a search field in the UI for it as well.

@eoli3n
Copy link
Author

eoli3n commented Dec 4, 2020

My user is "user" so i guess we are the same kind 🤡
Thanks, I test it soon !

@dmsimard
Copy link
Contributor

dmsimard commented Dec 4, 2020

Updated the patch to include tests, the CLI and the UI search implementation:
Screenshot from 2020-12-04 10-06-30

@dmsimard dmsimard added this to the 1.5.4 milestone Dec 18, 2020
@dmsimard
Copy link
Contributor

This will land in 1.5.4 that I am preparing for release early next week.

dmsimard added a commit to dmsimard/ara that referenced this issue Mar 18, 2021
The controller fqdn that ran the playbook is now recorded and can be
searched for both in the UI and the CLI.

Fixes: ansible-community#193
Change-Id: I53e8d158fc3b6ba7a16582234aaa2542eab5fcdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants