Hello!
Id like to know how useful using a logger with awx is and what does those logs contain?
Im trying to get the logging with ELK Stack but until now i didnt get any logs there.
Is there a suggestion for a “simple” tool?
Thank you!
I’ve been using ARA for the last few years and I like it a lot
@rfc2549 is the main developer of it and he wrote a blog post on how to hook it up to AWX a while ago: Recording Ansible playbooks from AWX with ara | ARA Records Ansible | ara.recordsansible.org
Yeah it looks fine - i will test it tomorrow - the docs are quite good compared to ELK - they dont have an menu part with ansible and couldnt find any docs
Hello!
Do you use ara with awx or ansible?
I found a collection at anssible galaxy that installs the ara logger, but i dont get how to add those into an AWX setup or if its just for Ansible?
I do both
Here’s the ansible.cfg
config required:
[ara]
api_client = http
api_server = http://localhost:8000
#api_username = user
#api_password = password
api_timeout = 15
ignored_facts = '["ansible_env", "ansible_all_ipv4_addresses"]'
ignored_arguments = '["extra_vars", "vault_password_files"]'
Here are the config items I had to add to AWX/AAP Controller under ‘Job settings’ → ‘Extra Environment variables’ and ‘Ansible Callback plugins’
AWX_ANSIBLE_CALLBACK_PLUGINS:
- '/usr/local/lib/python3.9/site-packages/ara/plugins/callback'
AWX_TASK_ENV:
ARA_API_CLIENT: "http"
ARA_API_SERVER: "{{ ara_api_server }}"
ARA_API_USERNAME: "{{ ara_api_username }}"
ARA_API_PASSWORD: "{{ ara_api_password }}"
ARA_RECORD_CONTROLLER_NAME: "{{ ansible_automation_controller_fqdn }}"
ARA_RECORD_USER: "False"
I run ARA on the commandline controlnode, so it uses localhost, but I have it protected with a reverse proxy that allows password-protected access for remote controlnodes (such as AWX/AAP).
Also, I use this collection to install it on my controlnode (which I am a contributor for ): GitHub - ansible-community/ara-collection: Collection of Ansible roles for ARA Records Ansible.
do i copy the collection to my git and use it like this?
I discovered im a little misinformed how to use those collections from ansible.galaxy - my chatgpt tells me to install them like you would do vie ansible-galaxy command, but thats not correct as far as i can tell…
I added the text but get an error - with and without using or { }
The ansible config comes in the “root” of the project folder i think.
The only left is how to execute the playbook?
the bot suggests:
---
- name: Example playbook using recordsansible.ara
hosts: all
roles:
- recordsansible.ara
but how does this know where to lookup - i added a role folder in my git anf after adding playbooks i cant see them in the web gui so i could add them to a template - is there something behind the scene tat looks this Roles folder up and i have just to use those role names in may playbooks and here again how could i name them?
Thank you very much for your Help im rather new (around Half a year) in AWX - and there are still some basic understandings missing here and there where the webz and…chtgpt doesnt have a clue or misinform me.
That’s because those variables in my case are set with Ansible, so you’ll need to replace them with the actual values
okay time to add some more envs - still get the same error .
I added those:
extra_vars:
ara_api_server: '{{ ara_api_server }}'
ara_api_password: '{{ ara_api_password }}'
ara_api_username: '{{ ara_api_username }}'
and added an entry
Thank you!
So there’s a few things you need:
- The collection installed in your project
ansible-galaxy collection install recordsansible.ara
- A playbook to install ARA, assuming you want to install it on the ansible control node
---
- name: 'Install ARA'
hosts: 'localhost'
roles:
- 'recordsansible.ara.ara_api'
- Inventory for the
localhost
host:
---
###
# ARA settings
###
ara_api_fqdn: "{{ ansible_facts['fqdn'] }}"
ara_api_time_zone: 'Europe/Amsterdam'
- Afterwards, you can configure
ansible.cfg
with what I mentioned earlier. And your AWX variables will be (again, assuming no encryption/authentication)
AWX_ANSIBLE_CALLBACK_PLUGINS:
- '/usr/local/lib/python3.9/site-packages/ara/plugins/callback'
AWX_TASK_ENV:
ARA_API_CLIENT: "http"
ARA_API_SERVER: "http://ansible.example.nl"
ARA_RECORD_CONTROLLER_NAME: "awx.example.nl"
ARA_RECORD_USER: "False"
Okay - i thought with awx i put my roles etc. @my git synced via project and new “functions” via custom execution enviroments.
So if im correct in my case - after copying my install_ara to roles and then the playbook would look like this?
---
- name: 'Install ARA'
hosts: 'localhost'
roles:
- 'install_ara'
I thought that those colections from ansible galaxy would be added via an certiain Execution enviroment.
Thank you!
No, not really, recordsansible.ara
is a collection, so it’s packaged differently compared to a role (because it contains roles). This also means that Ansible expects the code to be in a different spot, compared to where roles are located.
And, if you’re using AWX to install it, also take in account that you then must target a different node then localhost
. If you don’t you’ll be installin ARA inside the EE container, which, by it’s nature, is ephemeral and will disappear when the job is done. (and update your ara_server
value accordingly)
So i create a folder with “exampleawa_sertup” and then add the ansible config file and the playbook:
---
- name: 'Install ARA'
hosts: '{{ ara_api_server }}'
roles:
- 'recordsansible.ara.ara_api'
The task looks good, but remember {{ }}
are variables, unless you have defined them somewhere in the inventory, you need to define what values they have before using them.
And I’m pretty sure you cannot define hosts:
with a Jinja variable
whats a jinja var?
I used env variables in the host list before…
I get :
ERROR! the role 'recordsansible.ara.ara_api' was not found in /runner/project/functions/install_ara/roles:/runner/requirements_roles:/runner/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/runner/project/functions/install_ara
The error appears to be in '/runner/project/functions/install_ara/install_ara.yaml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
Jinja2 is the templating engine used in Ansible to render all variables, you can recognize them by the {{ }}
or {% %}
(for ones that contain for/if/etc logic)
Did you add the collection to your projects requirements.yml
? You should also tell AWX to update project dependencies before running the code
Okay i need to add the git to a project - okay now i have a big mysery solved how the files get to the awx - time to celebrate i got now ho i can add those funny features from galay. anible !!!