Hello,
I followed Ansible best practice to create my ansible automation directory
structure like following:
group_vars
group_vars/all
host_vars
os.yml
production
roles
roles/os-issue
Since I'm using ansible user as a remote user, and sudo method to escalate
its privileges globally, I want to define this in group_vars/all file. Here
is what I define in group_vars/all directory:
---
# group_vars/all
vars:
- remote_user: ansible
- become: yes
- become_method: sudo
However, when I ran my playbook, I'm still getting Permission Denied error:
ansible-playbook -i production os.yml -l Cluster1 -v
Using /etc/ansible/ansible.cfg as config file
PLAY [all]
****************************************************************************************************
TASK [Gathering Facts]
****************************************************************************************
fatal: [myserver]: UNREACHABLE! => {"changed": false, "msg": "Failed to
connect to the host via ssh:
============================================================\n|Permission
denied (publickey,password,keyboard-interactive).", "unreachable": true}
PLAY RECAP
****************************************************************************************************
myserver : ok=0 changed=0 unreachable=1 failed=0
skipped=0 rescued=0 ignored=0
Here is my os.yml playbook:
---
# file: os.yml
# This playbook file is to configure operating system after kickstarting
- hosts: all
roles:
- role: os-issue
It is to set /etc/issue file for remote myserver.
Please advise me how I can define global variables in group_vars/all file.
Thank you,
- Xinhuan Zheng
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/43c05320-4326-4a0a-9fef-fd54f1d9bb3f%40googlegroups.com.