Skip to content

Commit e673c40

Browse files
author
Gustavo Muniz do Carmo
committed
first commit
0 parents  commit e673c40

File tree

10 files changed

+132
-0
lines changed

10 files changed

+132
-0
lines changed

.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
language: python
3+
python: "3.6"
4+
5+
sudo: required
6+
7+
services:
8+
- docker
9+
10+
addons:
11+
apt:
12+
packages:
13+
- python-pip
14+
15+
install:
16+
- pip install ansible
17+
18+
before_script:
19+
- docker run --name xenial -d codeyourinfra/python3:xenial
20+
- docker run --name bionic -d codeyourinfra/python3:bionic
21+
22+
script:
23+
- ansible-galaxy install -r requirements.yml -p tests/roles
24+
- ansible-playbook tests/test.yml -i tests/inventory
25+
26+
after_script:
27+
- docker stop xenial bionic
28+
- docker rm xenial bionic
29+
30+
notifications:
31+
webhooks: https://galaxy.ansible.com/api/v1/notifications/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Esign Consulting Ltda.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# docker_compose
2+
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![GitHub release](https://img.shields.io/github/release/codeyourinfra/docker_compose.svg)]() [![Build status](https://travis-ci.org/codeyourinfra/docker_compose.svg?branch=master)](https://travis-ci.org/codeyourinfra/docker_compose)
4+
5+
Ansible role to install [docker-compose](https://docs.docker.com/compose).
6+
7+
## Example Playbook
8+
9+
```yml
10+
---
11+
- hosts: servers
12+
roles:
13+
- codeyourinfra.docker_compose
14+
```
15+
16+
## Dependencies
17+
18+
The role is dependent of [Codeyourinfra Docker Ansible role](https://galaxy.ansible.com/codeyourinfra/docker), once we need Docker to run docker-compose. Docker is so installed before the docker-compose installation.
19+
20+
Please don't turn off facts, because the `codeyourinfra.docker` role requires the *ansible_distribution_release* variable, obtained through the [gathering facts phase](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#information-discovered-from-systems-facts).
21+
22+
## Build process
23+
24+
The build process is performed in [Travis CI](https://travis-ci.org/codeyourinfra/docker_compose). During the build, the role is tested by using [Ubuntu Docker images with Python 3](https://hub.docker.com/r/codeyourinfra/python3).
25+
26+
The build is also triggered if any change is made in the `codeyourinfra.docker` role. After all, nobody wants some issue introduced by a change made in the upstream code :)
27+
28+
## Author Information
29+
30+
[@gustavomcarmo](https://github.com/gustavomcarmo) is a contributor of [Codeyourinfra](https://github.com/codeyourinfra). Get on board too! :)

ansible.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[defaults]
2+
roles_path=../

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker_compose_version: 1.22.0

meta/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
galaxy_info:
2+
author: Gustavo Muniz do Carmo
3+
description: Role to install docker-compose
4+
company: codeyourinfra.today
5+
license: MIT
6+
7+
min_ansible_version: 2.2
8+
9+
platforms:
10+
- name: Ubuntu
11+
versions:
12+
- bionic
13+
- xenial
14+
15+
galaxy_tags:
16+
- docker
17+
- docker-compose
18+
19+
dependencies:
20+
- role: codeyourinfra.docker

requirements.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
- src: codeyourinfra.docker

tasks/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: Install docker-compose
3+
get_url:
4+
url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64"
5+
dest: /usr/local/bin/docker-compose
6+
mode: 0755

tests/inventory

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[containers]
2+
bionic
3+
xenial
4+
5+
[containers:vars]
6+
ansible_connection=docker
7+
ansible_python_interpreter=/usr/bin/python3

tests/test.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- hosts: containers
3+
roles:
4+
- docker_compose
5+
tasks:
6+
- name: Get docker-compose version
7+
shell: docker-compose -v
8+
register: docker_compose_version_result
9+
- name: Assert docker-compose version
10+
assert:
11+
that: docker_compose_version_result.stdout_lines[0] | regex_search('^docker-compose version ' + docker_compose_version) != ''
12+
msg: "Failure on docker-compose installation"

0 commit comments

Comments
 (0)