On Mon, 26 Aug 2019 07:05:02 -0700 (PDT) Emmanuel Lacour <[email protected]> wrote: > is it possible to have some kind of way to write a custom help inside a > playbook that would be printed once (not for each host) when you issue a > command like: ansible-playbook playbooks/myplay.yml --help
No. It's not possible. Such an option "--help" will be evaluated by
"ansible-playbook".
Instead, it is possible to use tags. For example the playbook below will
print the help and stop the play "ansible-playbook myplay.yml -t help"
- hosts: all
vars:
help_only: false
tasks:
- block:
- debug:
msg: |
This is the help for this playbook. It will be printed with
the command:
ansible-playbook myplay.yml -t help
This play will stopped now.
- set_fact:
help_only: true
run_once: true
tags: [help, never]
- meta: end_play
when: help_only
- debug:
msg: Continue play.
...
Cheers,
-vlado
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/20190826163859.2f9ac113%40gmail.com.
pgplDXUIFWZVN.pgp
Description: OpenPGP digital signature
