# Ansible-rulebook run with ansible.cfg or vault secret

**URL:** <https://forum.ansible.com/t/ansible-rulebook-run-with-ansible-cfg-or-vault-secret/44282>\
**Category:** Get Help\
**Created:** [August 12, 2025, 3:32pm UTC](https://forum.ansible.com/t/ansible-rulebook-run-with-ansible-cfg-or-vault-secret/44282 "2025-08-12T15:32:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jonny](https://forum.ansible.com/u/Jonny)\
**Post date:** [August 12, 2025, 3:32pm UTC](https://forum.ansible.com/t/ansible-rulebook-run-with-ansible-cfg-or-vault-secret/44282/1 "2025-08-12T15:32:23Z")

</div>

Hello,

I’m currently using `ansible-rulebook` for an automation task. I may have overlooked something in the documentation, but I wanted to ask:

- Is it possible to include an `ansible.cfg` file in the run?
- Additionally, how can I specify a vault file to be used throughout the entire execution?

I’m encountering two issues while working with `ansible-rulebook`:

1. I’m unable to access secrets defined in the rulebook run from the imported playbook. It seems the vault file isn’t being applied as expected.

2. I’d like to use a custom `ansible.cfg` to reference my own collections and roles located in the playbook directory (`./collections`). I’ve already set `collections_path` and `roles_path` in my configuration file, but it doesn’t seem to take effect during the rulebook execution.

I created a simple rulebook.yml, just run every 30 seconds.

```yaml
## rulebook.yml
---
- name: Check remote file existence
  hosts: vm01
  sources:
    - ansible.eda.tick:
        delay: 30 # Check every 30 seconds
  rules:
    - name: Check if remote file exists
      condition: true
      action:
        run_playbook:
          name: "/eda/playbooks/eda_playbook.yml"

```

My rulebook triggers a playbook what will check for a file, if its exist, and run another playbooks site.yml.

```yaml
## eda_playbook.yml 
--- 
- name: Test playbook
  hosts: vm01
  gather_facts: false
  tasks:     
    - name: Recursively find folder       
      ansible.builtin.find:         
        paths: "/home/user01/eda_test/query"
        recurse: true         
        file_type: file       
      register: __get_filename

    - name: Run create proxmox VM   
      ansible.builtin.import_playbook: "/eda/site.yml"

```

```yaml
## site.yml
---
- name: Create VM
  ansible.builtin.import_playbook: "create_proxmox_vm.yml"
  tags:
    - create_proxmox
    - create

```

```yaml
## create_proxmox_vm.yml
---
- name: Create new VM and wait for connection
  hosts: managed_vms
  gather_facts: false
  serial: 1
  roles:
    - role: proxmox
      role_state: create
      when: cluster_type == "proxmox"
      delegate_to: localhost

```

```bash
ansible-rulebook -r ./extensions/eda/rulebook.yml -i ./inventories/inventory.ini --vault-password-file .vault-password

```

```bash
ERROR! Attempting to decrypt but no vault secrets found
2025-08-12 15:09:21,840 - ansible_rulebook.action.run_playbook - ERROR - ERROR! Attempting to decrypt but no vault secrets found

```

Thanks in advance for your help! If you need any additional details, feel free to ask.

---

<div class="post-metadata">

**Author:** ![Jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jonny](https://forum.ansible.com/u/Jonny)\
**Post date:** [August 13, 2025, 6:24am UTC](https://forum.ansible.com/t/ansible-rulebook-run-with-ansible-cfg-or-vault-secret/44282/2 "2025-08-13T06:24:55Z")

</div>

A new day, with a fresh mind !! I found a solution.

I put my ansible.cfg to /etc/ansible and it worked with the right settings. I forgot to say yesterday i got a container environment.

On a control node is it not the best solution, i think. Maybe someone had another solution for the problems.

---

<div class="post-metadata">

**Author:** ![Jonny](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jonny](https://forum.ansible.com/u/Jonny)\
**Post date:** [August 14, 2025, 11:12am UTC](https://forum.ansible.com/t/ansible-rulebook-run-with-ansible-cfg-or-vault-secret/44282/3 "2025-08-14T11:12:33Z")

</div>

Hello, one more question is it possible to use two inventory files. One ini with one host and for my playbook take a dynamic inventory, Whats build inside of a playbook. ?
