forked from mobalt/ccf-relay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker.yml
72 lines (62 loc) · 2.14 KB
/
docker.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
##################################################################################################
## DOCKER
## To get the latest docker, use official Docker repo, as per
## https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-20-04
##################################################################################################
-
- hosts: all
become: yes
become_method: sudo
tasks:
- name: Add Docker GPG apt Key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt, Install Docker + Compose packages
apt:
name:
- docker-ce
- docker-compose-plugin
state: latest
update_cache: true
- name: Make sure docker service is enabled
service:
name: docker
state: started
enabled: yes
- name: Install Docker Module for Python
pip:
name:
- docker
- docker-compose
- name: Check if a reboot is needed for Debian and Ubuntu boxes
register: reboot_required_file
stat: path=/var/run/reboot-required get_md5=no
- name: Reboot the Debian or Ubuntu server
reboot:
msg: "Reboot initiated by Ansible due to kernel updates"
connect_timeout: 5
reboot_timeout: 300
pre_reboot_delay: 0
post_reboot_delay: 30
test_command: uptime
when: reboot_required_file.stat.exists
##################################################################################################
## Server Configuration
###
##################################################################################################
- name: Copy docker-compose directory to remote
ansible.builtin.copy:
src: ./xnat-docker-compose-ccfrelay/
dest: /root/xnat-docker-compose-ccfrelay/
owner: root
group: root
# - name: Create and Start services
# community.docker.docker_compose:
# project_src: /root/xnat-docker-compose-ccfrelay
# project_name: xnat
# build: yes