aws community edition and collection

aws modules have been redirected/moved to two different repositories, some to community.aws and some to amazon.aws

https://github.com/ansible-collections/amazon.aws

https://github.com/ansible-collections/community.aws

My first question is, what was the criteria for moving each modules to different repositories ? so we know the correct place to submit future aws modules !!! is there a change log for this move ?

My second question is for those with more experience with Ansible and github:
isn’t better to make the amazon.aws plugin directory be the sub repository/sub module/fork or mirror of community.aws plugin directory ? this way modules and plugins version and code stay the same in both, while one will be used as collection and one as module !!!

Thanks

Largely the split was done between what was previously “core” supported and what was community supported.

amazon.aws is supported by Red Hat/Ansible employees, and community.aws is technically supported by the community.

New modules/plugins should almost definitely be submitted to community.aws, and if it is deemed it should be supported, it can be moved at a later date.

Thank you for quick reply.

What is the procedure to install Ansible version 10 along with amazon.aws and community.aws

I was able to install Ansible version 10 from repository:
pip install git+https://github.com/ansible/ansible.git

but getting error installing modules from community.aws:
pip install git+https://github.com/ansible-collections/community.aws.git

community.aws.git does not have all required files to be installable by pip.

Thanks

Collections are not pip installable.

Instead you want to do:

pip install https://github.com/ansible/ansible/archive/devel.tar.gz
ansible-galaxy collection install amazon.aws

Thank you Matt, that worked, eventhough the collection is behind the github repository.

Any recommendation or guidance on setting up development environment will be highly appreciated.
I did follow below document to set up development environment, but considering changes in ansible repository structure, not applicable for community modules any more:
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#common-environment-setup

The only option that I can think of:
pip install https://github.com/ansible/ansible/archive/devel.tar.gz

git clone https://github.com/ansible-collections/community.aws.git

cp community.aws/plugins/modules/my_module.py ~/.ansible/plugins/modules/

edit ~/.ansible/plugins/modules/my_module.py and then copy it back to git repository to commit and push.

Any elegant solution ?
How you guys at ansible have setup the development environment to develop amazon.aws ?

Thanks

You've identified one of the many annoying parts of collections. You need a special directory structure and you can't install from git in an editable manner. There's no equivalent to `ansible-galaxy install -gr requirements.yml` that gives you a git repo you can edit and push and pull. You'll further find it difficult to type `ansible -m community.general.my_module ...` using the very long name versus the short name you've always used before.

V/r,
James Cassell

You’ve identified one of the many annoying parts of collections. You need a special directory structure and you can’t install from git in an editable manner.

Admittedly you are right about the special directory structure but it’s pretty trivial to install it from git in an editable manner. I do this for the Windows collections;

`

Usually I have this in my ~/.bashrc where the last segment is my dev location

export ANSIBLE_COLLECTIONS_PATHS=~/.ansible/collections:/usr/share/ansible/collections:~/ansible-dev
git clone git@github.com:ansible-collections/ansible.windows.git ~/ansible-dev/ansible_collections/ansible/windows

`

I won’t lie and say this is a perfect scenario but it’s just 2 commands, one of which can be set automatically in your profile.

Hi,

Thank you Matt, that worked, eventhough the collection is behind the
github repository.

Any recommendation or guidance on setting up development environment
will be highly appreciated.
I did follow below document to set up development environment, but
considering changes in ansible repository structure, not applicable
for community modules any more:
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#common-environment-setup

that documentation is for Ansible 2.9. Until 2.10 has been released,
the devel docs are usually more helpful.

You might also be interested in
https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html
whose last section describes how to set up collections for development.

Cheers,
Felix

Thank you Jordan, Those two lines saved me lots of time.
I am using virtualenvwrapper, so I set the ANSIBLE_COLLECTIONS_PATHS in virtual environment’s postactivate, which it is going to set any time switching to ansible-dev environment.

First cloned ansible_collections/community/aws, then had to clone ansible_collections/amazon/aws when got module not found error when tried to test the module through ansible-playbook.

Eventually we have to create more directories and clone respected collections, as we are working on more modules, and that would be nice if we had ansible-galaxy-dev command to clone the collection from github along its dependencies at once(Like what James suggested).

Moving to collections is improvement for sure, thanks very much.

Created a new module in “~/ansible_dev/ansible_collections/community/aws/plugins/modules”, but neither ansible-playbook nor ansible-doc finds the new module. for the sake of test, copied a module to new name, to make sure it is not related to module content, and original module can be found, but not the new one.

ansible-doc -t module testing_module

Checking collections development document:

https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html

but can’t find any thing about adding a new module.

What am I missing ?

Thanks

You have to use the FQCN of the module, at least for ansible-doc: community.aws.testing_module

Thank you Matt, adding FQDN of the module fixed the problem either in playbook or ansible-doc command line.

How is that existing modules can be found just with their name but not the new one ?
There is action_groups.yml in meta directory, but adding testing_module to it didn’t make any difference.

That is controlled by lib/ansible/config/ansible_builtin_runtime.yml

It is designed to only allow modules which shipped with Ansible previously, to work without needing to use the FQCN for backwards compatibility.