Skip to content

Commit

Permalink
check if docker is already installed
Browse files Browse the repository at this point in the history
Signed-off-by: dumitru <[email protected]>
  • Loading branch information
x3medima17 committed Oct 12, 2017
1 parent c29d341 commit b1476f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
14 changes: 9 additions & 5 deletions deploy/ansible/hosts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#Inventory file, example configuration is presented below
[centos7]
35.195.89.33

[CentOS]
35.195.103.159
[debian8]
104.155.33.227

[Ubuntu]
104.199.58.74
[ubuntu16]
35.195.93.48

[all:vars]
ansible_ssh_user=iroha
13 changes: 11 additions & 2 deletions deploy/ansible/provisioning.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
#Inventory file, example configuration is presented below

---
- hosts: all
vars:
user: iroha #your user on the remote machine

tasks:
- name: Test if docker is installed
command: docker --version
register: docker_exists
failed_when: false

- name: Download docker installation script
get_url:
url: https://get.docker.com
dest: /tmp/script.sh
mode: 0755
validate_certs: false
when: docker_exists.rc|int > 0

- name: Install docker using downloaded script
shell: /tmp/script.sh
args:
chdir: /tmp
when: docker_exists.rc|int > 0

- name: Add usermod to run docker from {{ user }} user
command: usermod -aG docker {{user}}
become: yes
- name: Start docker service

- name: Make sure docker is running
service: name=docker state=started
become: yes

0 comments on commit b1476f2

Please sign in to comment.