Hi,

> I am writing an ansible collection to configure some internal company
> tools. Inside this collection I want to have several roles. These
> roles are very similar to each other, so I want to put some shared
> utility functions and classes in some shared location. As far as I
> understand, that's what the `plugins/module_utils` directory in a
> collection is for. So here is my collection structure:
> 
> ```
> .
> ├── README.md
> └── ansible_collections
>     └── company
>         └── iam
>             ├── README.md
>             ├── docs
>             ├── galaxy.yml
>             ├── company-iam-1.0.0.tar.gz
>             ├── meta
>             │   └── runtime.yml
>             ├── playbooks
>             │   └── playbook.yml
>             ├── plugins
>             │   ├── README.md
>             │   └── module_utils
>             │       ├── api_wrapper.py
>             │       ├── synchronizer.py
>             │       └── utils.py
>             ├── roles
>             │   └── user_groups
>             │       ├── README.md
>             │       ├── defaults
>             │       │   └── main.yml
>             │       ├── files
>             │       ├── handlers
>             │       │   └── main.yml
>             │       ├── library
>             │       │   └── user_groups_sync.py

`library` (and similar directories for plugins) do not work for roles
inside collections. You need to make user_groups_sync a proper module
in the collection, i.e. put user_groups_sync.py in
ansible_collections/company/iam/plugins/modules/ and refer to it using
the FQCN `company.iam.user_groups_sync`.

Cheers,
Felix


-- 
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/20230907223210.2f2e9186%40rovaniemi.

Reply via email to