Interview Prep/Ansible/Roles, Collections and Galaxy

How do you scaffold a new role?

BeginnerConceptRoles, Collections and Galaxy
Answer
ansible-galaxy role init roles/nginx

This creates the directory skeleton with README.md, meta/main.yml and empty main.yml files. Inside a collection use ansible-galaxy role init --init-path roles nginx. Delete empty directories you do not use so the role stays readable. For a new collection use ansible-galaxy collection init myorg.platform.

All Ansible questions Roadmap: Ansible

More on Roles, Collections and Galaxy