Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Sep 7, 2019
1 parent 2124b14 commit b307886
Showing 1 changed file with 53 additions and 15 deletions.
68 changes: 53 additions & 15 deletions menu/roles/dockerdeb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,49 +46,87 @@
- check.stat.exists == True
- switch == "on"

- name: Official Repo
- name: Add official gpg signing key
apt_key:
id: 0EBFCD88
url: https://download.docker.com/linux/ubuntu/gpg

- name: Add official repository
apt_repository:
repo: 'deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable edge'
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} edge"
filename: docker
register: apt_docker_repositories
when: switch == "on"

- name: Update APT packages list
apt:
update_cache: yes
when: apt_docker_repositories.changed and switch == "on"
when: apt_docker_repositories.changed

- name: Release docker-ce from hold
- name: Release 'docker-ce' from hold
dpkg_selections:
name: docker-ce
selection: install
when: switch == "on"

- name: Install docker-ce
- name: Install 'docker-ce'
apt:
name: docker-ce
name: "docker-ce=*18.09.2~3-0~{{ ansible_distribution | lower }}-{{ ansible_distribution_release | lower }}"
state: present
update_cache: yes
when: switch == "on"
force: yes

- name: Put docker-ce into hold
- name: Put 'docker-ce' into hold
dpkg_selections:
name: docker-ce
selection: hold
when: switch == "on"

- name: Uninstall docker-py pip module
- name: Get 'docker-ce' version
shell: "/usr/bin/dockerd-ce --version | head -n 1 | awk '{ print $3 }' | sed 's/,$//'"
register: docker_ce_version
ignore_errors: yes

- name: Display 'docker-ce' version
debug:
msg: "Docker CE version {{ docker_ce_version.stdout }} installed."
when: docker_ce_version is defined

- name: Release 'docker-ce-cli' from hold
dpkg_selections:
name: docker-ce-cli
selection: install

- name: Install 'docker-ce-cli'
apt:
name: "docker-ce-cli=*18.09.2~3-0~{{ ansible_distribution | lower }}-{{ ansible_distribution_release | lower }}"
state: present
update_cache: yes
force: yes

- name: Put 'docker-ce-cli' into hold
dpkg_selections:
name: docker-ce-cli
selection: hold

- name: Get 'docker-ce-cli' version
shell: "/usr/bin/docker --version | head -n 1 | awk '{ print $3 }' | sed 's/,$//'"
register: docker_ce_cli_version
ignore_errors: yes

- name: Display 'docker-ce-cli' version
debug:
msg: "Docker CE CLI version {{ docker_ce_cli_version.stdout }} installed."
when: docker_ce_cli_version is defined

- name: Uninstall 'docker-py' pip module
pip:
name: docker-py
state: absent
ignore_errors: yes
when: switch == "on"

- name: Install docker pip module
- name: Install 'docker' pip module
pip:
name: docker
state: latest
ignore_errors: yes
when: switch == "on"

- name: Check docker daemon.json exists
stat:
Expand Down

0 comments on commit b307886

Please sign in to comment.