Skip to content

Conversation

@alextreme
Copy link
Member

@alextreme alextreme commented Oct 10, 2025

Fixes #42

Copy link
Collaborator

@SilviaAmAm SilviaAmAm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation on porting to the new version says:

docker_container - the purge_networks option has been removed. Use networks: strict in comparisons instead and make sure that networks is specified (https://github.com/ansible-collections/community.docker/pull/971).

So I think that we should also add:

comparisons:
  networks: strict

In https://github.com/maykinmedia/ansible-collection/blob/main/roles/django_app_docker/templates/django-container.yml.j2 (at the end of the file)

@alextreme
Copy link
Member Author

comparisons:
  networks: strict

In https://github.com/maykinmedia/ansible-collection/blob/main/roles/django_app_docker/templates/django-container.yml.j2 (at the end of the file)

Done, I wasn't 100% sure what this does

@alextreme alextreme requested a review from SilviaAmAm October 15, 2025 10:29
@alextreme
Copy link
Member Author

Discussed: lets try to make this conditional so that it still works for Ansible 10

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#ansible-version

Assumption is that purge_networks shouldn't be used with ansible-core 2.18 or newer, and that networks: strict already exists for older ansibles (but this it to be verified!)

ansible==10.7.0
ansible-core==2.17.14

@alextreme
Copy link
Member Author

@SilviaAmAm purge_networks is now conditional depending on the ansible version, I've tried it on ansible 10 and it seems to work but please doublecheck

network_mode: "{{ django_app_docker_name_prefix }}"
purge_networks: true
networks_cli_compatible: true
{% if ansible_version.major == 2 and ansible_version.minor <= 10 %}purge_networks: true{% endif %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitate 🤔 I had locally 2.17.14 for the ansible-core version in commonground-deployment, so then I would be missing this.

Since we don't specify in all repo specific ansible version requirements, maybe we should make all the upgrades for newer ansible versions in one go and then update all the repositories 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this the idea, that you would only have purge_networks for older ansible-core versions?

ansible-core 2.10 is more or less ancient ( https://endoflife.date/ansible-core ) however I noticed that the Sjoerd-repo's still explicitly state installing ansible==10.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

purge_networks is removed in modern Ansible versions

3 participants