Skip to content

Commit

Permalink
Changing YAML to YML in Filenames & README Added
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamid Yousefi committed Oct 1, 2020
1 parent 7e50721 commit 138d8b4
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 46 deletions.
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
# Docker Installation Ansible Role
# Docker Ansible Role
This is a very simplified Ansible Role for installing Docker as a systemd service.
I'm using this role for many personal and enterprise projects and will do my best to keep it
update and customizable with the latest changes which would be useful for me (and others).

This is a very simplified Ansible role for installing Docker as a systemd service.

## Supporting Distributions and Their Releases
## Distributions and Their Releases
Right now, these OS distributions and releases are tested:
- Debian
- Jessie
- Stretch
- Buster
- Ubuntu
- Xenial
- Bionic
- Focal

## Installation
Everywhere in your controller machine, you just need to install it via
## How to Use It
You can simply install this role on your machine by using the below command:
```bash
ansible-galaxy install hamidyousefi.docker
```
Then you can use this role in your Ansible Playbooks like:
Also if you defined your playbook, you can simply add below lines to your `roles/requirements.yml`.
You can create this file if your playbook doesn't have it yet.
```yaml
- name: hamidyousefi.docker
version: master
```
Of course `master` is the most updated version of this role. You should prefer to
define which version you are going to use just by replacing it with something like `v1.0.0`.
You can find the versions list and their changelogs from [releases page](https://github.com/hamidyousefi/ansible-docker/releases).

## Additional Extensions and Configurations
I added two specific extra feature to this role. `docker-compose` and `iptables` can be set up easily just
by adding the below block in your `group_vars` related YAML file:
```yaml
---
- hosts: baremetals
roles:
- hamidyousefi.docker
configure:
compose: yes
iptables: yes
```
6 changes: 0 additions & 6 deletions defaults/main.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extensions:
- compose:
version: 1.27.4

configure:
compose: no
iptables: no
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ galaxy_info:
- bionic
- focal
galaxy_tags:
- linux
- docker
- containerization
- containerd
Expand Down
File renamed without changes.
File renamed without changes.
30 changes: 1 addition & 29 deletions tasks/main.yaml → tasks/iptables.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,4 @@
---
- name: installing necessary packages
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
update_cache: yes
state: present
force_apt_get: yes
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'

- include: debian.yaml
when: ansible_distribution == 'Debian'

- include: ubuntu.yaml
when: ansible_distribution == 'Ubuntu'

- name: installing compose extensions
get_url:
url: https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
owner: root
group: root
mode: '0655'
when: extensions.compose

- name: configuring iptables
block:
- name: creating DOCKER-USER chain
Expand Down Expand Up @@ -60,4 +32,4 @@
shell: ip6tables-save > /etc/iptables/rules.v6
when: change.changed
when: configure.iptables
tags: iptables
tags: iptables
31 changes: 31 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: installing necessary packages
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
update_cache: yes
state: present
force_apt_get: yes
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'

- include: distributions/debian.yml
when: ansible_distribution == 'Debian'

- include: distributions/ubuntu.yml
when: ansible_distribution == 'Ubuntu'

- name: installing compose extension
get_url:
url: "https://github.com/docker/compose/releases/download/{{ compose.version | default ('1.27.4') }}/docker-compose-Linux-x86_64"
dest: /usr/local/bin/docker-compose
owner: root
group: root
mode: '0655'
when: configure.compose

- include: iptables.yml
when: configure.iptables

0 comments on commit 138d8b4

Please sign in to comment.