1

I have a folder called roles and what I need is to get a set of all ansible modules used. When ansible parses playbooks and roles it gets modules to run. Maybe someone know how to parse role and get only modules from it? For example if I have role: roles |-test |-tasks |-main.yml

- name: Download and unarchive 
  unarchive:
  ....
- name: Install
  package:
  ....

after parsing this folser the output should be: ("unrchive", "package")

  • So regarding "_How to parse ... and get only modules from it?_", there is currently no such function build-in in Ansible. Maybe [`ansible-lint`](https://github.com/ansible/ansible-lint) and [Linting Playbooks and Roles](https://ansible-lint.readthedocs.io/en/latest/usage/#linting-playbooks-and-roles) could be used for it. To do so, [rules](https://github.com/ansible/ansible-lint/tree/main/src/ansiblelint/rules) would need to be applied. – U880D May 17 '22 at 16:42
  • Since your question sounds similar to looking for [a method for listing Ansible modules used by playbooks](https://stackoverflow.com/a/72280961/6771046) for me, you might find the answer or at least hints there now. – U880D Jun 02 '22 at 17:55

0 Answers0