-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ninthnails/master
Add support for RedHat based systems
- Loading branch information
Showing
15 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
language: python | ||
python: "2.7" | ||
|
||
env: | ||
- SITE=playbook.yml | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install curl -y | ||
|
||
install: | ||
- pip install -U ansible | ||
|
||
# Add ansible.cfg to pick up roles path. | ||
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" | ||
|
||
script: | ||
# Check the role/playbook's syntax. | ||
- "ansible-playbook -i ci/inventory ci/$SITE --syntax-check" | ||
|
||
# Run the ansible ci playbook | ||
- "ansible-playbook -i ci/inventory ci/playbook.yml --connection=local --sudo -vvvv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[local] | ||
localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
# | ||
# Test Playbook | ||
# | ||
|
||
- hosts: localhost | ||
connection: local | ||
sudo: yes | ||
|
||
roles: | ||
- {role: ../../} | ||
|
||
- include: tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
|
||
- hosts: localhost | ||
connection: local | ||
sudo: yes | ||
gather_facts: false | ||
|
||
tasks: | ||
- command: docker run hello-world | ||
register: status | ||
failed_when: status.rc != 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
- name: Install Docker Repository | ||
template: src=docker-repo.j2 dest=/etc/yum.repos.d/docker.repo | ||
|
||
- name: Install Docker Engine | ||
yum: name=docker-engine state=present | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
- name: Check if /etc/init exists | ||
stat: path=/etc/init/ | ||
register: etc_init | ||
|
||
- name: Docker upstart default config file | ||
template: src=docker-defaults.j2 dest=/etc/default/docker | ||
when: etc_init.stat.exists == true | ||
notify: | ||
- Restart Docker | ||
|
||
- name: Docker init file | ||
template: src=docker-init.j2 dest=/etc/init/docker.conf | ||
when: etc_init.stat.exists == true | ||
notify: | ||
- Restart Docker | ||
|
||
- name: Check if systemd exists | ||
stat: path=/usr/lib/systemd/system/ | ||
register: systemd_check | ||
|
||
- name: Docker systemd default config file | ||
template: src=docker-sysconfig.j2 dest=/etc/sysconfig/docker | ||
when: systemd_check.stat.exists == true | ||
notify: | ||
- Restart Docker | ||
|
||
- name: Docker systemd file | ||
template: src=docker-service.j2 dest=/lib/systemd/system/docker.service backup=yes | ||
when: systemd_check.stat.exists == true | ||
notify: | ||
- Restart Docker | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
--- | ||
|
||
- include_vars: "{{ ansible_os_family }}.yml" | ||
|
||
- name: Create docker group | ||
group: name=docker state=present system=yes | ||
when: docker_create_group | ||
tags: | ||
- config | ||
|
||
- include: Debian.yml | ||
when: ansible_os_family == "Debian" | ||
|
||
- include: RedHat.yml | ||
when: ansible_os_family == "RedHat" | ||
|
||
- include: init.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Generated by Ansible for {{ansible_fqdn}} | ||
|
||
DOCKER_OPTS={{docker_opts}} | ||
DOCKER_OPTS={{docker_opts}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[dockerrepo] | ||
name=Docker Repository | ||
baseurl={{ docker_yum_repo }} | ||
enabled=1 | ||
gpgcheck=1 | ||
gpgkey=https://yum.dockerproject.org/gpg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# {{ansible_managed}} | ||
|
||
[Unit] | ||
Description=Docker Application Container Engine | ||
Documentation=https://docs.docker.com | ||
After=network.target docker.socket | ||
Requires=docker.socket | ||
|
||
[Service] | ||
Type=notify | ||
EnvironmentFile=-/etc/sysconfig/docker | ||
ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS | ||
MountFlags=slave | ||
LimitNOFILE=1048576 | ||
LimitNPROC=1048576 | ||
LimitCORE=infinity | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
Also=docker.socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# {{ansible_managed}} | ||
|
||
OPTIONS={{docker_opts}} | ||
|
||
# CentOS 6, RHEL 6 | ||
other_args={{docker_opts}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# replace with gist variant | ||
docker_repo_key: "36A1D7869245C8950F966E92D8576A8BA88D21E9" | ||
docker_repo: "https://get.docker.io/ubuntu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
os_version: "{{ ansible_lsb.release if ansible_lsb is defined else ansible_distribution_version }}" | ||
os_version_major: "{{ os_version | regex_replace('^([0-9]+)[^0-9]*.*', '\\\\1') }}" | ||
|
||
docker_yum_repo: "https://yum.dockerproject.org/repo/main/{{ ansible_distribution | lower }}/{{ os_version_major }}" |