How to add a callback-plugin to AWX docker

元气小坏坏 提交于 2020-04-30 16:37:27

问题


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.


回答1:


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 }}"


来源:https://stackoverflow.com/questions/55331878/how-to-add-a-callback-plugin-to-awx-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!