Skip to content

Commit 7f65c02

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

8 files changed

Lines changed: 133 additions & 0 deletions

File tree

.travis.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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-playbook tests/test.yml -i tests/inventory
24+
25+
after_script:
26+
- docker stop xenial bionic
27+
- docker rm xenial bionic
28+
29+
notifications:
30+
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: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# docker
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.svg)]() [![Build status](https://travis-ci.org/codeyourinfra/docker.svg?branch=master)](https://travis-ci.org/codeyourinfra/docker)
4+
5+
Ansible role to install Docker.
6+
7+
## Example Playbook
8+
9+
```yml
10+
---
11+
- hosts: servers
12+
roles:
13+
- codeyourinfra.docker
14+
```
15+
16+
The 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). So please don't turn off facts.
17+
18+
## Build process
19+
20+
The build process is performed in [Travis CI](https://travis-ci.org/codeyourinfra/docker). During the build, the role is tested by using [Ubuntu Docker images with Python 3](https://hub.docker.com/r/codeyourinfra/python3).
21+
22+
## Author Information
23+
24+
[@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=../

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 Oracle Java 8
4+
company: codeyourinfra.today
5+
license: MIT
6+
7+
min_ansible_version: 1.6
8+
9+
platforms:
10+
- name: Ubuntu
11+
versions:
12+
- bionic
13+
- xenial
14+
15+
galaxy_tags:
16+
- oracle
17+
- java
18+
- jdk
19+
20+
dependencies: []

tasks/main.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
- name: Install required packages
3+
apt:
4+
name: "{{ item }}"
5+
loop:
6+
- software-properties-common
7+
- apt-transport-https
8+
- name: Add the Docker apt key
9+
apt_key:
10+
url: https://download.docker.com/linux/ubuntu/gpg
11+
- name: Add the Docker apt repository
12+
apt_repository:
13+
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
14+
- name: Install Docker
15+
apt:
16+
name: docker-ce
17+
update_cache: yes

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
5+
tasks:
6+
- name: Get Docker version
7+
shell: docker -v
8+
register: docker_version_result
9+
- name: Assert Docker version
10+
assert:
11+
that: docker_version_result.stdout_lines[0] | regex_search('^Docker version [\d.]+-ce') != ''
12+
msg: "Failure on Docker installation"

0 commit comments

Comments
 (0)