22 lines
1.3 KiB
Markdown
22 lines
1.3 KiB
Markdown
# Ansible for Homelab
|
|
|
|
This Ansible setup is designed to automate the configuration and maintenance of servers and applications in the homelab. It includes playbooks for common tasks, inventory management for different environments, and a structured way to handle variables and secrets.
|
|
|
|
## Directory Structure
|
|
|
|
- `inventory/`: Contains the inventory files that define the hosts and groups of hosts managed by Ansible.
|
|
- `playbooks/`: Contains the Ansible playbooks for various automation tasks.
|
|
- `secrets.yml`: This file is intended to store sensitive data like passwords and API keys. It is recommended to encrypt this file using Ansible Vault.
|
|
- `example_secrets.yml`: An example secrets file.
|
|
- `vars.yml`: This file can be used to store non-sensitive variables that are used across multiple playbooks.
|
|
|
|
## Getting Started
|
|
|
|
1. **Install Ansible:** Make sure you have Ansible installed on your control machine.
|
|
2. **Inventory:** Update the `inventory/hosts.ini` file with the IP addresses and connection details for your servers.
|
|
3. **Secrets:** Create a `secrets.yml` file based on the `example_secrets.yml` template and encrypt it using Ansible Vault for security.
|
|
4. **Run a Playbook:** You can run a playbook using the `ansible-playbook` command. For example:
|
|
```bash
|
|
ansible-playbook -i inventory/hosts.ini playbooks/apt_upgrade.yml
|
|
```
|