···11+# clorofilla.casa IaC
22+33+This is my first attempt at writing IaC """code""" for my home server.
44+55+It's a very basic Ansible-based setup:
66+- OS is AlmaLinux 10 for maximum street cred and stability
77+- service orchestration is managed by K3s
88+- storage is handled by my NAS
99+- everything is only accessible either through local IPs or Tailscale
1010+- TLS managed by LetsEncrypt
1111+- DNS handled by PorkBun, using Tailscale IPs
1212+- all secrets are encrypted with Ansible Vault
1313+1414+Playbooks will take care of enrolling the system in the Tailscale Tailnet
1515+attached to the provided API key.
1616+1717+## How do I deploy this thing
1818+1919+Suppose you have a freshly-built AlmaLinux 10 system, for which you have SSH keys configured,
2020+you should run playbooks in the order they appear given their filename:
2121+2222+```sh
2323+TAILSCALE_KEY='tskey-your-API-key-here' ansible-playbook ansible/setup.yml -i ansible/inventory/hosts.yml --vault-password-file .vault_password
2424+```
2525+2626+After that's done, the system from which you're executing the playbooks should have a Kubeconfig file in `~/.kube/config`: you're ready to use K8s:
2727+2828+```sh
2929+ansible-playbook services.yml -i ansible/inventory/hosts.yml --vault-password-file .vault_password
3030+```
3131+3232+## A note on reproducibility
3333+3434+This repo is mostly to keep me safe, you're not really supposed to deploy this stuff anywhere else, though feel free to draw inspiration from it!
+177
ansible/.gitignore
···11+.logs/*
22+*.retry
33+*.vault
44+collections/*
55+!collections/ansible_collections
66+!collections/requirements.yml
77+collections/ansible_collections/*
88+!collections/ansible_collections/clorofilla
99+collections/ansible_collections/clorofilla/*
1010+!collections/ansible_collections/clorofilla/casa
1111+# https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
1212+# Byte-compiled / optimized / DLL files
1313+__pycache__/
1414+*.py[cod]
1515+*$py.class
1616+1717+# C extensions
1818+*.so
1919+2020+# Distribution / packaging
2121+.Python
2222+build/
2323+develop-eggs/
2424+dist/
2525+downloads/
2626+eggs/
2727+.eggs/
2828+lib/
2929+lib64/
3030+parts/
3131+sdist/
3232+var/
3333+wheels/
3434+share/python-wheels/
3535+*.egg-info/
3636+.installed.cfg
3737+*.egg
3838+MANIFEST
3939+4040+# PyInstaller
4141+# Usually these files are written by a python script from a template
4242+# before PyInstaller builds the exe, so as to inject date/other infos into it.
4343+*.manifest
4444+*.spec
4545+4646+# Installer logs
4747+pip-log.txt
4848+pip-delete-this-directory.txt
4949+5050+# Unit test / coverage reports
5151+htmlcov/
5252+.tox/
5353+.nox/
5454+.coverage
5555+.coverage.*
5656+.cache
5757+nosetests.xml
5858+coverage.xml
5959+*.cover
6060+*.py,cover
6161+.hypothesis/
6262+.pytest_cache/
6363+cover/
6464+6565+# Translations
6666+*.mo
6767+*.pot
6868+6969+# Django stuff:
7070+*.log
7171+local_settings.py
7272+db.sqlite3
7373+db.sqlite3-journal
7474+7575+# Flask stuff:
7676+instance/
7777+.webassets-cache
7878+7979+# Scrapy stuff:
8080+.scrapy
8181+8282+# Sphinx documentation
8383+docs/_build/
8484+8585+# PyBuilder
8686+.pybuilder/
8787+target/
8888+8989+# Jupyter Notebook
9090+.ipynb_checkpoints
9191+9292+# IPython
9393+profile_default/
9494+ipython_config.py
9595+9696+# pyenv
9797+# For a library or package, you might want to ignore these files since the code is
9898+# intended to run in multiple environments; otherwise, check them in:
9999+# .python-version
100100+101101+# pipenv
102102+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
103103+# However, in case of collaboration, if having platform-specific dependencies or dependencies
104104+# having no cross-platform support, pipenv may install dependencies that don't work, or not
105105+# install all needed dependencies.
106106+#Pipfile.lock
107107+108108+# poetry
109109+# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
110110+# This is especially recommended for binary packages to ensure reproducibility, and is more
111111+# commonly ignored for libraries.
112112+# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
113113+#poetry.lock
114114+115115+# pdm
116116+# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
117117+#pdm.lock
118118+# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
119119+# in version control.
120120+# https://pdm.fming.dev/#use-with-ide
121121+.pdm.toml
122122+123123+# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
124124+__pypackages__/
125125+126126+# Celery stuff
127127+celerybeat-schedule
128128+celerybeat.pid
129129+130130+# SageMath parsed files
131131+*.sage.py
132132+133133+# Environments
134134+.env
135135+.venv
136136+env/
137137+venv/
138138+ENV/
139139+env.bak/
140140+venv.bak/
141141+142142+# Spyder project settings
143143+.spyderproject
144144+.spyproject
145145+146146+# Rope project settings
147147+.ropeproject
148148+149149+# mkdocs documentation
150150+/site
151151+152152+# mypy
153153+.mypy_cache/
154154+.dmypy.json
155155+dmypy.json
156156+157157+# Pyre type checker
158158+.pyre/
159159+160160+# pytype static type analyzer
161161+.pytype/
162162+163163+# Cython debug symbols
164164+cython_debug/
165165+166166+# PyCharm
167167+# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
168168+# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
169169+# and can be added to the global gitignore or merged into this file. For a more nuclear
170170+# option (not recommended) you can uncomment the following to ignore the entire idea folder.
171171+#.idea/
172172+173173+# MacOS
174174+.DS_Store
175175+176176+# Ansible
177177+.ansible/
···11+<!--# cspell: ignore SSOT CMDB -->
22+# AGENTS.md
33+44+Ensure that all practices and instructions described by
55+https://raw.githubusercontent.com/ansible/ansible-creator/refs/heads/main/docs/agents.md
66+are followed.
+19
ansible/ansible.cfg
···11+[defaults]
22+# Specify the inventory file
33+inventory = inventory/hosts.yml
44+55+# Set the logging verbosity level
66+verbosity = 2
77+88+# Set the default user for SSH connections
99+remote_user = geesawra
1010+1111+# Define the default become method
1212+become_method = sudo
1313+1414+[persistent_connection]
1515+# Controls how long the persistent connection will remain idle before it is destroyed
1616+connect_timeout=30
1717+1818+# Controls the amount of time to wait for response from remote device before timing out persistent connection
1919+command_timeout=30
···11+# Clorofilla Casa Collection
22+33+This repository contains the `clorofilla.casa` Ansible Collection.
44+55+## Tested with Ansible
66+77+Tested with ansible-core >=2.14 releases and the current development version of
88+ansible-core.
99+1010+## External requirements
1111+1212+Some modules and plugins require external libraries. Please check the
1313+requirements for each plugin or module you use in the documentation to find out
1414+which requirements are needed.
1515+1616+## Included content
1717+1818+Please check the included content on the
1919+[Ansible Galaxy page for this collection](https://galaxy.ansible.com/clorofilla/casa).
2020+2121+## Using this collection
2222+2323+```shell
2424+ ansible-galaxy collection install clorofilla.casa
2525+```
2626+2727+You can also include it in a `requirements.yml` file and install it via
2828+`ansible-galaxy collection install -r requirements.yml` using the format:
2929+3030+```yaml
3131+collections:
3232+ - name: clorofilla.casa
3333+```
3434+3535+To upgrade the collection to the latest available version, run the following
3636+command:
3737+3838+```bash
3939+ansible-galaxy collection install clorofilla.casa --upgrade
4040+```
4141+4242+You can also install a specific version of the collection, for example, if you
4343+need to downgrade when something is broken in the latest version (please report
4444+an issue in this repository). Use the following syntax where `X.Y.Z` can be any
4545+[available version](https://galaxy.ansible.com/clorofilla/casa):
4646+4747+```bash
4848+ansible-galaxy collection install clorofilla.casa:==X.Y.Z
4949+```
5050+5151+See
5252+[Ansible Using Collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html)
5353+for more details.
5454+5555+## Release notes
5656+5757+See the
5858+[changelog](https://github.com/ansible-collections/clorofilla.casa/tree/main/CHANGELOG.rst).
5959+6060+## Roadmap
6161+6262+<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. -->
6363+6464+## More information
6565+6666+<!-- List out where the user can find additional information, such as working group meeting times, slack/Matrix channels, or documentation for the product this collection automates. At a minimum, link to: -->
6767+6868+- [Ansible collection development forum](https://forum.ansible.com/c/project/collection-development/27)
6969+- [Ansible User guide](https://docs.ansible.com/ansible/devel/user_guide/index.html)
7070+- [Ansible Developer guide](https://docs.ansible.com/ansible/devel/dev_guide/index.html)
7171+- [Ansible Collections Checklist](https://docs.ansible.com/ansible/devel/community/collection_contributors/collection_requirements.html)
7272+- [Ansible Community code of conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html)
7373+- [The Bullhorn (the Ansible Contributor newsletter)](https://docs.ansible.com/ansible/devel/community/communication.html#the-bullhorn)
7474+- [News for Maintainers](https://forum.ansible.com/tag/news-for-maintainers)
7575+7676+## Licensing
7777+7878+GNU General Public License v3.0 or later.
7979+8080+See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text.
···11+---
22+# Minimal galaxy.yml for a playbook project for tools to recognize this as a collection
33+44+namespace: "clorofilla"
55+name: "casa"
66+readme: README.md
77+version: 0.0.1
88+authors:
99+ - your name <example@domain.com>
1010+1111+description: Collection for clorofilla.casa playbook project
1212+1313+# TO-DO: update the tags based on your content type
1414+tags: ["tools"]
1515+repository: NA
···11+Clorofilla.Casa Run Role
22+========================
33+44+A brief description of the role is here.
55+66+Requirements
77+------------
88+99+Any prerequisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
1010+1111+Role Variables
1212+--------------
1313+1414+A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. host vars, group vars, etc.) should be mentioned here as well.
1515+1616+Dependencies
1717+------------
1818+1919+A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
2020+2121+Example Playbook
2222+----------------
2323+2424+Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
2525+2626+```yaml
2727+- name: Execute tasks on servers
2828+ hosts: servers
2929+ roles:
3030+ - role: clorofilla.casa.run
3131+ run_x: 42
3232+```
3333+3434+Another way to consume this role would be:
3535+3636+```yaml
3737+- name: Initialize the run role from clorofilla.casa
3838+ hosts: servers
3939+ gather_facts: false
4040+ tasks:
4141+ - name: Trigger invocation of run role
4242+ ansible.builtin.include_role:
4343+ name: clorofilla.casa.run
4444+ vars:
4545+ run_x: 42
4646+```
4747+4848+License
4949+-------
5050+5151+<!-- TO-DO: Update the license to the one you want to use (delete this line after setting the license) -->
5252+BSD
5353+5454+Author Information
5555+------------------
5656+5757+An optional section for the role authors to include contact information, or a website (HTML is not allowed).