On Wed, 2022-12-28 at 11:35 -0600, Jason Beard wrote:
Greetings! In regards to Wildfly below is the error I'm getting
in
the Ansible playbook run.
The error is in the jinja2 template. I'm pretty sure I can update it
a different way but I wasn't sure that the current setting is a
necessity. I'm an Ansible newbie so I tend to ask before I change
things.
Let me know if you need any other information.
Thanks,
Jason
Error:
~~~
ansible.errors.AnsibleUndefinedVariable: {{
hostvars[inventory_hostname]["ansible_env"].SSH_CONNECTION.split("
")[2] }}: 'dict object' has no attribute 'SSH_CONNECTION'
During handling of the above exception, another exception
occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/site-
packages/ansible/plugins/action/template.py", line 150, in
run
resultant = templar.do_template(template_data,
preserve_trailing_newlines=True,
escape_backslashes=False)
File "/usr/lib/python3.8/site-
packages/ansible/template/__init__.py", line 1176, in
do_template
raise AnsibleUndefinedVariable(e)
ansible.errors.AnsibleUndefinedVariable: {{
hostvars[inventory_hostname]["ansible_env"].SSH_CONNECTION.split("
")[2] }}: 'dict object' has no attribute 'SSH_CONNECTION'
fatal: [f36server1.iapetus.local]: FAILED! =>
{
"changed": false,
"msg": "AnsibleUndefinedVariable: {{
hostvars[inventory_hostname][\"ansible_env\"].SSH_CONNECTION.split(\"
\")[2] }}: 'dict object' has no attribute 'SSH_CONNECTION'"
}
~~~
Jason,
Thanks for the report. There are many tasks in the role that attempt
to copy a templatized file to the ansible target host. I believe I
have supplied a name for each task that should display in the
ansible.log file (if you have one) or on standard out. It would be
most useful if you could tell me the name on the task that is having
the issue.
Without the above information, my best guess is your "inventories"
directory has an issue. Mine looks like this:
ansible/
inventories/
hosts.yml
host_vars/
testWildfly.jlhimpel.net/
vars.yml
vault.yml
Where hosts.yml contains:
---
all:
hosts:
testWildfly.jlhimpel.net:
children:
allServersGroup:
hosts:
testWildfly.jlhimpel.net:
wildflyAllRemoveGroup:
hosts:
testWildfly.jlhimpel.net:
wildflyInstanceRemoveGroup:
hosts:
testWildfly.jlhimpel.net:
wildflyServiceGroup:
hosts:
testWildfly.jlhimpel.net:
wildflySslGroup:
hosts:
testWildfly.jlhimpel.net:
wildflyVersionRemoveGroup:
hosts:
testWildfly.jlhimpel.net:
...
Where vars.yml contains:
---
# python version on this host
ansible_python_interpreter: /usr/bin/python3
# non sensitive data
firewall_mgr: firewalld
primary_net_interface: enp1s0
# sensitive data
ansible_ssh_user: "{{ vault_ansible_ssh_user }}"
ansible_ssh_pass: "{{ vault_ansible_ssh_pass }}"
ansible_become_pass: "{{ vault_ansible_become_pass }}"
...
Where vault.yml is an encrypted file containing:
---
vault_ansible_ssh_user: XXXXX
vault_ansible_ssh_pass: XXXXX
vault_ansible_become_pass: XXXXX
(Of course, you will need to provide your local values for XXXXX).
Let me know if any of this helps.
John
...
_______________________________________________
server mailing list -- server(a)lists.fedoraproject.org
To unsubscribe send an email to server-leave(a)lists.fedoraproject.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/server@lists.fedoraproject.org
Do not reply to spam, report it:
https://pagure.io/fedora-infrastructure/new_issue