-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
38 lines (28 loc) · 818 Bytes
/
install.sh
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
#!/bin/bash
# Update package lists
sudo apt update
# Install software-properties-common
sudo apt install -y software-properties-common
# Add Ansible repository
sudo apt-add-repository --yes --update ppa:ansible/ansible
# Install Ansible
sudo apt install -y ansible
# Check Ansible version
ansible --version
echo "Ansible installation completed."
# Check if setup.yml exists
if [ ! -f "setup.yml" ]; then
echo "Error: setup.yml not found in the current directory."
exit 1
fi
# Check if template files exist
for file in 20auto-upgrades.j2 50unattended-upgrades.j2; do
if [ ! -f "$file" ]; then
echo "Error: $file not found in the current directory."
exit 1
fi
done
# Run the Ansible playbook
echo "Running Ansible playbook..."
ansible-playbook setup.yml
echo "Setup completed."