Trying to write PB to look at FS 5800 using AAP and gets error

9 views
Skip to first unread message

William Flow

unread,
Oct 12, 2023, 5:26:47 PM10/12/23
to Ansible Project
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

Todd Lewis

unread,
Oct 12, 2023, 6:49:17 PM10/12/23
to ansible...@googlegroups.com, uto...@gmail.com
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.
--
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-proje...@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.

-- 
Todd

Rowe, Walter P. (Fed)

unread,
Oct 13, 2023, 8:01:22 AM10/13/23
to 'Rowe, Walter P. (Fed)' via Ansible Project, uto...@gmail.com
Adding to Todd's question .. NFS often does NOT permit root so its permissions are converted to "nobody" unless otherwise specified (if this is really an NFS volume you are copying into).

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

Reply all
Reply to author
Forward
0 new messages