ansible-for-kubernetes icon indicating copy to clipboard operation
ansible-for-kubernetes copied to clipboard

Prepare for Ansible 2.10 and new Kubernetes Collection

Open geerlingguy opened this issue 5 years ago • 6 comments

I've been working on the Ansible Kubernetes Collection for a bit, and in Ansible 2.10, it will become the source of the k8s-related modules and plugins.

As such, there are a few parts of the book (and probably a number of playbooks) which should be tweaked to include the consumption and use of the community.kubernetes kubernetes.core collection.

Even though some of the modules that were in Ansible <= 2.9 may be included in a new Ansible distribution and work similar to how they did in older versions, all the examples in the book should directly consume the community.kubernetes kubernetes.core collection, to minimize surprises.

There may be other things that need to change, e.g. consuming the new aws collection (when it becomes available) for the AWS-related examples—and same goes for GCP and any other non-core collections.

geerlingguy avatar Feb 16 '20 04:02 geerlingguy

Related in other book: https://github.com/geerlingguy/ansible-for-devops/issues/202

geerlingguy avatar Feb 16 '20 04:02 geerlingguy

And a blog post about it: The Kubernetes Collection for Ansible.

geerlingguy avatar Feb 18 '20 15:02 geerlingguy

Looking deeper into Ansible 2.10 and the 'ACD' (Ansible Community Distribution), which is what will be installed if you run pip install ansible, it looks like the way everything works will be the same, though I'm not yet certain if additional new modules will be able to be routed to the right place (e.g. new modules like k8s_exec, k8s_log, or coming helm modules...).

See the collection 'tombstoning/redirection' PR for some progress: https://github.com/ansible/ansible/pull/67684

geerlingguy avatar Apr 17 '20 02:04 geerlingguy

@geerlingguy I am very thankful for all your continuing work on this great book. However I feel that readers would benefit from example on how to make a role dependant on the collection installed. I.e. I am using community.general.pear: to manage pear modules and this is a part of my php role. Do you need to let role have "Dependency: collection xyz" in meta/main.yml? Sorry if asking something obvious.

alitvak69 avatar Aug 16 '20 05:08 alitvak69

@alitvak69 - That is a more general question that you'd probably want to ask in #ansible-devel in IRC or in the Ansible Project google group. Note that dependencies between roles and/or collections can be very difficult, and will likely not be supported (instead, you'll have to tell users to install the collection alongside your role in a requirements.yml file or something like that).

Also note that Ansible will still have modules like pear available in the next release (even without specifying the collection) if you install with pip install ansible.

geerlingguy avatar Aug 31 '20 03:08 geerlingguy

Thank you for your reply. All work on the pear module has been shifted to collections. So the latest feature / bug fix I needed had only been released in community collections. A module with the same name in both places sounds really bad especially if one of them would have an outdated code.

alitvak69 avatar Aug 31 '20 15:08 alitvak69