-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-generic.yaml
90 lines (75 loc) · 2.16 KB
/
playbook-generic.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
85
86
87
88
89
---
- hosts: all # THIS SCRIPT is used in creating the base template. A project specific playbook creates the application specific microservice
become: true
vars:
ansible_python_interpreter: /usr/bin/python3 # Specify the path to Python 3 interpreter
tasks:
- name: Update package cache
apt:
update_cache: yes
- name: Upgrade packages
apt:
upgrade: yes
autoremove: yes
autoclean: yes
- name: Install APT apps
apt:
name:
- net-tools
- tree
state: present
- name: Include iptables rules
include_tasks: ~/src/devops/ansible/includes/iptables-rules.yaml
# TODO: Remove the port 80 setting in iptables-rules, if it is needed the app specific script should add it
- name: Retrieve dotvimrc file
get_url:
url: http://www.haxwell.org/dotvimrc
dest: /tmp/dotvimrc
- name: Copy dotvimrc to /home/ubuntu/.vimrc
copy:
src: /tmp/dotvimrc
dest: /home/ubuntu/.vimrc
remote_src: yes
- name: Change ownership of /home/ubuntu/.vimrc to ubuntu user
ansible.builtin.file:
path: /home/ubuntu/.vimrc
owner: ubuntu
group: ubuntu
- name: Copy dotvimrc to /root/.vimrc
become: true
copy:
src: /tmp/dotvimrc
dest: /root/.vimrc
remote_src: yes
- name: Install Java 19
apt:
name: openjdk-19-jdk
state: present
- name: Install Python 3
apt:
name:
- python3
- python3-pip
- python3-botocore
- python3-boto3
state: present
- name: Install MySQL
apt:
name: mysql-server
state: present
vars:
mysql_user: myuser # Set the desired username for the new MySQL user
mysql_password: mypassword # Set the desired password for the new MySQL user
- name: Install pymysql
pip:
name: pymysql
state: present
executable: pip3
- name: Reboot the machine
hosts: all
become: true
tasks:
- name: Reboot the machine
reboot:
msg: "Rebooting the machine"
pre_reboot_delay: 10