tuanama00
(Jose Araujo)
January 18, 2025, 1:23pm
1
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
L3D
(L3D)
January 19, 2025, 1:03am
2
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.
bcoca
(Brian Coca)
January 20, 2025, 5:36pm
3
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
tuanama00
(Jose Araujo)
January 20, 2025, 8:26pm
4
I config cars folder in ansible config but don’t take it, when run playbook, don’t recognize cars folder
bcoca
(Brian Coca)
January 20, 2025, 10:03pm
5
vars plugins
no es para ficheros con variables, es para codigo de Ansible que crea variables Vars plugins — Ansible Community Documentation
1 Like
tuanama00
(Jose Araujo)
January 22, 2025, 12:29pm
6
Muchas gracias !!! Revise la documentación y parece que había omitido esta parte. Hace cuanto usas a ansible?
bcoca
(Brian Coca)
January 22, 2025, 4:31pm
7
Unos 12 años, los últimos 10 desarrollando Ansible
tuanama00
(Jose Araujo)
January 22, 2025, 8:54pm
8
Yo recién he iniciado y me ha facilitado la vida administrando 40 server aproximadamente!!
Tienes algún repo con sus desarrollos?