You could help us help you if you included some background.
Is the error you got associated with the "copy JSON" task?
How are you elevating privileges? There's no "become: true" on the
plays; are you specifying "--become" or "-b" on the command line? Does
it run as you, or are you using a different become user? Is "nfs" a
group or an individual host?
It might help to show the whole command line, and the output of
ansible-config dump --only-changed
could avoid us having to ask some follow-up questions, too.
On 10/12/23 5:26 PM, William Flow wrote:
So I have a template that runs a PB like"
---
- name: Get data on flex-fiber 9500
hosts: flex-copper
gather_facts: no
tasks:
- name: run show configuration on flex-copper FS 5800
# cisco.ios.ios_command:
# commands: show interface
ansible.netcommon.cli_command:
command: show version | json
register: myconfigs
- name: Show data on flex-copper FS 5800
hosts: nfs
gather_facts: no
tasks:
- name: display value of "myconfigs" variable
debug:
msg: "{{hostvars['flex-copper'].myconfigs}}"
- name: copy JSON
copy:
content: "{{hostvars['flex-copper'].myconfigs| to_json(indent=4,
sort_keys=True)}}"
dest: "/nfs/html/switch_json/flex-copper-5800_data.json"
owner: rtlogic
group: rtlogic
mode: '0644'
I tried with Cisco with the same error and I always fail with
"msg": "failed to elevate privilege to enable mode, still at level
[4] and prompt [b'\\nflex-c-tor-1# ']",
i have changed my creds for this many times really need some help here
Thanks
B
--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/be7db7a1-3f67-4fd8-ad9d-3d7b43e70bd4n%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/be7db7a1-3f67-4fd8-ad9d-3d7b43e70bd4n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Todd
--
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/ef9b8734-c431-4a3a-970c-aff4a464c85e%40gmail.com.