From a98617f9ca6e97fdb49f200794b2ab42311bc916 Mon Sep 17 00:00:00 2001 From: Raphael Dannecker Date: Tue, 25 Mar 2025 07:29:13 +0100 Subject: [PATCH] Add documentation for custome_roles --- doc/custom_roles.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 doc/custom_roles.md diff --git a/doc/custom_roles.md b/doc/custom_roles.md new file mode 100644 index 0000000..0513288 --- /dev/null +++ b/doc/custom_roles.md @@ -0,0 +1,42 @@ +# Custom roles + +- Custom ansible roles can be stored in `roles/custom` +- To include custom roles into, you can list them in `custom_roles`. + +## Example + +``` +roles/custom/ +├── role_a +│   └── tasks +│   └── main.yml +├── role_b +│   └── tasks +│   └── main.yml +└── role_c + └── tasks + └── main.yml +``` + +inventory.yml + +```yaml +all: + vars: + custom_roles: + - role_a + - role c +desktops: + hosts: + 10.0.2.[1:128]: +laptops: + hosts: + 10.0.32.[1:50]: + vars: + custom_roles: + - role_a + - role_b +``` + +All hosts (e.g. 10.0.2.14) will get `role_a` and `role_c`, +but hosts in group laptop (e.g. 10.0.32.14) will get `role_a` and `role_b`