-
Notifications
You must be signed in to change notification settings - Fork 0
/
initial.yml
127 lines (110 loc) · 3.11 KB
/
initial.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
##################################################
# Ansible initialisation script
##################################################
---
- hosts: all
collections:
- community.mysql
- community.docker
- community.general
become: true
vars_files:
- vars/default.yml
# Check server status - must be answer
tasks:
- action: ping
- name: Install start packages
apt:
name={{ item }}
update_cache=yes
state=latest
loop:
- python3-pymysql
- mc
- snapd
- net-tools
- make
- git
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
# Nginx Configuration
- name: Install Nginx
when: "'web' in group_names"
apt:
name=nginx
update_cache=yes
state=latest
#Docker install block
- name: Add Docker GPG apt Key
when: "'docker' in group_names"
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
when: "'docker' in group_names"
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
when: "'docker' in group_names"
apt:
name: docker-ce
state: latest
update_cache: true
- name: Update apt and install docker-ce
when: "'docker' in group_names"
apt:
name: docker-compose-plugin
state: latest
update_cache: true
- name: Install Docker Module for Python
when: "'docker' in group_names"
pip:
name: docker
#MySQL block
- name: Add Docker GPG apt Key
when: "'mysql' in group_names"
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker Repository
when: "'mysql' in group_names"
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update apt and install docker-ce
when: "'mysql' in group_names"
apt:
name: docker-ce
state: latest
update_cache: true
- name: Update apt and install docker-ce
when: "'mysql' in group_names"
apt:
name: docker-compose-plugin
state: latest
update_cache: true
- name: Install Docker Module for Python
when: "'mysql' in group_names"
pip:
name: docker
- name: Install Docker compose module
when: "'mysql' in group_names"
pip:
name: docker-compose
- name: copy docker-compose
when: "'mysql' in group_names"
copy:
src: ./files/docker-compose.yml
dest: $HOME/docker-compose.yml
- name: run docker-compose
when: "'mysql' in group_names"
docker_compose:
project_src: $HOME
build: yes
register: output