ansible icon indicating copy to clipboard operation
ansible copied to clipboard

Role is not idempotent in CI

Open robpou opened this issue 4 months ago • 1 comments

The collection's roles (so _common/install.yml in general) use a cache directory for the downloads and download the binaries to this directory on the controller node, before propagating them to the inventory hosts.

This means when running in a CI pipeline, the plays for creating the local cache path and downloading/unpacking the binary will always count as changes, hence the role is not idempotent.

Am I overlooking something? PR #499 could help by at least letting the inventory hosts perform the problematic steps, but it's been abandoned and that also wouldn't work with /tmp, but sure one could take a different local cache path e.g. /opt etc.

Could something like

changed_when: (lookup('env', 'CI', default='false') | bool) | ternary(false, omit)

help for these tasks or nah? (Prob not)

robpou avatar Sep 02 '25 09:09 robpou

You should probably set your cache directory to a persistent volume to avoid that...

gardar avatar Nov 21 '25 02:11 gardar