Skip to content

Commit

Permalink
Merge pull request #16 from mihai-satmarean/feature/virtualbox-provis…
Browse files Browse the repository at this point in the history
…ioning

Feature/virtualbox provisioning
  • Loading branch information
LuffyD83 authored Nov 25, 2024
2 parents 81e5b80 + 762e9f9 commit 62dc79e
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions virtualbox/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
mkdir -p virtualbox/provisioning/{web,db,common}

# Create common provisioning script
cat << 'EOF' > virtualbox/provisioning/common/base_setup.sh
#!/bin/bash

# Update system
sudo apt-get update
sudo apt-get upgrade -y

# Install common tools
sudo apt-get install -y \
curl \
wget \
vim \
git \
htop \
net-tools

# Configure timezone
sudo timedatectl set-timezone UTC

# Set up monitoring
sudo apt-get install -y prometheus-node-exporter
EOF

# Create web server provisioning
cat << 'EOF' > virtualbox/provisioning/web/setup_web.sh
#!/bin/bash

# Install web server
sudo apt-get install -y nginx

# Configure NGINX
sudo tee /etc/nginx/conf.d/default.conf << 'CONF'
server {
listen 80;
server_name localhost;

location / {
root /var/www/html;
index index.html;
}
}
CONF

# Restart NGINX
sudo systemctl restart nginx
EOF

# Create database server provisioning
cat << 'EOF' > virtualbox/provisioning/db/setup_db.sh
#!/bin/bash

# Install MySQL
sudo apt-get install -y mysql-server

# Secure MySQL installation
sudo mysql_secure_installation

# Configure MySQL for remote access
sudo sed -i 's/bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql
EOF

0 comments on commit 62dc79e

Please sign in to comment.