Table des matières

, ,

Notes Ansible plugins

Créer ses plugins

Voir :

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