yt-dlp-dags/ansible/README-yt.md
2025-08-26 18:00:55 +03:00

1.8 KiB
Raw Blame History

Ansible-driven YT-DLP / Airflow Cluster Quick-Start & Cheat-Sheet

One playbook = one command to deploy, update, restart, or re-configure the entire cluster.


0. Prerequisites (run once on the tower server)


---

## 1. Ansible Vault Setup (run once on your **local machine**)

This project uses Ansible Vault to encrypt sensitive data like passwords and API keys. To run the playbooks, you need to provide the vault password. The recommended way is to create a file named `.vault_pass` in the root of the project directory.

1.  **Create the Vault Password File:**
    From the project's root directory (e.g., `/opt/yt-ops-services`), create the file. The file should contain only your vault password on a single line.

    ```bash
    # Replace 'your_secret_password_here' with your actual vault password
    echo "your_secret_password_here" > .vault_pass
    ```

2.  **Secure the File:**
    It's good practice to restrict permissions on this file so only you can read it.

    ```bash
    chmod 600 .vault_pass
    ```

The `ansible.cfg` file is configured to automatically look for this `.vault_pass` file in the project root.

---

## 2. Common Operations

### Running Ansible Commands

**IMPORTANT:** All `ansible-playbook` commands should be run from within the `ansible/` directory. This allows Ansible to automatically find the `ansible.cfg` and `inventory.ini` files.

```bash
cd ansible
ansible-playbook <playbook_name>.yml

If you run the command from the project root, you will see warnings about the inventory not being parsed, because Ansible does not automatically find ansible/ansible.cfg.

The ansible.cfg file has been configured to look for the .vault_pass file in the project root directory (one level above ansible/). Ensure your .vault_pass file is located there.