36 lines
1.2 KiB
YAML
36 lines
1.2 KiB
YAML
- name: Local Config Tasks
|
|
tasks:
|
|
- name: Install nginx (macOS/Homebrew or Linux/apt)
|
|
shell: |
|
|
if command -v nginx >/dev/null; then
|
|
echo "nginx already installed"
|
|
elif command -v brew >/dev/null; then
|
|
brew install nginx || echo "brew install failed or not allowed"
|
|
elif command -v apt >/dev/null; then
|
|
sudo apt update && sudo apt install -y nginx
|
|
else
|
|
echo "No supported package manager found"
|
|
fi
|
|
|
|
- name: Update /etc/hosts with test domain
|
|
shell: |
|
|
if ! grep -q "test.cw-agent.local" /etc/hosts; then
|
|
echo "127.0.0.1 test.cw-agent.local" | sudo tee -a /etc/hosts
|
|
fi
|
|
|
|
- name: Create dummy SSL cert (for test)
|
|
shell: |
|
|
mkdir -p certs
|
|
openssl req -x509 -nodes -days 1 -newkey rsa:2048 \
|
|
-keyout certs/test.key \
|
|
-out certs/test.crt \
|
|
-subj "/CN=test.cw-agent.local"
|
|
|
|
- name: Reload nginx (if available)
|
|
shell: |
|
|
if command -v nginx >/dev/null; then
|
|
sudo nginx -s reload || true
|
|
elif command -v brew >/dev/null; then
|
|
brew services restart nginx || true
|
|
fi
|