This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Added setup-default-docker task role #17
Open
chbrown13
wants to merge
3
commits into
SatelliteQE:master
Choose a base branch
from
chbrown13:setup-default-docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,44 @@ | ||
Ansible Role for Setting Up Default Docker | ||
========================================== | ||
|
||
This Ansible role configures the system to support Docker. | ||
|
||
Requirements | ||
------------ | ||
|
||
No Requirements are required for this role. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
No variables required for this role. | ||
|
||
Dependencies | ||
------------ | ||
|
||
This role is not dependent upon any galaxy roles. | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Here is a simple example of a docker role: | ||
|
||
- hosts: localhost | ||
remote_user: root | ||
roles: | ||
- docker | ||
|
||
License | ||
------- | ||
|
||
GNU GENERAL PUBLIC LICENSE | ||
|
||
Version 3, 29 June 2007 | ||
|
||
Copyright (C) 2007 Free Software Foundation, Inc. | ||
|
||
|
||
Author Information | ||
------------------ | ||
|
||
This is developed by Satellite QE team, irc: #robottelo on Freenode |
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 @@ | ||
--- | ||
# defaults file for 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# Standards: 0.2 | ||
galaxy_info: | ||
author: Satellite QE Team | ||
description: Satellite QE Team | ||
company: Red Hat | ||
|
||
license: GPLv3 | ||
|
||
min_ansible_version: 2.5.0 | ||
|
||
platforms: | ||
- name: RHEL | ||
versions: | ||
- 7 | ||
|
||
galaxy_tags: [] | ||
|
||
|
||
dependencies: [] |
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,12 @@ | ||
--- | ||
- name: "Create docker group" | ||
group: | ||
name: docker | ||
state: present | ||
local: true | ||
|
||
- name: "Add foreman user to docker group" | ||
user: | ||
name: foreman | ||
append: true | ||
groups: 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
- block: | ||
- name: "Edit docker sysconfig" | ||
replace: | ||
path: /etc/sysconfig/docker | ||
regexp: '^OPTIONS=.*' | ||
replace: "OPTIONS='--selinux-enabled=true --host tcp://0.0.0.0:2375 --host unix:///var/run/docker.sock -G docker'" | ||
|
||
- name: "Enable docker service" | ||
systemd: | ||
name: docker | ||
enabled: true | ||
|
||
- name: "Start docker service" | ||
systemd: | ||
name: docker | ||
state: started | ||
when: ansible_distribution_major_version >= "7" | ||
|
||
- block: | ||
- name: "Install libselinux-python" | ||
yum: | ||
name: http://mirror.centos.org/centos/6/os/x86_64/Packages/libselinux-python-2.0.94-7.el6.x86_64.rpm | ||
state: present | ||
|
||
- name: "Edit docker sysconfig" | ||
replace: | ||
path: /etc/sysconfig/docker | ||
regexp: '^other_args=.*' | ||
replace: "other_args='--selinux-enabled=true --host tcp://0.0.0.0:2375 --host unix:///var/run/docker.sock -G docker'" | ||
|
||
- name: "Turn on docker service" | ||
shell: chkconfig docker on | ||
|
||
- name: "Start docker service" | ||
service: | ||
name: docker | ||
state: started | ||
when: ansible_distribution_major_version < "7" |
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,35 @@ | ||
--- | ||
- block: | ||
- name: "Enable extra rpms repo" | ||
rhsm_repository: | ||
name: rhel-{{ ansible_distribution_major_version }}-server-extras-rpms | ||
state: enabled | ||
|
||
- name: "Install Docker" | ||
yum: | ||
name: docker | ||
state: present | ||
|
||
- name: "Disable extra rpms repo" | ||
rhsm_repository: | ||
name: rhel-{{ ansible_distribution_major_version }}-server-extras-rpms | ||
state: disabled | ||
when: ansible_distribution_major_version >= "7" | ||
|
||
- block: | ||
- name: "Install epel-release repo" | ||
yum: | ||
name: http://mirror.pnl.gov/epel/6/x86_64/epel-release-6-8.noarch.rpm | ||
state: present | ||
validate_certs: true | ||
|
||
- name: "Install docker" | ||
yum: | ||
name: docker-io | ||
state: present | ||
|
||
- name: "Remove epel-release repo" | ||
yum: | ||
name: epel-release.noarch | ||
state: removed | ||
when: ansible_distribution_major_version < "7" |
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 @@ | ||
--- | ||
- include_tasks: install_docker.yml | ||
- include_tasks: docker_group.yml | ||
- include_tasks: enable_docker.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,2 @@ | ||
[sat63] | ||
sat63-rhel7 ansible_ssh_host=sat63-rhel7.example.com ansible_user=root |
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 @@ | ||
--- | ||
- hosts: sat63 | ||
roles: | ||
- 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# vars file for 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Ansible Role for Setting Up Default Docker | ||
========================================== | ||
|
||
This Ansible role configures the system to support Docker. | ||
|
||
Requirements | ||
------------ | ||
|
||
No Requirements are required for this role. | ||
|
||
Role Variables | ||
-------------- | ||
|
||
No variables required for this role. | ||
|
||
Dependencies | ||
------------ | ||
|
||
This role is not dependent upon any galaxy roles. | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
Here is a simple example of setup-default-docker role: | ||
|
||
- hosts: localhost | ||
remote_user: root | ||
roles: | ||
- setup-default-docker | ||
|
||
License | ||
------- | ||
|
||
GNU GENERAL PUBLIC LICENSE | ||
|
||
Version 3, 29 June 2007 | ||
|
||
Copyright (C) 2007 Free Software Foundation, Inc. | ||
|
||
|
||
Author Information | ||
------------------ | ||
|
||
This is developed by Satellite QE team, irc: #robottelo on Freenode |
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 @@ | ||
--- | ||
# defaults file for setup-default-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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# handlers file for setup-default-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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
# Standards: 0.2 | ||
galaxy_info: | ||
author: Satellite QE Team | ||
description: Satellite QE Team | ||
company: Red Hat | ||
|
||
license: GPLv3 | ||
|
||
min_ansible_version: 2.5.0 | ||
|
||
platforms: | ||
- name: RHEL | ||
versions: | ||
- 7 | ||
|
||
galaxy_tags: [] | ||
|
||
|
||
dependencies: [] |
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,12 @@ | ||
--- | ||
- name: "Create docker group" | ||
group: | ||
name: docker | ||
state: present | ||
local: yes | ||
|
||
- name: "Add foreman user to docker group" | ||
user: | ||
name: foreman | ||
append: yes | ||
groups: 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
- block: | ||
- name: "Edit docker sysconfig" | ||
replace: | ||
path: /etc/sysconfig/docker | ||
regexp: '^OPTIONS=.*' | ||
replace: "OPTIONS=\'--selinux-enabled=true --host tcp://0.0.0.0:2375 --host unix:///var/run/docker.sock -G docker\'" | ||
|
||
- name: "Enable docker service" | ||
systemd: | ||
name: docker | ||
enabled: yes | ||
|
||
- name: "Start docker service" | ||
systemd: | ||
name: docker | ||
state: started | ||
when: ansible_distribution_major_version >= "7" | ||
|
||
- block: | ||
- name: "Edit docker sysconfig" | ||
replace: | ||
path: /etc/sysconfig/docker | ||
regexp: '^other_args=.*' | ||
replace: "other_args=\'--selinux-enabled=true --host tcp://0.0.0.0:2375 --host unix:///var/run/docker.sock -G docker\'" | ||
|
||
- name: "Enable docker service" | ||
shell: chkconfig docker on | ||
|
||
- name: "Start docker service" | ||
shell: service docker start | ||
when: ansible_distribution_major_version < "7" | ||
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,40 @@ | ||
--- | ||
- block: | ||
- name: "Enable extra rpms repo" | ||
rhsm_repository: | ||
name: rhel-{{ansible_distribution_major_version}}-server-extras-rpms | ||
state: enabled | ||
|
||
- name: "Install Docker" | ||
yum: | ||
name: docker | ||
state: present | ||
|
||
- name: "Enable Docker service" | ||
systemd: | ||
name: docker.service | ||
enabled: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be in the |
||
|
||
- name: "Disable extra rpms repo" | ||
rhsm_repository: | ||
name: rhel-{{ansible_distribution_major_version}}-server-extras-rpms | ||
state: disabled | ||
when: ansible_distribution_major_version >= "7" | ||
|
||
- block: | ||
- name: "Install epel-release repo" | ||
yum: | ||
name: http://mirror.pnl.gov/epel/6/x86_64/epel-release-6-8.noarch.rpm | ||
state: present | ||
validate_certs: yes | ||
|
||
- name: "Install docker" | ||
yum: | ||
name: docker-io | ||
state: present | ||
|
||
- name: "Remove epel-release repo" | ||
yum: | ||
name: epel-release.noarch | ||
state: removed | ||
when: ansible_distribution_major_version < "7" |
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 @@ | ||
--- | ||
- include_tasks: install_docker.yml | ||
- include_tasks: docker_group.yml | ||
- include_tasks: enable_docker.yml | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couple of extra blank lines here |
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 @@ | ||
[sat63] | ||
sat63-rhel7 ansible_ssh_host=sat63-rhel7.example.com ansible_user=root |
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 @@ | ||
--- | ||
- hosts: sat63 | ||
roles: | ||
- setup-default-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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
# vars file for setup-default-docker |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can manage this block with https://docs.ansible.com/ansible/latest/modules/service_module.html