Alex_Krug
Alex_Krug

Reputation: 427

How to add a callback-plugin to AWX docker

Installed AWX docker from here - https://github.com/ansible/awx. I am trying to add a callback-plugin for a specific project as written here - https://docs.ansible.com/ansible-tower/latest/html/administration/tipsandtricks.html#using-callback-plugins-with-tower. Does not work. I add to Template-> EXTRA VARIABLES lines

---
bin_ansible_callbacks: true
callback_plugins: /callback_plugins
stdout_callback: selective

Does not work.

I add the directory /var/lib/awx/projects/test/callback_plugins/ to SETTINGS-> JOBS-> ANSIBLE CALLBACK PLUGINS - it doesn't work either.

Tell me, please, how to do it correctly, so that another (custom) plugin picks up and earns.

Upvotes: 1

Views: 2661

Answers (2)

energenious
energenious

Reputation: 59

seems like you have to use callbacks_enabled instead of callback_plugins. put this example configuration in the /var/lib/awx/ansible.cfg file:

[defaults]
callback_whitelist = profile_tasks

--- works on AWX 17.x

Upvotes: 1

Pierre GINDRAUD
Pierre GINDRAUD

Reputation: 11

I'm issuing the same problem, after some debugs the problem I've open a issue on AWX project https://github.com/ansible/awx/issues/4149

In the meantime I've applied a workaround that consists in create a symlinks for each callback plugin you want to use in the callback_plugins folder of your roles project

For example, if you are using the ara project

    - name: Research for callbacks in virtualenv libs
      find:
        path: '{{ ansible_playbook_python|dirname|dirname }}/{{ item }}'
        file_type: file
        depth: 1
        patterns: '*.py'
        excludes: '__init__*'
      register: _internal__callbacks
      with_items:
        - lib/python3.6/site-packages/ara/plugins/callbacks

# TODO : prevent existing callbacks to be overwritten

    - name: Create symlinks from virtualenv lib directory to local callback_plugins/
      file:
        src: '{{ item }}'
        dest: '{{ playbook_dir }}/callback_plugins/{{ item|basename }}'
        state: link
      with_items: "{{ _internal__callbacks.results|map(attribute='files')|flatten|map(attribute='path')|list }}"

Upvotes: 1

Related Questions