# Permanent file storage directory?

**URL:** <https://forum.ansible.com/t/permanent-file-storage-directory/39028>\
**Category:** Get Help\
**Created:** [December 10, 2024, 7:34pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028 "2024-12-10T19:34:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [December 10, 2024, 7:34pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/1 "2024-12-10T19:34:40Z")

</div>

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?

Thanks a lot!  
Thomas

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [December 19, 2024, 10:26am UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/2 "2024-12-19T10:26:31Z")

</div>

Hi there,

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:

```auto
ansible
├── projects
│ └── stuff
│ ├── cache
│ ├── collections
│ ├── files -> playbooks/files/
│ ├── group_vars -> inventory/group_vars
│ ├── host_vars -> inventory/host_vars/
│ ├── inventory
│ ├── library
│ ├── playbooks
│ ├── roles
│ └── scripts
├── resources
│ └── stuff
│ ├── acme
│ ├── edge_router_conf
│ └── zabbix
├── tools
│ └── ansible-utils
└── vaults

```

Same goes for vault, obviously ;-), that directory contains a GPG encrypted file that contains the Ansible-Vault passphrase.

Also, these are my ‘management’ scripts for Ansible: [GitHub - Thulium-Drake/ansible-utils: Toolkit to make running Ansible even better](https://github.com/Thulium-Drake/ansible-utils)

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [December 29, 2024, 6:25pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/3 "2024-12-29T18:25:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [December 29, 2024, 7:40pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/4 "2024-12-29T19:40:26Z")

</div>

Heya,

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`

Does that make it a bit more clear? 🙂

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [December 29, 2024, 8:41pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/5 "2024-12-29T20:41:24Z")

</div>

Thanks for the explaination, it’s clear now 🙂

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [December 30, 2024, 5:55pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/6 "2024-12-30T17:55:42Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![Thulium-Drake](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/thulium-drake/32/833_2.png) [@Thulium-Drake](https://forum.ansible.com/u/Thulium-Drake)\
**Post date:** [December 30, 2024, 6:12pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/7 "2024-12-30T18:12:25Z")

</div>

By telling Ansible where they are 😉 :

```auto
[defaults]
interpreter_python = auto_silent
retry_files_enabled = False
inventory = inventory
remote_user = ansible
ansible_managed = This file is managed with Ansible, your changes will be lost!
stdout_callback = community.general.yaml
roles_path = roles
collections_path = collections
forks = 10
action_plugins = library/action
callback_plugins = library/callback
lookup_plugins = library/lookup
library = library/modules

gathering = smart
fact_caching = jsonfile
fact_caching_connection = cache
# 18 hours
fact_caching_timeout = 64800

[inventory]
cache= true
cache_plugin = jsonfile
# 18 hours
cache_timeout = 64800

[privilege_escalation]
become = true

[ara]
api_client = http
api_server = http://localhost:8000
#api_username = user
#api_password = password
api_timeout = 15
ignored_facts = '["ansible_env", "ansible_all_ipv4_addresses"]'
ignored_arguments = '["extra_vars", "vault_password_files"]'

```

NOTE: this is the `ansible.cfg` in the `<wherever>/ansible/projects/stuff` folder

---

<div class="post-metadata">

**Author:** ![DengelFred](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@DengelFred](https://forum.ansible.com/u/DengelFred)\
**Post date:** [December 30, 2024, 6:34pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/8 "2024-12-30T18:34:25Z")

</div>

ah, I see 🙂 Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [January 29, 2025, 6:35pm UTC](https://forum.ansible.com/t/permanent-file-storage-directory/39028/9 "2025-01-29T18:35:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
