Commit ae885ca5 authored by Muhammad Umair Khan's avatar Muhammad Umair Khan
Browse files

Fix hardcoded paths inside deploy documentation and scripts

parent 92b3b430
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,5 +16,5 @@ config/secrets.yaml
.meepctl-repocfg.yaml
config/api/
charts/grafana/dashboards/mec-sandbox.json
pyinfra/pyinfra-venv/
pyinfra/.env
deploy/pyinfra/.env
deploy/pyinfra/pyinfra-venv/
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
@@ -24,10 +24,10 @@ Before running the playbooks, ensure:
Before running any playbooks, set up the Ansible environment:

```bash
chmod +x ~/etsi-mec-sandbox/playbooks/setup_ansible_env.sh
cd ~/etsi-mec-sandbox/playbooks
chmod +x ~/etsi-mec-sandbox/deploy/ansible/setup_ansible_env.sh
cd ~/etsi-mec-sandbox/deploy/ansible
./setup_ansible_env.sh
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate
```

---
@@ -36,10 +36,10 @@ source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate

```bash
# Activate virtual environment
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate

# Run the playbook
cd ~/etsi-mec-sandbox/playbooks
cd ~/etsi-mec-sandbox/deploy/ansible
ansible-playbook -i inventories/dev/hosts.ini site.yml
```

@@ -55,7 +55,7 @@ You will be prompted for:
## Folder Structure

```
playbooks/
deploy/ansible/
├── setup_ansible_env.sh        # Environment setup script (run first!)
├── site.yml                    # Main playbook entrypoint
├── ansible.cfg                 # Ansible configuration
+9 −9
Original line number Diff line number Diff line
@@ -24,16 +24,16 @@ Before running any playbooks, you must set up the Ansible environment:

```bash
# Make the setup script executable
chmod +x ~/etsi-mec-sandbox/playbooks/setup_ansible_env.sh
chmod +x ~/etsi-mec-sandbox/deploy/ansible/setup_ansible_env.sh

# Navigate to the playbooks directory
cd ~/etsi-mec-sandbox/playbooks
cd ~/etsi-mec-sandbox/deploy/ansible

# Run the setup script
./setup_ansible_env.sh

# Activate the virtual environment
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate
```

The setup script:
@@ -74,16 +74,16 @@ ansible_become_method=sudo
### Step 1: Setup Environment (if not done)

```bash
chmod +x ~/etsi-mec-sandbox/playbooks/setup_ansible_env.sh
cd ~/etsi-mec-sandbox/playbooks
chmod +x ~/etsi-mec-sandbox/deploy/ansible/setup_ansible_env.sh
cd ~/etsi-mec-sandbox/deploy/ansible
./setup_ansible_env.sh
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate
```

### Step 2: Run the Playbook

```bash
cd ~/etsi-mec-sandbox/playbooks
cd ~/etsi-mec-sandbox/deploy/ansible
ansible-playbook -i inventories/dev/hosts.ini site.yml
```

@@ -239,7 +239,7 @@ ansible-playbook -i inventories/dev/hosts.ini site.yml -e "install_dev_env=false
### Virtual Environment Not Activated
If you see "ansible: command not found", activate the virtual environment:
```bash
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate
```

### Thanos/Prometheus Deployment Failures
@@ -268,7 +268,7 @@ newgrp docker
### Kubernetes Collection Errors
If you see errors about `kubernetes.core.k8s`, ensure collections are installed:
```bash
source ~/etsi-mec-sandbox/playbooks/ansible-venv/bin/activate
source ~/etsi-mec-sandbox/deploy/ansible/ansible-venv/bin/activate
ansible-galaxy collection install -r collections/requirements.yml
```

+5 −5
Original line number Diff line number Diff line
@@ -2,13 +2,13 @@

set -euo pipefail

PLAYBOOK_DIR="$HOME/etsi-mec-sandbox/playbooks"
PLAYBOOK_DIR="$HOME/etsi-mec-sandbox/deploy/ansible"
SANDBOX_DIR="$HOME/etsi-mec-sandbox"
VENV_NAME="ansible-venv"
VENV_PATH="$PLAYBOOK_DIR/$VENV_NAME"
COLLECTION_REQ="$PLAYBOOK_DIR/collections/requirements.yml"
GITIGNORE_FILE="$SANDBOX_DIR/.gitignore"
GITIGNORE_ENTRY="playbooks/$VENV_NAME/"
GITIGNORE_ENTRY="deploy/ansible/$VENV_NAME/"

error() { echo "ERROR: $1" >&2; exit 1; }
command_exists() { command -v "$1" >/dev/null 2>&1; }
@@ -56,9 +56,9 @@ install_ansible_collections() {
update_gitignore() {
    [[ -f "$GITIGNORE_FILE" ]] || touch "$GITIGNORE_FILE"

    if ! grep -q "^playbooks/$VENV_NAME" "$GITIGNORE_FILE"; then
        echo "playbooks/$VENV_NAME/" >> "$GITIGNORE_FILE"
        echo "Added playbooks/$VENV_NAME/ to .gitignore"
    if ! grep -q "^deploy/ansible/$VENV_NAME" "$GITIGNORE_FILE"; then
        echo "deploy/ansible/$VENV_NAME/" >> "$GITIGNORE_FILE"
        echo "Added deploy/ansible/$VENV_NAME/ to .gitignore"
    else
        echo ".gitignore already contains entry for $VENV_NAME"
    fi
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ Before deploying, ensure your target machine(s) meet the following requirements:
Run the automated setup script to verify Python 3, create an isolated virtual environment (`pyinfra-venv`), and install all required deployment dependencies:

```bash
cd ~/etsi-mec-sandbox/pyinfra
cd ~/etsi-mec-sandbox/deploy/pyinfra
./setup.sh
```