-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yml
74 lines (60 loc) · 1.75 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- hosts: all
become: yes
become_method: sudo
vars:
docker_compose_version: "1.29.2"
env_name: "env-test"
tasks:
- name: Copy Docker-compose File
copy:
src: /var/jenkins_home/{{ env_name }}/docker-compose.yml
dest: /home/testtest/docker-compose.yml
- name: Update apt cache
apt: update_cache=yes cache_valid_time=3600
- name: Upgrade all apt packages
apt: upgrade=dist
- name: Install dependencies
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- gnupg-agent
- name: Add an apt signing key for Docker
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add apt repository for stable version
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Install Docker
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- docker-ce
- docker-ce-cli
- containerd.io
- name: Download docker-compose {{ docker_compose_version }}
get_url:
url : https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
dest: ~/docker-compose
mode: '+x'
- name: Check docker-compose exists
stat: path=~/docker-compose
register: docker_compose
- name: Move docker-compose to /usr/local/bin/docker-compose
command: mv ~/docker-compose /usr/local/bin/docker-compose
when: docker_compose.stat.exists
- name: Run Docker-compose File
shell: docker-compose up -d
become: True