ansible-playbook inline help

Dear ansible users,

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

Nice, thank you very much !