Skip to content

Commit

Permalink
Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
haxorof committed May 25, 2017
1 parent 23d8949 commit b11c447
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.vagrant
.retry
*.retry
.vscode/
17 changes: 13 additions & 4 deletions tasks/main-Generic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- name: Set fact if old Docker installation shall be removed
set_fact:
remove_old_docker: "{{docker_remove_pre_ce | bool }} == true and {{ cmd_docker_version.stdout_lines[0] | search('-ce') }} == false"
when: cmd_docker_version.stdout_lines[0] is defined
when: cmd_docker_version.stdout_lines is defined and cmd_docker_version.stdout_lines[0] is defined

- name: Check if Docker is running
command: systemctl status docker
Expand Down Expand Up @@ -53,13 +53,22 @@
mode: 0755
become: true

- name: Configure Docker daemon
- name: Configure Docker daemon (file)
copy:
content: "{{docker_daemon_config | to_nice_json}}"
src: "{{ docker_daemon_config_file }}"
dest: /etc/docker/daemon.json
become: true
notify: restart docker
when: docker_daemon_config is defined
when: docker_daemon_config_file is defined

- name: Configure Docker daemon (variables)
copy:
content: "{{ docker_daemon_config | to_nice_json }}"
dest: /etc/docker/daemon.json
become: true
notify: restart docker
when: docker_daemon_config_file is not defined and
docker_daemon_config is defined

- name: Enable and start Docker service
service:
Expand Down
3 changes: 3 additions & 0 deletions tests/files/daemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"init": true
}
2 changes: 1 addition & 1 deletion tests/test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
vars:
docker_daemon_config:
experimental: true
metrics-addr: "{{ ansible_default_ipv4.address }}:9323"
init: true
roles:
- ansible-role-docker-ce
8 changes: 8 additions & 0 deletions tests/test_config_file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- hosts: test-host
vars:
docker_daemon_config_file: "files/daemon.json"
docker_daemon_config:
shall_skip_this: true
roles:
- ansible-role-docker-ce

0 comments on commit b11c447

Please sign in to comment.