hacker342
@hacker342
Like Linux

Как создать плагин для Ansible на Python?

Необходимо создать плагин для Ansible на Python. Но в официальной документации не могу понять как создавать плагины для ansible.
Структура моя:
roles/test_tasks/main.yml - в ней описана роль
Файл run.yml в нем: описны хосты, роли.
Я создал так же папку library и написал код на Python. Но при запуске playbook, не запускается мой модуль.
Как его зарегестрировать или запустить?
  • Вопрос задан
  • 164 просмотра
Решения вопроса 1
@q2digger
никого не трогаю, починяю примус
Документация

Ansible loads plugins automatically too, loading each type of plugin separately from a directory named for the type of plugin. Here’s the full list of plugin directory names:

action_plugins*
cache_plugins
callback_plugins
connection_plugins
filter_plugins*
inventory_plugins
lookup_plugins
shell_plugins
strategy_plugins
test_plugins*
vars_plugins
To load your local plugins automatically, create or add them in any of these locations:

any directory added to the relevant ANSIBLE_plugin_type_PLUGINS environment variable (these variables, such as $ANSIBLE_INVENTORY_PLUGINS and $ANSIBLE_VARS_PLUGINS take colon-separated lists like $PATH)
the directory named for the correct plugin_type within ~/.ansible/plugins/ - for example, ~/.ansible/plugins/callback
the directory named for the correct plugin_type within /usr/share/ansible/plugins/ - for example, /usr/share/ansible/plugins/action
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы