aboutsummaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2024-05-01 09:19:13 +0200
committerGravatar jchristgit <[email protected]>2024-05-01 18:15:14 +0200
commitba970c7b3ffea5c773bc9d65fde3f37c4a5f4c60 (patch)
treeebad107a99bd7ac964feb32b13d6ae36d988f888 /ansible
parentignore pycharm's idea files (diff)
Depend on ansible-core instead of Ansible
Allow for faster local installation by only installing what we need.
Diffstat (limited to 'ansible')
-rw-r--r--ansible/README.md10
-rw-r--r--ansible/ansible.cfg2
-rw-r--r--ansible/local_testing/Vagrantfile2
-rw-r--r--ansible/roles/requirements.yml10
4 files changed, 20 insertions, 4 deletions
diff --git a/ansible/README.md b/ansible/README.md
index cdb5278..bdc4034 100644
--- a/ansible/README.md
+++ b/ansible/README.md
@@ -9,11 +9,13 @@ If you are on Windows, you need to install WSL and run Ansible in there, as
natively](https://docs.ansible.com/ansible/latest/user_guide/windows_faq.html#can-ansible-run-on-windows).
Debian Stable is recommended, but any Linux distribution should work.
-1. Create a virtual environment: `python -m venv venv`
-1. Activate the virtual environment
-1. Update pip and builder deps: `python -m pip install --upgrade pip wheel setuptools`
-1. Install project dependencies: `python -m pip install -r requirements.txt`
+From the project root directory:
+
1. Install the pre-commit hook: `pre-commit install`
+1. Install Poetry: `apt install python3-poetry`
+1. Install dependencies: `poetry install`
+1. Head to the `ansible` directory: `cd ansible`
+1. Install Ansible dependencies: `poetry run ansible-galaxy install -r roles/requirements.yml`
1. Create a `vault_passwords` file and write the vault password to it
1. Configure the Ansible Vault git diff driver using `git config --global
diff.ansible-vault.textconv "ansible-vault view"` and `git config diff.ansible-vault.cachetextconv false`
diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
index bf8864e..10c66be 100644
--- a/ansible/ansible.cfg
+++ b/ansible/ansible.cfg
@@ -2,6 +2,8 @@
inventory = inventory/hosts.yaml
host_key_checking = False
vault_password_file = vault_passwords
+collections_path = .ansible/galaxy_collections/
+roles_path = .ansible/galaxy_roles/:roles/
[privilege_escalation]
become = yes
diff --git a/ansible/local_testing/Vagrantfile b/ansible/local_testing/Vagrantfile
index e21357b..3532c0c 100644
--- a/ansible/local_testing/Vagrantfile
+++ b/ansible/local_testing/Vagrantfile
@@ -26,6 +26,8 @@ Vagrant.configure("2") do |config|
cd /home/vagrant/infra
sudo poetry config virtualenvs.create false
sudo PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install --only ansible --no-root
+ cd ansible/
+ ansible-galaxy install -r roles/requirements.yml
SHELL
control.vm.provider "virtualbox" do |v|
diff --git a/ansible/roles/requirements.yml b/ansible/roles/requirements.yml
new file mode 100644
index 0000000..063bead
--- /dev/null
+++ b/ansible/roles/requirements.yml
@@ -0,0 +1,10 @@
+---
+collections:
+ - name: ansible.posix
+ version: 1.5.4
+ - name: community.crypto
+ version: 2.19.0
+ - name: community.general
+ version: 8.6.0
+ - name: community.postgresql
+ version: 3.4.0