From 5b96b26593027a71145ab84af290e81e38ae42d3 Mon Sep 17 00:00:00 2001 From: Jesper Hess Nielsen Date: Thu, 10 May 2018 11:19:54 +0200 Subject: [PATCH] Add docker role + check for python --- roles/docker/tasks/main.yml | 17 +++++++++++++++++ roles/playbook.yml | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 roles/docker/tasks/main.yml diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml new file mode 100644 index 0000000..4670c24 --- /dev/null +++ b/roles/docker/tasks/main.yml @@ -0,0 +1,17 @@ +--- +- name: add docker gpg key + apt_key: + keyserver: pgp.key-server.io + id: 8D81803C0EBFCD88 + state: present + +- name: add docker apt repository + apt_repository: + repo: deb https://download.docker.com/linux/ubuntu artful stable + state: present + update_cache: yes + +- name: install docker-ce + apt: + name: docker-ce + state: present diff --git a/roles/playbook.yml b/roles/playbook.yml index 5ca84e6..92d09de 100644 --- a/roles/playbook.yml +++ b/roles/playbook.yml @@ -1,4 +1,14 @@ --- +- hosts: all + gather_facts: False + + pre_tasks: + - name: install python for Ansible + raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) + register: output + changed_when: output.stdout != "" + - setup: + - name: "Include host secrets where applicable" hosts: "all" tasks: @@ -11,4 +21,10 @@ hosts: "all" become: yes roles: - - "ubuntu_base" \ No newline at end of file + - "ubuntu_base" + +- name: "Install docker on all kubernetes servers" + hosts: "all_kubernetes_servers" + become: yes + roles: + - "docker" \ No newline at end of file