Giter Club home page Giter Club logo

ansible-compose-projects's Introduction

ansible-compose-projects

Latest Version

Ansible roles for running Docker Compose projects.

Roles

compose_projects

General-purpose role for running Docker Compose projects.

This role handles removals as well.

Requires Docker and it's Compose plugin to be installed. Shameless plug.

Variable Required Description
compose_projects List of projects to run.
compose_projects[].name Title of the project.
compose_projects[].compose Map of the docker compose file contents. Default: {}.
compose_projects[].pre_start Commands to run before any of the containers in the project are (re)started. See the Hooks section below. Default: []
compose_projects[].post_start Commands to run after any of the containers in the project are (re)started. See the Hooks section below. Default: []
compose_projects[].assets List of files, directories and templates to copy to the project directory, next to the docker compose file. Default: []
compose_projects[].assets[].type Can be copy or template to indicate the type of the asset. Default: copy
compose_projects[].assets[].src Local path to the file, directory or template. assets[].content takes effect if not provided and assets[].type is copy.
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.
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 ''.
compose_projects[].assets[].mode Permissions of the file or directory. Default: '644'
compose_projects[].assets[].no_log Whether to enable no_log for the installation of this item. Default: false
compose_projects[].assets[].pre_update Commands to run before the asset is updated. See the Hooks section below. Default: []
compose_projects[].assets[].post_update Commands to run after the asset is updated. See the Hooks section below. Default: []
compose_projects[].dir_mode Permissions of the project directory. Default: '700'
compose_projects[].remove_missing_assets Whether to remove assets in the project directory that are missing from the list of assets. Default: true
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
compose_projects_lib_dir Where to put the project directories. Default: /var/lib/ansible-compose-projects

Hooks

Pre-update hooks of all assets are deduplicated and called one after another before any asset is installed.

Similarly, post-update hooks of all assets are deduplicated and called one after another after all assets are installed.

Hooks are executed with the project directory as their working directory.

The value of each hook should be a list.

In pre_start and post_start, Each item of the list should be an argv list.

In assets[].pre_update and assets[].post_update, Each item of the list should be either an argv list, or one of the following special strings:

String Equivelant command
stop docker compose stop
down docker compose down
build docker compose build

For example:

  post_update:
    - build
    - [ echo, hello, world ]

Usage

Example requirements.yml file:

collections:
  - name: https://github.com/koonix/ansible-compose-projects
    type: git
    version: 0.4.1

Example usage in a playbook:

- name: Roles
  hosts: all
  roles:
    - koonix.compose_projects.compose_projects
    - ...

ansible-compose-projects's People

Contributors

koonix avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.