{"id":26383292,"url":"https://github.com/koonix/ansible-compose-projects","last_synced_at":"2025-03-17T06:33:50.348Z","repository":{"id":216725595,"uuid":"738988586","full_name":"koonix/ansible-compose-projects","owner":"koonix","description":"Ansible roles for running Docker Compose projects.","archived":false,"fork":false,"pushed_at":"2024-01-28T20:37:46.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-01-29T18:56:24.300Z","etag":null,"topics":["ansible","ansible-collection","ansible-role","docker","docker-compose"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koonix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-04T14:13:04.000Z","updated_at":"2024-01-12T16:39:24.000Z","dependencies_parsed_at":"2024-01-27T17:46:08.856Z","dependency_job_id":null,"html_url":"https://github.com/koonix/ansible-compose-projects","commit_stats":null,"previous_names":["koonix/ansible-compose-projects"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koonix%2Fansible-compose-projects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koonix%2Fansible-compose-projects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koonix%2Fansible-compose-projects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koonix%2Fansible-compose-projects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koonix","download_url":"https://codeload.github.com/koonix/ansible-compose-projects/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243987713,"owners_count":20379588,"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","ansible-collection","ansible-role","docker","docker-compose"],"created_at":"2025-03-17T06:33:49.773Z","updated_at":"2025-03-17T06:33:50.341Z","avatar_url":"https://github.com/koonix.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible-compose-projects\n\n[![Latest Version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fkoonix%2Fansible-compose-projects%2Fmain%2Fgalaxy.yml\u0026query=version\u0026label=Latest%20Version\u0026color=%23347d39)](https://github.com/koonix/ansible-compose-projects/tags)\n\nAnsible roles for running Docker Compose projects.\n\n## Roles\n\n### compose_projects\n\nGeneral-purpose role for running Docker Compose projects.\n\nThis role handles removals as well.\n\nRequires Docker and it's Compose plugin to be installed.\n[Shameless plug](https://github.com/koonix/ansible-docker).\n\n| Variable                                                  | Required | Description |\n|-----------------------------------------------------------|:--------:|-------------|\n| `compose_projects`                                        | ✔        | List of projects to run. |\n| `compose_projects[].name`                                 | ✔        | Title of the project. |\n| `compose_projects[].compose`                              | ✔        | Map of the docker compose file contents. Default: `{}`. |\n| `compose_projects[].pre_start`                            |          | Commands to run before any of the containers in the project are (re)started. See the Hooks section below. Default: `[]` |\n| `compose_projects[].post_start`                           |          | Commands to run after any of the containers in the project are (re)started. See the Hooks section below. Default: `[]` |\n| `compose_projects[].assets`                               |          | List of files, directories and templates to copy to the project directory, next to the docker compose file. Default: `[]` |\n| `compose_projects[].assets[].type`                        |          | Can be `copy` or `template` to indicate the type of the asset. Default: `copy` |\n| `compose_projects[].assets[].src`                         |          | Local path to the file, directory or template. `assets[].content` takes effect if not provided and `assets[].type` is `copy`. |\n| `compose_projects[].assets[].content`                     |          | Create a file with the given content. Works only when `assets[].type` is `copy`. `assets[].src` takes effect if not provided. |\n| `compose_projects[].assets[].dest`                        |          | Name of the destination file or directory, relative to the project directory. Defaults to the basename of `assets[].src` when `assets[].content` is `template`, otherwise defaults to `''`. |\n| `compose_projects[].assets[].mode`                        |          | Permissions of the file or directory. Default: `'644'` |\n| `compose_projects[].assets[].no_log`                      |          | Whether to enable [`no_log`](https://docs.ansible.com/ansible/latest/reference_appendices/logging.html#protecting-sensitive-data-with-no-log) for the installation of this item. Default: `false` |\n| `compose_projects[].assets[].pre_update`                  |          | Commands to run before the asset is updated. See the Hooks section below. Default: `[]` |\n| `compose_projects[].assets[].post_update`                 |          | Commands to run after the asset is updated. See the Hooks section below. Default: `[]` |\n| `compose_projects[].dir_mode`                             |          | Permissions of the project directory. Default: `'700'` |\n| `compose_projects[].remove_missing_assets`                |          | Whether to remove assets in the project directory that are missing from the list of assets. Default: `true` |\n| `compose_projects_remove_missing`                         |          | Whether to stop and remove projects present in `compose_projects_lib_dir` that are not defined in the list of projects. Default: `false` |\n| `compose_projects_lib_dir`                                |          | Where to put the project directories. Default: `/var/lib/ansible-compose-projects` |\n\n#### Hooks\n\nPre-update hooks of all assets\nare deduplicated and called one after another *before* any asset is installed.\n\nSimilarly, post-update hooks of all assets\nare deduplicated and called one after another *after* all assets are installed.\n\nHooks are executed with the project directory as their working directory.\n\nThe value of each hook should be a list.\n\nIn `pre_start` and `post_start`,\nEach item of the list should be an [`argv` list](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html#parameter-argv).\n\nIn `assets[].pre_update` and `assets[].post_update`,\nEach item of the list should be either an [`argv` list](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/command_module.html#parameter-argv),\nor one of the following special strings:\n\n| String               | Equivelant command |\n|----------------------|--------------------|\n| `stop`               | `docker compose stop` |\n| `down`               | `docker compose down` |\n| `build`              | `docker compose build` |\n\nFor example:\n\n```yaml\n  post_update:\n    - build\n    - [ echo, hello, world ]\n```\n\n#### Usage\n\nExample [requirements.yml](https://docs.ansible.com/ansible/latest/galaxy/user_guide.html#installing-roles-and-collections-from-the-same-requirements-yml-file]) file:\n\n```yaml\ncollections:\n  - name: https://github.com/koonix/ansible-compose-projects\n    type: git\n    version: 0.4.1\n```\n\nExample usage in a playbook:\n\n```yaml\n- name: Roles\n  hosts: all\n  roles:\n    - koonix.compose_projects.compose_projects\n    - ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoonix%2Fansible-compose-projects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoonix%2Fansible-compose-projects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoonix%2Fansible-compose-projects/lists"}