-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildserver.yaml
84 lines (71 loc) · 2.41 KB
/
buildserver.yaml
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
---
- name: Install Docker CE, MariaDB, and other packages
hosts: all
become: true
gather_facts: true
vars:
sql_root_password: "Qw3rty123?"
tasks:
- name: Install Docker dependencies
apt:
name: ['apt-transport-https', 'ca-certificates', 'curl', 'software-properties-common']
state: present
- 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=amd64] https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Install Docker CE
apt:
name: docker-ce
state: present
- name: Install MariaDB
apt:
name: mariadb-server
state: present
- name: Run mysql_secure_installation
expect:
command: mysql_secure_installation
responses:
'Enter current password for root (enter for none):': ''
'Set root password? [Y/n]': 'Y'
'New password:': '{{ sql_root_password }}'
'Re-enter new password:': '{{ sql_root_password }}'
'Remove anonymous users? [Y/n]': 'Y'
'Disallow root login remotely? [Y/n]': 'Y'
'Remove test database and access to it? [Y/n]': 'Y'
'Reload privilege tables now? [Y/n]': 'Y'
- name: Install other packages
apt:
name: ['ansible', 'apache2', 'php', 'python3-pip', 'btop', 'nano', 'curl', 'nmap']
state: present
- name: Add preference for index.php in dir.conf
lineinfile:
path: /etc/apache2/mods-enabled/dir.conf
regex: '^DirectoryIndex'
line: 'DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm'
- name: Restart Apache service
service:
name: apache2
state: restarted
- name: Pull contents of Git repository
git:
repo: ssh://git@git.safewebbox.com:2222/david/DockerfileForge.git
dest: /var/www/html
accept_hostkey: yes
- name: Create devopsdev database
mysql_db:
name: devopsdev
state: present
login_user: root
login_password: '{{ sql_root_password }}'
- name: Restore MySQL database backup
mysql_db:
name: <database_name>
state: import
target: /path/to/databackup/devopsdev_dump.sql
login_user: root
login_password: <your_root_password>