Skip to content

Commit

Permalink
Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
haxorof committed Jun 27, 2017
1 parent caab5a6 commit 690360f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Variables related to this role are listed below:
# docker_daemon_config:
# experimental: true
docker_daemon_config:
# Enable Docker CE Edge
docker_enable_ce_edge: false
# Setup Docker to devicemapper as storage driver. Require space to be available on LVM partition for new logical partition.
# Uses https://github.com/projectatomic/container-storage-setup
docker_setup_devicemapper: false
Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
# defaults file for ansible-role-docker-ce

# Daemon configuration (https://docs.docker.com/engine/reference/commandline/dockerd/)
# Example:
# docker_daemon_config:
# experimental: true
docker_daemon_config:
# Enable Docker CE Edge
docker_enable_ce_edge: false
# Setup Docker to devicemapper as storage driver. Require space to be available on LVM partition for new logical partition.
# Uses https://github.com/projectatomic/container-storage-setup
docker_setup_devicemapper: false
Expand Down
22 changes: 19 additions & 3 deletions tasks/main-CentOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@
become: true

- name: Add Docker CE repository
shell: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
args:
creates: /etc/yum.repos.d/docker-ce.repo
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
mode: 0644
become: true
register: yum_repo

- name: Determine Docker CE Edge repo status
shell: yum-config-manager docker-ce-edge | grep enabled
ignore_errors: yes
changed_when: false
register: cmd_docker_ce_edge_enabled

- name: Set current Docker CE Edge repo status fact
set_fact:
fact_docker_ce_edge_enabled: "{{ cmd_docker_ce_edge_enabled.stdout == 'enabled = True' }}"

- name: Enable/Disable Docker CE Edge Repository
shell: yum-config-manager --{{ (docker_enable_ce_edge == true) | ternary('enable','disable') }} docker-ce-edge
become: true
when: fact_docker_ce_edge_enabled != docker_enable_ce_edge

- name: Update yum cache
shell: yum makecache fast
become: true
Expand Down
22 changes: 19 additions & 3 deletions tasks/main-Fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@
# tasks file for ansible-role-docker-ce

- name: Add Docker CE repository
shell: dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
args:
creates: /etc/yum.repos.d/docker-ce.repo
get_url:
url: https://download.docker.com/linux/fedora/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
mode: 0644
become: true
register: dnf_repo

- name: Determine Docker CE Edge repo status
shell: dnf config-manager --dump docker-ce-edge | grep enabled
ignore_errors: yes
changed_when: false
register: cmd_docker_ce_edge_enabled

- name: Set current Docker CE Edge repo status fact
set_fact:
fact_docker_ce_edge_enabled: "{{ cmd_docker_ce_edge_enabled.stdout == 'enabled = True' }}"

- name: Enable/Disable Docker CE Edge Repository
shell: dnf config-manager --set-{{ (docker_enable_ce_edge == true) | ternary('enabled','disabled') }} docker-ce-edge
become: true
when: fact_docker_ce_edge_enabled != docker_enable_ce_edge

- name: Update dnf cache
shell: dnf makecache fast
become: true
Expand Down

0 comments on commit 690360f

Please sign in to comment.