add dockerCompose playbook
This commit is contained in:
52
playbooks/installDockerCompose.yml
Normal file
52
playbooks/installDockerCompose.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
- name: Install Docker
|
||||
# 'all' is okay here, because the fail task will force the user to specify a limit on the command line, using -l or --limit
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: checking limit arg
|
||||
fail:
|
||||
msg: "you must use -l or --limit - when you really want to use all hosts, use -l 'all'"
|
||||
when: ansible_limit is not defined
|
||||
run_once: true
|
||||
|
||||
- name: Install required system packages
|
||||
apt:
|
||||
pkg:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
- python3-pip
|
||||
state: latest
|
||||
update_cache: yes
|
||||
|
||||
- name: Add Docker GPG Key
|
||||
apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker Repository
|
||||
apt_repository:
|
||||
repo: "deb [arch={{ arch }}] https://download.docker.com/linux/{{ansible_distribution|lower}} {{ansible_distribution_release}} stable"
|
||||
state: present
|
||||
|
||||
- name: Install Docker packages
|
||||
apt:
|
||||
update_cache: yes
|
||||
pkg:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
|
||||
- name: Install docker-compose using pip
|
||||
pip:
|
||||
name:
|
||||
- docker-compose
|
||||
|
||||
- name: add user to docker group
|
||||
user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
groups:
|
||||
- docker
|
||||
append: yes
|
||||
Reference in New Issue
Block a user