Dear all,
Does anybody know how to perform the privilege escalation to “enable” in Proxy SG via Ansible?
I have tried the following code, with no luck:
***OS = JUNOS because I could not find SG OS and somebody told us to use “junos” instead. It works to launch regular commands but It does not work to escalate to “enable”.
-
hosts: bluecoat
gather_facts: no
connection: local
vars:
ansible_connection: network_cli
ansible_user: “{{ lookup(‘env’, ‘ANSIBLE_NET_USERNAME’) }}”
ansible_password: “{{ lookup(‘env’, ‘ANSIBLE_NET_PASSWORD’) }}”
ansible_port: 22
ansible_network_os: junos
tasks: -
name: Show SSL Keyring
cli_command:
command: “show ssl keyring”
prompt: “Password:”
answer: “{{ lookup(‘env’, ‘ANSIBLE_NET_PASSWORD’) }}”
vars:
ansible_become: yes
ansible_become_method: enable
ansible_become_password: “{{ lookup(‘env’, ‘ANSIBLE_NET_PASSWORD’) }}”
register: ssl_keyring
Error: It says “invalid input” because the command only works in enable mode, so the escalation did not work.
{
“changed”: false,
“stdout”: “^\n% Invalid input detected at ‘^’ marker.”,
“invocation”: {
“module_args”: {
“command”: “show ssl keyring”,
“newline”: true,
“sendonly”: false,
“check_all”: false,
“prompt”: null,
“answer”: null
}
},
“stdout_lines”: [
“^”,
“% Invalid input detected at ‘^’ marker.”
],
“_ansible_no_log”: false
}
Thank you very much in advance. Your help is really really appreciated.
Regards,
Vicente.