Hello,
I wrote a script for updating Lets Encrypt certs and I wondering which directory stucture should be used for storing the certs and keys? Currently I have a relative filepath hardcoded, but maybe there are better soutions for that?
I have a similar setup for my LE certs, I have my Ansible controller maintain the cert files (as it has access to my DNS to maintain the challenge records). But I donβt consider them βstateβ that should be maintained in my git repo.
So I have them sitting in a folder called resources in the tree where I store all Ansible related stuff:
Hello @Thulium-Drake,
I assume βansible/β is your working directory from where you call the playbooks? How do you refer from the projects/stuff/roles/β¦ to the resources directory?
Nope, the Ansible βProjectβ is the projects/stuff folder (stuff is the name of the project in this case), thatβs what houses my Ansible configuration (and what I have stored in Git).
In the scripts Iβve mentioned earlier I basically do a few steps before starting the playbook:
Go to the correct directory (<wherever>/ansible/projects/stuff)
Check out changes from git (git pull, sometimes with extra magic to clear out any uncommitted changes)
Update Ansible Galaxy content
Run the playbook (ansible playbooks/my_playbook.yml)
And thereβs multiple ways to refer to the resources/stuff folder(s), Iβve used absolute paths in my playbooks/roles so far. But if you want relative links, the best would be to make a symlink to the projects/stuff/playbooks folder, as that can be referred to from within playbooks.
I do the same for the projects/stuff/playbooks/files folder, because thatβs in the playbooks folder, Ansible will try looking there for any path that looks like this: files/some/thing.txt
@Thulium-Drake
one more question: If I run the playbook with ansible playbooks/my_playbook.yml the roles are searched inside the playbooks folder in the subfolder playbooks/roles (At least in my test environment). How can you use the roles in your stuff/roles/ folder?