-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
68 lines (58 loc) · 1.87 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
---
- name: My first play
hosts: all
become: true
pre_tasks:
- name: Update and Upgrade
apt:
update_cache: true
upgrade: dist
tasks:
- name: Install Docker Prerequisites
shell: |
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
changed_when: false
- name: Install Docker Packages
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
- name: Add ubuntu user to docker group
user:
name: ubuntu
groups: docker
append: true
- name: Reset SSH for docker group to be used
meta: reset_connection
- name: Log in to DockerHub
become_user: ubuntu
docker_login:
username: kevjimenez
password: "{{ docker_key }}"
- name: Install Docker Watchtower
docker_container:
name: watchtower
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /home/ubuntu/.docker/config.json:/config.json
command: -i 15 --cleanup=true
- name: Install Docker Static Web Portfolio
become_user: ubuntu
docker_container:
name: kjstatic
image: kevjimenez/kjstatic
ports:
- 80:80
...