Ansible conf file issue

Hi,

I’m trying to config ansible file with path of playbook, work ok with inventory with no recognize ansible playbook dir

‘’’
root@ansible Ansible]# ansible-config view

[defaults]

inventory = ./inventories/

remote_user = root

host_key_checking = False

#timeout = 30

retry_files_enabled = False

log_path = ./logs/ansible.log

playbook_dir = ./playbooks/

vars_plugins = ./vars/

[privilege_escalation]

become = True

become_method = sudo

become_ask_pass = False

[root@ansible Ansible]# ansible-playbook playbooks/upgrade1.yml --syntax-check

playbook: playbooks/upgrade1.yml

[root@ansible Ansible]# ansible-playbook upgrade1.yml --limit kernel_test

ERROR! the playbook: upgrade1.yml could not be found

[root@ansible Ansible]# ls /home/jaraujo/Ansible/playbooks

df_cem.yml df_test1.yml ejecutar_df.yaml kernetl.yml ping.yml upgrade.yml upgrade1.yml
‘’’

How can declare my playbook dir and var dir

Thanks

Hey @tuanama00

Not sure, but I think you used the playbook_dir variable wrong. Let me point you to docs.ansible.com/ansible/latest/reference_appendices/special_variables.html

playbook_dir
The path to the directory of the current playbook being executed. NOTE: This might be different than directory of the playbook passed to the ansible-playbook command line when a playbook contains a import_playbook statement.

Looks like this variable only works together with the ansible.builtin.import_playbook Module.

And in this sample Setup all Playbooks are in the root of the directory.

This variable playbook_dir is set by Ansible to expose information to the play itself, it is not a configuration item.

While vars_plugins is to indicate a directory that contains ‘vars plugins’ not files that define variables.

1 Like

I config cars folder in ansible config but don’t take it, when run playbook, don’t recognize cars folder

vars plugins no es para ficheros con variables, es para codigo de Ansible que crea variables Vars plugins — Ansible Community Documentation

1 Like

Muchas gracias !!! Revise la documentación y parece que había omitido esta parte. Hace cuanto usas a ansible?

Unos 12 años, los últimos 10 desarrollando Ansible

Yo recién he iniciado y me ha facilitado la vida administrando 40 server aproximadamente!!

Tienes algún repo con sus desarrollos?