{"id":18151039,"url":"https://github.com/serversideup/docker-ansible","last_synced_at":"2025-04-28T17:27:13.835Z","repository":{"id":259538829,"uuid":"867940175","full_name":"serversideup/docker-ansible","owner":"serversideup","description":"⚡️ Run Ansible anywhere with a lightweight and powerful Docker image.","archived":false,"fork":false,"pushed_at":"2025-04-21T15:35:50.000Z","size":122,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T16:36:10.937Z","etag":null,"topics":["ansible","docker"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/serversideup/ansible","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serversideup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"serversideup"}},"created_at":"2024-10-05T04:05:09.000Z","updated_at":"2025-04-21T15:35:54.000Z","dependencies_parsed_at":"2025-04-21T16:39:05.892Z","dependency_job_id":null,"html_url":"https://github.com/serversideup/docker-ansible","commit_stats":null,"previous_names":["serversideup/docker-ansible"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serversideup%2Fdocker-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serversideup%2Fdocker-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serversideup%2Fdocker-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serversideup%2Fdocker-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serversideup","download_url":"https://codeload.github.com/serversideup/docker-ansible/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251354178,"owners_count":21576148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","docker"],"created_at":"2024-11-02T01:06:13.153Z","updated_at":"2025-04-28T17:27:13.829Z","avatar_url":"https://github.com/serversideup.png","language":"Shell","funding_links":["https://github.com/sponsors/serversideup"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\t\t\u003cimg src=\"https://raw.githubusercontent.com/serversideup/docker-ansible/main/.github/img/header.png\" width=\"1280\" alt=\"Docker Images Logo\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/serversideup/docker-ansible/actions/workflows/action_publish-images-production.yml\"\u003e\u003cimg alt=\"Build Status\" src=\"https://img.shields.io/github/actions/workflow/status/serversideup/docker-ansible/.github%2Fworkflows%2Faction_publish-images-production.yml\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/serversideup/docker-ansible/blob/main/LICENSE\" target=\"_blank\"\u003e\u003cimg src=\"https://badgen.net/github/license/serversideup/docker-ansible\" alt=\"License\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/sponsors/serversideup\"\u003e\u003cimg src=\"https://badgen.net/badge/icon/Support%20Us?label=GitHub%20Sponsors\u0026color=orange\" alt=\"Support us\"\u003e\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://hub.docker.com/r/serversideup/ansible/\"\u003e\u003cimg alt=\"serversideup/ansible pulls\" src=\"https://img.shields.io/docker/pulls/serversideup/ansible?label=serversideup%2Fansible%20pulls\"\u003e\u003c/a\u003e\u003ca href=\"https://hub.docker.com/r/serversideup/ansible-core/\"\u003e\u003cimg alt=\"serversideup/ansible-core pulls\" src=\"https://img.shields.io/docker/pulls/serversideup/ansible-core?label=serversideup%2Fansible-core%20pulls\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://serversideup.net/discord\"\u003e\u003cimg alt=\"Discord\" src=\"https://img.shields.io/discord/910287105714954251?color=blueviolet\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Introduction\n`serversideup/ansible` is a lightweight solution for running Ansible in a containerized environment. This project builds upon many things we learned from [willhallonline/docker-ansible](https://github.com/willhallonline/docker-ansible). It provides a secure and isolated environment for running Ansible tasks, with support for both Alpine and Debian-based distributions and gives you the flexibility to run Ansible as an unprivileged user without the headaches of proper file permissions.\n\n## Features\n- 🐧 **Debian and Alpine** - Choose your OS\n- 🐍 **Built on official Python images** - Choose your Python version\n- 🔒 **Unprivileged user** - Choose to run as root or an unprivileged user\n- 📌 **Pinned Ansible Version** - Set your Ansible version down to the patch version\n- 🔧 **Customize your \"run as\" user** - Customize the username to run as\n- 🔑 **Set your own PUID and PGID** - Have the PUID and PGID match your host user\n- 📦 **DockerHub and GitHub Container Registry** - Choose where you'd like to pull your image from\n- 🤖 **Multi-architecture** - Every image ships with x86_64 and arm64 architectures\n\n## Usage\nGetting started is easy. Here's a few tips on how to use this image.\n\n### Choose between `ansible` and `ansible-core`\n\nOur images are available on Docker Hub and GitHub Container Registry 🥳\n\n**DockerHub:**\n- [serversideup/ansible](https://hub.docker.com/r/serversideup/ansible)\n- [serversideup/ansible-core](https://hub.docker.com/r/serversideup/ansible-core)\n\n**GitHub Container Registry:**\n- [ghcr.io/serversideup/ansible](https://github.com/serversideup/docker-ansible/pkgs/container/ansible)\n- [ghcr.io/serversideup/ansible-core](https://github.com/serversideup/docker-ansible/pkgs/container/ansible-core)\n\nVersions are made available with `ansible` and `ansible-core`. Everything is versioned appropriately according to the [Ansible release process](https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html).\n\n| Variation | Image Size | Description |\n| --------- | -------------------- | ----------- |\n| `serversideup/ansible-core` |[![DockerHub serversideup/ansible-core:alpine](https://img.shields.io/docker/image-size/serversideup/ansible-core/alpine?label=alpine)](https://hub.docker.com/r/serversideup/ansible-core/tags?name=alpine)\u003cbr\u003e[![DockerHub serversideup/ansible-core](https://img.shields.io/docker/image-size/serversideup/ansible-core/latest?label=debian)](https://hub.docker.com/r/serversideup/ansible-core) | Lightweight, core installation of Ansible. |\n| `serversideup/ansible` | [![DockerHub serversideup/ansible:alpine](https://img.shields.io/docker/image-size/serversideup/ansible/alpine?label=alpine)](https://hub.docker.com/r/serversideup/ansible/tags?name=alpine)\u003cbr\u003e[![DockerHub serversideup/ansible](https://img.shields.io/docker/image-size/serversideup/ansible/latest?label=debian)](https://hub.docker.com/r/serversideup/ansible) | \"Batteries included\" installation of Ansible. |\n\n## Image Tagging System\n\nOur Docker images use a comprehensive tagging system for flexibility and specificity.\n\n### Tag Components\n\n| Component | Example |\n|-----------|---------|\n| Ansible version | `2.17.3`, `2.17` |\n| Base OS | `alpine3.20`, `bullseye` |\n| Python version | `python3.11` |\n| OS family | `alpine`, `debian` |\n\n### Tag Examples\n\n| Tag | Meaning |\n|-----|---------|\n| `2.17.3-alpine3.20-python3.11` | Most specific |\n| `2.17.3-alpine3.20` | Latest Python for specific Ansible and OS |\n| `2.17.3` | Latest OS and Python for specific Ansible |\n| `2.17-alpine3.20-python3.11` | Latest patch for Ansible minor version |\n| `2.17-alpine-python3.11` | OS family-based |\n\n## Run a playbook\n\u003e [!IMPORTANT]  \n\u003e In almost all cases you will need to mount a volume to the Ansible \"working directory\" (default: `/ansible`) and your SSH configurations (usually `~/.ssh`).\n\n```bash\ndocker run --rm -it \\\n  -v \"$HOME/.ssh:/ssh\" \\\n  -v \"$(pwd):/ansible\" \\\n  serversideup/ansible:latest ansible-playbook playbook.yml\n```\n\n### Change the \"run as\" user, PUID and PGID\n\n```bash\ndocker run --rm -it \\\n  -v \"$HOME/.ssh:/ssh\" \\\n  -v \"$(pwd):/ansible\" \\\n  -e PUID=9999 -e PGID=9999 \\\n  -e RUN_AS_USER=bob \\\n  serversideup/ansible:latest ansible-playbook playbook.yml\n```\n\n### Run a shell\n```bash\ndocker run --rm -it \\\n  -v \"$HOME/.ssh:/ssh\" \\\n  -v \"$(pwd):/ansible\" \\\n  serversideup/ansible:latest /bin/sh\n```\n\n### Working with SSH\n\u003e [!NOTE]  \n\u003e Working with SSH keys can be tricky, especially if we're setting a `RUN_AS_USER` dynamically. We created a few things to help reduce the headache of getting this configured.\n\n#### The `/ssh` directory\nBy default, we have a `/ssh` directory that is symbolically linked from `~/.ssh`. The `/ssh` directory is used as our single source of truth for SSH keys and configurations.\n\nIf you set `RUN_AS_USER`, the entrypoint will create a home directory at `/home/${RUN_AS_USER}`, then create a symbolic link from `/home/${RUN_AS_USER}/.ssh` to `/ssh`. This gives you the power to set your `RUN_AS_USER` to anything you want without us needing to predict what user you want to run as.\n\n#### Mounting the SSH auth socket\nThe SSH auth socket is a Unix socket used by the SSH agent to communicate with other processes, allowing for secure key management. To use it with Docker, you can mount it as follows:\n\n**macOS:**\n```bash\ndocker run --rm -it \\\n  -v \"$HOME/.ssh:/ssh:ro\" \\\n  -v \"$HOME/.ssh/known_hosts:/ssh/known_hosts:rw\" \\\n  -v \"$(pwd):/ansible\" \\\n  -v \"/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock\" \\\n  -e SSH_AUTH_SOCK=\"/run/host-services/ssh-auth.sock\" \\\n  serversideup/ansible:latest ansible-playbook playbook.yml\n```\n\nNotice how we're matching the `SSH_AUTH_SOCK` to the host's socket. This is necessary for the SSH agent to communicate with the container.\n\n**Linux:**\n```bash\ndocker run --rm -it \\\n  -v \"$HOME/.ssh:/ssh:ro\" \\\n -v \"$HOME/.ssh/known_hosts:/ssh/known_hosts:rw\" \\\n  -v \"$(pwd):/ansible\" \\\n  -v \"$SSH_AUTH_SOCK:$SSH_AUTH_SOCK\" \\\n  -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK\" \\\n  serversideup/ansible:latest ansible-playbook playbook.yml\n```\n\n### Environment Variables\nYou can customize the image easily with the following environment variables:\n\n| Variable | Default | Description |\n| -------- | ------- | ----------- |\n| `PUID` | `1000` | Set the User ID that you'd like to run Ansible as |\n| `PGID` | `1000` | Set the Group ID that you'd like to run Ansible as |\n| `RUN_AS_USER` | `ansible` | The username you'd like to run Ansible as (this will be created for you and will default to an **unprivileged** user) |\n| `DEBUG` | `false` | Enable debug output of container startup |\n\n\n## Resources\n- **[DockerHub](https://hub.docker.com/r/serversideup/ansible)** to browse the images.\n- **[Discord](https://serversideup.net/discord)** for friendly support from the community and the team.\n- **[GitHub](https://github.com/serversideup/docker-ansible)** for source code, bug reports, and project management.\n- **[Get Professional Help](https://serversideup.net/professional-support)** - Get video + screen-sharing help directly from the core contributors.\n\n## Contributing\nAs an open-source project, we strive for transparency and collaboration in our development process. We greatly appreciate any contributions members of our community can provide. Whether you're fixing bugs, proposing features, improving documentation, or spreading awareness - your involvement strengthens the project. Please review our [code of conduct](./.github/code_of_conduct.md) to understand how we work together respectfully.\n\n- **Bug Report**: If you're experiencing an issue while using these images, please [create an issue](https://github.com/serversideup/docker-ansible/issues/new/choose).\n- **Feature Request**: Make this project better by [submitting a feature request](https://github.com/serversideup/docker-ansible/discussions/).\n- **Documentation**: Improve our documentation by [submitting a documentation change](./README.md).\n- **Community Support**: Help others on [GitHub Discussions](https://github.com/serversideup/docker-ansible/discussions) or [Discord](https://serversideup.net/discord).\n- **Security Report**: Report critical security issues via [our responsible disclosure policy](https://www.notion.so/Responsible-Disclosure-Policy-421a6a3be1714d388ebbadba7eebbdc8).\n\nNeed help getting started? Join our Discord community and we'll help you out!\n\n\u003ca href=\"https://serversideup.net/discord\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/themes/serversideup/images/open-source/join-discord.svg\" title=\"Join Discord\"\u003e\u003c/a\u003e\n\n## Our Sponsors\nAll of our software is free an open to the world. None of this can be brought to you without the financial backing of our sponsors.\n\n\u003cp align=\"center\"\u003e\u003ca href=\"https://github.com/sponsors/serversideup\"\u003e\u003cimg src=\"https://521public.s3.amazonaws.com/serversideup/sponsors/sponsor-box.png\" alt=\"Sponsors\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n### Black Level Sponsors\n\u003ca href=\"https://sevalla.com\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/uploads/2024/10/sponsor-image.png\" alt=\"Sevalla\" width=\"546px\"\u003e\u003c/a\u003e\n\n#### Bronze Sponsors\n\u003c!-- bronze --\u003eNo bronze sponsors yet. \u003ca href=\"https://github.com/sponsors/serversideup\"\u003eBecome a sponsor →\u003c/a\u003e\u003c!-- bronze --\u003e\n\n#### Individual Supporters\n\u003c!-- supporters --\u003e\u003ca href=\"https://github.com/GeekDougle\"\u003e\u003cimg src=\"https://github.com/GeekDougle.png\" width=\"40px\" alt=\"GeekDougle\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://github.com/JQuilty\"\u003e\u003cimg src=\"https://github.com/JQuilty.png\" width=\"40px\" alt=\"JQuilty\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003ca href=\"https://github.com/MaltMethodDev\"\u003e\u003cimg src=\"https://github.com/MaltMethodDev.png\" width=\"40px\" alt=\"MaltMethodDev\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003c!-- supporters --\u003e\n\n## About Us\nWe're [Dan](https://twitter.com/danpastori) and [Jay](https://twitter.com/jaydrogers) - a two person team with a passion for open source products. We created [Server Side Up](https://serversideup.net) to help share what we learn.\n\n\u003cdiv align=\"center\"\u003e\n\n| \u003cdiv align=\"center\"\u003eDan Pastori\u003c/div\u003e                  | \u003cdiv align=\"center\"\u003eJay Rogers\u003c/div\u003e                                 |\n| ----------------------------- | ------------------------------------------ |\n| \u003cdiv align=\"center\"\u003e\u003ca href=\"https://twitter.com/danpastori\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/uploads/2023/08/dan.jpg\" title=\"Dan Pastori\" width=\"150px\"\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://twitter.com/danpastori\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/themes/serversideup/images/open-source/twitter.svg\" title=\"Twitter\" width=\"24px\"\u003e\u003c/a\u003e\u003ca href=\"https://github.com/danpastori\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/themes/serversideup/images/open-source/github.svg\" title=\"GitHub\" width=\"24px\"\u003e\u003c/a\u003e\u003c/div\u003e                        | \u003cdiv align=\"center\"\u003e\u003ca href=\"https://twitter.com/jaydrogers\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/uploads/2023/08/jay.jpg\" title=\"Jay Rogers\" width=\"150px\"\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://twitter.com/jaydrogers\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/themes/serversideup/images/open-source/twitter.svg\" title=\"Twitter\" width=\"24px\"\u003e\u003c/a\u003e\u003ca href=\"https://github.com/jaydrogers\"\u003e\u003cimg src=\"https://serversideup.net/wp-content/themes/serversideup/images/open-source/github.svg\" title=\"GitHub\" width=\"24px\"\u003e\u003c/a\u003e\u003c/div\u003e                                       |\n\n\u003c/div\u003e\n\n### Find us at:\n\n* **📖 [Blog](https://serversideup.net)** - Get the latest guides and free courses on all things web/mobile development.\n* **🙋 [Community](https://community.serversideup.net)** - Get friendly help from our community members.\n* **🤵‍♂️ [Get Professional Help](https://serversideup.net/professional-support)** - Get video + screen-sharing support from the core contributors.\n* **💻 [GitHub](https://github.com/serversideup)** - Check out our other open source projects.\n* **📫 [Newsletter](https://serversideup.net/subscribe)** - Skip the algorithms and get quality content right to your inbox.\n* **🐥 [Twitter](https://twitter.com/serversideup)** - You can also follow [Dan](https://twitter.com/danpastori) and [Jay](https://twitter.com/jaydrogers).\n* **❤️ [Sponsor Us](https://github.com/sponsors/serversideup)** - Please consider sponsoring us so we can create more helpful resources.\n\n## Our products\nIf you appreciate this project, be sure to check out our other projects.\n\n### 📚 Books\n- **[The Ultimate Guide to Building APIs \u0026 SPAs](https://serversideup.net/ultimate-guide-to-building-apis-and-spas-with-laravel-and-nuxt3/)**: Build web \u0026 mobile apps from the same codebase.\n- **[Building Multi-Platform Browser Extensions](https://serversideup.net/building-multi-platform-browser-extensions/)**: Ship extensions to all browsers from the same codebase.\n\n### 🛠️ Software-as-a-Service\n- **[Bugflow](https://bugflow.io/)**: Get visual bug reports directly in GitHub, GitLab, and more.\n- **[SelfHost Pro](https://selfhostpro.com/)**: Connect Stripe or Lemonsqueezy to a private docker registry for self-hosted apps.\n\n### 🌍 Open Source\n- **[AmplitudeJS](https://521dimensions.com/open-source/amplitudejs)**: Open-source HTML5 \u0026 JavaScript Web Audio Library.\n- **[Spin](https://serversideup.net/open-source/spin/)**: Laravel Sail alternative for running Docker from development → production.\n- **[Financial Freedom](https://github.com/serversideup/financial-freedom)**: Open source alternative to Mint, YNAB, \u0026 Monarch Money.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserversideup%2Fdocker-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserversideup%2Fdocker-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserversideup%2Fdocker-ansible/lists"}