- Galaxy API + tarball bursts: collection installs hammer HTTPS and extract to the same cache tree, colliding when two jobs share a home directory.
- Git role depth and LFS: requirements.yml entries that clone large histories or miss shallow settings exhaust disk and SSH channel budgets before your playbook even starts.
- Forks versus latency: raising
forkslooks heroic until every task multiplies round trips across regions and triggers SSHtimeoutstorms on shared Apple Silicon runners.
Dual source decision: Galaxy collections vs Git roles
Galaxy collections ship as packaged artifacts with server metadata; they suit vendor-supported content and Automation Hub style governance. Git-sourced roles skip index propagation delays, pin exact commits, and ride the same mirror or relay policy you already use for application repositories.
| Signal | Favor Galaxy collections | Favor Git roles (requirements.yml src: git) |
|---|---|---|
| Compliance wants signed tarballs | Yes—pair with private Galaxy or Hub | Only if you add commit signing review |
| Index or CDN blocked regionally | Risky unless you mirror Galaxy | Often faster via enterprise Git mirror |
| Rapid fork churn | Slower refresh | Point version: at SHA tags |
| Disk on shared Mac pool | Centralize collections_paths |
Use shallow clones + per-job TMPDIR |
Combine both deliberately: keep first-party collections on Galaxy (or Hub) while parking long-tail community roles in Git with immutable refs. That avoids repeating generic “Git acceleration only” guidance and matches how Ansible resolves dependencies in 2026.
Executable parameter table (ansible.cfg, env, shell)
Values target a shared remote Mac CI agent. Dedicated single-tenant runners can move toward the higher end of forks and xargs -P after you measure SSH success rates.
| Where to set | Parameter | Suggested starting value | Operational note |
|---|---|---|---|
ansible.cfg [defaults] |
forks |
6 shared Mac; 12–16 dedicated host | Parallelism across inventory hosts, not Galaxy threads; lower when facts + gather run cross-region. |
ansible.cfg [defaults] |
timeout |
45 (seconds) cross-border; 30 same metro | SSH/persistent connection budget; raise before chasing Galaxy slowness. |
ansible.cfg [defaults] |
retry_files_enabled |
False in CI | Prefer CI-level rerun; avoids stale .retry artifacts on shared disks. |
ansible.cfg [defaults] |
collections_paths |
./collections:~/.ansible/collections |
Workspace-first so ansible-galaxy collection install -p ./collections resolves predictably. |
ansible.cfg [defaults] |
roles_path |
./roles:./ansible/roles |
Keep CI installs under repo-relative trees for cache keys. |
ansible.cfg [galaxy] |
server_list / server_url |
Hub first, then community Galaxy | Match corporate ansible-galaxy token injection order. |
ansible.cfg [galaxy] |
cache_dir |
/usr/local/ci/ansible-galaxy-cache (NVMe) |
Shared read cache across jobs on one runner user; pair with file lock or stagger jobs. |
| Shell export (job preamble) | TMPDIR |
/usr/local/ci/tmp/${CI_JOB_ID:-local} |
Isolates temp tar unpack; replace prefix with your orchestrator’s unique id. |
| Shell export | ANSIBLE_LOCAL_TEMP |
${TMPDIR}/ansible-local |
Keeps module remote tmp off networked home directories. |
| Shell export | ANSIBLE_COLLECTIONS_PATHS |
./collections |
Mirrors cfg; export when runners lack a checked-in ansible.cfg. |
| Concurrent pulls | xargs -P over split requirement stubs |
3–4 concurrent ansible-galaxy children |
Shards large manifests; cap lower than CPU count to protect disk queue depth. |
| Failure backoff | shell loop sleep | 2s, 4s, 8s (three attempts) | Wrap ansible-galaxy collection install -r … and role installs identically. |
Example preamble (bash):
export TMPDIR="/usr/local/ci/tmp/${CI_JOB_ID:-$$}/ansible"
mkdir -p "$TMPDIR" "${TMPDIR}/galaxy-cache" ./collections ./roles
export ANSIBLE_LOCAL_TEMP="${TMPDIR}/local"
export ANSIBLE_COLLECTIONS_PATHS="$(pwd)/collections"
export ANSIBLE_CONFIG="$(pwd)/ci/ansible.cfg"
Example ci/ansible.cfg fragment:
[defaults]
forks = 6
timeout = 45
retry_files_enabled = False
collections_paths = ./collections:~/.ansible/collections
roles_path = ./roles:./ansible/roles
[galaxy]
cache_dir = /usr/local/ci/ansible-galaxy-cache
server_list = automation_hub, release_galaxy
Galaxy + roles retry wrapper:
for i in 1 2 3; do
ansible-galaxy collection install -r collections/requirements.yml -p ./collections && \
ansible-galaxy role install -r roles/requirements.yml -p ./roles && break
sleep $((2 ** i))
done
Git roles: shallow clones and playbook hints
Ansible’s Git module and role installer honor transport tuning indirectly. Prefer explicit version: SHAs in requirements.yml, keep ansible-galaxy role install pointed at -p ./roles, and align runner GIT_SSL_NO_VERIFY policy with security rather than flipping it ad hoc. For broader clone and Docker layer guidance on the same runners, reuse patterns from the remote Mac Git and Docker pull acceleration guide and the pull stability FAQ.
Acceptance checklist before merging CI changes
collections/requirements.yml and role requirements; pin Git SHAs for anything security sensitive.TMPDIR, ANSIBLE_LOCAL_TEMP, and [galaxy] cache_dir live on NVMe, not synced network home.forks and xargs -P; watch for SSH timeout spikes.ansible-core minor version when wiring GitHub Actions or GitLab cache volumes.FAQ
Should roles come from Galaxy namespaces or straight Git URLs? Galaxy gives packaged metadata; Git avoids index lag. Mix: collections from Hub, edge roles from Git SHAs.
Why do parallel ansible-galaxy installs collide on shared Macs? Shared default cache and temp paths cause lock contention; isolate per job with TMPDIR and explicit cache directories.
Does raising forks always speed up CI? No—forks multiply control connections; under cross-border RTT, moderate values plus healthy timeout outperform extreme fan-out.
Summary
Treat Galaxy and Git roles as two pull classes with separate cache, retry, and concurrency policies. Keep forks realistic on shared remote Mac pools, bound ansible-galaxy parallelism, and always pair installs with 2/4/8 second backoff. When job queues grow, renting or upgrading to additional Apple Silicon nodes restores headroom faster than endlessly raising forks on a saturated host.
No-login next steps: homepage, pricing, purchase, help center, technical blog.
Dual-source Ansible CI succeeds when Galaxy tarballs and Git clones never fight for the same temp inode budget—give each path its directory, its retry loop, and its cache key.