Outils pour utilisateurs

Outils du site


tech:notes_ansible_plugins

Ceci est une ancienne révision du document !


Notes Ansible plugins

Hello world

Plugin simple en bash et dans un rôle

play-test-plugin.yml
#! /usr/bin/env ansible-playbook

- name: test plugin
  hosts: localhost

  roles:
    - plugin
    - hello
roles/plugin/library/plug1
#! /bin/bash
 
display="This is a simple bash module.."
echo -e "{\"Message\":\""$display"\"}"
roles/hello/tasks/main.yml
---

- name: test plugin plug1
  plug1:
./play-test-plugin.yml -v

Tester un module

echo -e '{ "ANSIBLE_MODULE_ARGS": { "database": "hosts"} }' | python3.6 /usr/lib/python3.6/site-packages/ansible/modules/system/getent.py |jq .
 
echo -e '{ "ANSIBLE_MODULE_ARGS": {} }' | python3 roles/plop/library/plop_check
tech/notes_ansible_plugins.1742825205.txt.gz · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki