Created
November 15, 2017 18:04
-
-
Save yonglai/d4617d6914d5f4eb22e4e5a15c0e9a03 to your computer and use it in GitHub Desktop.
An Ansible playbook to install docker-ce on Centos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Install docker | |
gather_facts: No | |
hosts: default | |
tasks: | |
- name: Install yum utils | |
yum: | |
name: yum-utils | |
state: latest | |
- name: Install device-mapper-persistent-data | |
yum: | |
name: device-mapper-persistent-data | |
state: latest | |
- name: Install lvm2 | |
yum: | |
name: lvm2 | |
state: latest | |
- name: Add Docker repo | |
get_url: | |
url: https://download.docker.com/linux/centos/docker-ce.repo | |
dest: /etc/yum.repos.d/docer-ce.repo | |
become: yes | |
- name: Enable Docker Edge repo | |
ini_file: | |
dest: /etc/yum.repos.d/docer-ce.repo | |
section: 'docker-ce-edge' | |
option: enabled | |
value: 0 | |
become: yes | |
- name: Enable Docker Test repo | |
ini_file: | |
dest: /etc/yum.repos.d/docer-ce.repo | |
section: 'docker-ce-test' | |
option: enabled | |
value: 0 | |
become: yes | |
- name: Install Docker | |
package: | |
name: docker-ce | |
state: latest | |
become: yes | |
- name: Start Docker service | |
service: | |
name: docker | |
state: started | |
enabled: yes | |
become: yes | |
- name: Add user vagrant to docker group | |
user: | |
name: vagrant | |
groups: docker | |
append: yes | |
become: yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Worked for me, many thks