Hello All,

I need help with and undefined variable in my Ansible Role! Any help will 
be appreciated!

Ansible Version
ansible 2.9.27
  config file = /home/kjames/ansible.cfg
  configured module search path = 
[u'/home/kjames/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 28 2022, 15:30:04) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-44)]

Configuration
ansible-config dump --only-changed
DEFAULT_BECOME(/home/kjames/Ansible/ansible.cfg) = True
DEFAULT_BECOME_ASK_PASS(/home/kjames/Ansible/ansible.cfg) = False
DEFAULT_BECOME_METHOD(/home/kjames/Ansible/ansible.cfg) = sudo
DEFAULT_BECOME_USER(/home/kjames/Ansible/ansible.cfg) = root
DEFAULT_HOST_LIST(/home/kjames/Ansible/ansible.cfg) = 
[u'/home/kjames/Ansible/static-ini-inventory']
DEFAULT_REMOTE_USER(/home/kjames/Ansible/ansible.cfg) = kjames

OS / Environment
CentOS Linux release 7.9.2009 (Core)

$ ansible-playbook ansible-playbooks/create-user.yml 

PLAY [node1] 
*********************************************************************************************************************************

TASK [Gathering Facts] 
***********************************************************************************************************************
ok: [node1]

TASK [create-user : Adding new user] 
*********************************************************************************************************
ok: [node1]

TASK [create-user : Adding user to sudoers] 
**************************************************************************************************
fatal: [node1]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'user_name' is undefined\n\nThe error 
appears to be in 
'/home/kjames/Ansible/ansible-playbooks/roles/create-user/tasks/main.yml': 
line 7, column 3, but may\nbe elsewhere in the file depending on the exact 
syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Adding 
user to sudoers\n  ^ here\n"}

PLAY RECAP 
***********************************************************************************************************************************
node1                      : ok=2    changed=0    unreachable=0    failed=1 
   skipped=0    rescued=0    ignored=0 

-- 
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/43ed5b64-1ca7-469b-9154-3e7104af32c2n%40googlegroups.com.

Reply via email to