# Logging useful?

**URL:** <https://forum.ansible.com/t/logging-useful/7127>\
**Category:** Get Help\
**Tags:** awx\
**Created:** [July 8, 2024, 9:32am UTC](https://forum.ansible.com/t/logging-useful/7127 "2024-07-08T09:32:17Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 8, 2024, 9:32am UTC](https://forum.ansible.com/t/logging-useful/7127/1 "2024-07-08T09:32:17Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 8, 2024, 11:21am UTC](https://forum.ansible.com/t/logging-useful/7127/2 "2024-07-08T11:21:29Z")

</div>

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](https://ara.recordsansible.org/blog/2021/12/23/recording-ansible-playbooks-from-awx-with-ara/)

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 8, 2024, 12:24pm UTC](https://forum.ansible.com/t/logging-useful/7127/3 "2024-07-08T12:24:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 10, 2024, 6:47am UTC](https://forum.ansible.com/t/logging-useful/7127/4 "2024-07-10T06:47:32Z")

</div>

Hello!  
Do you use ara with awx or ansible?

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 10, 2024, 7:17am UTC](https://forum.ansible.com/t/logging-useful/7127/5 "2024-07-10T07:17:52Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 10, 2024, 8:36am UTC](https://forum.ansible.com/t/logging-useful/7127/6 "2024-07-10T08:36:05Z")

</div>

I do both 🙂

Here’s the `ansible.cfg` config required:

```auto
[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’

```auto
  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.](https://github.com/ansible-community/ara-collection/)

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 10, 2024, 9:57am UTC](https://forum.ansible.com/t/logging-useful/7127/7 "2024-07-10T09:57:05Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 10, 2024, 2:06pm UTC](https://forum.ansible.com/t/logging-useful/7127/8 "2024-07-10T14:06:35Z")

</div>

> [@Thulium-Drake](#):
>
> ```auto
> 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"
> 
> ```

 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/8/8a41b31d68346d5e64cdd7207fd092dd8b12261c.png)

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:

```auto
---
- 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.

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 10, 2024, 2:12pm UTC](https://forum.ansible.com/t/logging-useful/7127/9 "2024-07-10T14:12:30Z")

</div>

That’s because those variables in my case are set with Ansible, so you’ll need to replace them with the actual values 🙂

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 10, 2024, 2:34pm UTC](https://forum.ansible.com/t/logging-useful/7127/10 "2024-07-10T14:34:13Z")

</div>

okay time to add some more envs - still get the same error .

I added those:

```auto
extra_vars:
  ara_api_server: '{{ ara_api_server }}'
  ara_api_password: '{{ ara_api_password }}'
  ara_api_username: '{{ ara_api_username }}'

```

and added an entry

 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/4/42ebf9cbd309b780102db540807443b35d1d3475.png)  
Thank you!

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 11, 2024, 9:19am UTC](https://forum.ansible.com/t/logging-useful/7127/11 "2024-07-11T09:19:34Z")

</div>

So there’s a few things you need:

- The collection installed in your project

```auto
ansible-galaxy collection install recordsansible.ara

```

- A playbook to install ARA, assuming you want to install it on the ansible control node

```auto
---
- name: 'Install ARA'
  hosts: 'localhost'
  roles:
    - 'recordsansible.ara.ara_api'

```

- Inventory for the `localhost` host:

```auto
---
###
# 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)

```auto
  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"

```

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 11, 2024, 11:26am UTC](https://forum.ansible.com/t/logging-useful/7127/12 "2024-07-11T11:26:41Z")

</div>

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?

 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/3/39dc3330cc061b72a166f91c9837cbb8d4b81e76.png)

```auto
---
- 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!

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 11, 2024, 11:41am UTC](https://forum.ansible.com/t/logging-useful/7127/13 "2024-07-11T11:41:39Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 11, 2024, 12:19pm UTC](https://forum.ansible.com/t/logging-useful/7127/14 "2024-07-11T12:19:13Z")

</div>

So i create a folder with “exampleawa\_sertup” and then add the ansible config file and the playbook:

```auto
---
- name: 'Install ARA'
  hosts: '{{ ara_api_server }}'
  roles:
    - 'recordsansible.ara.ara_api'

```

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 12, 2024, 6:15pm UTC](https://forum.ansible.com/t/logging-useful/7127/15 "2024-07-12T18:15:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 18, 2024, 12:35pm UTC](https://forum.ansible.com/t/logging-useful/7127/16 "2024-07-18T12:35:14Z")

</div>

whats a jinja var?  
I used env variables in the host list before…  
I get :

```auto
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.

```

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [July 19, 2024, 9:05am UTC](https://forum.ansible.com/t/logging-useful/7127/17 "2024-07-19T09:05:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [July 19, 2024, 9:20am UTC](https://forum.ansible.com/t/logging-useful/7127/18 "2024-07-19T09:20:40Z")

</div>

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 !!!
