--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/7fbbe42c-bce2-4e68-818f-9049d13a8bc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
for network_cred in job.network_credentials:
env['ANSIBLE_NET_USERNAME'] = network_cred.username
env['ANSIBLE_NET_PASSWORD'] = decrypt_field(network_cred, 'password')
ssh_keyfile = cred_files.get(network_cred, '')
if ssh_keyfile:
env['ANSIBLE_NET_SSH_KEYFILE'] = ssh_keyfile
authorize = network_cred.authorize
env['ANSIBLE_NET_AUTHORIZE'] = six.text_type(int(authorize))
if authorize:
env['ANSIBLE_NET_AUTH_PASS'] = decrypt_field(network_cred, 'authorize_password')
TASK [Show the content of the SSH Key] *****************************************
ok: [man3-rc-core4500-01] => {
"msg": "/tmp/awx_77_dZzrdo/tmpli6mRb"
msg: -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED .....
TASK [Retrieving full config from devices] *************************************
e30=DeyJ1dWlkIjogIjJiZDMzZmE0LTMxZjItNDMwZi1iMDExLTE5NWU0MGNkM2Q5OCJ9Dfatal: [man3-rc-voip4200-04]: FAILED! => {"changed": false, "msg": "Unable to make a PyEZ connection: ConnectAuthError(man3-rc-core4500-01)"}
---
- name: NET - PULLING CONFIG
hosts: OFFICES
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
- name: Show the content of the SSH Key
debug:
msg: '{{ lookup("env", "ANSIBLE_NET_SSH_KEYFILE") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'netscript'
ssh_private_key_file: '{{ lookup("env", "ANSIBLE_NET_SSH_KEYFILE") }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
- get_conf
ANSIBLE_NET_SSH_KEYFILE
environment variable. (used by Ansible Tower) --private-key
or --key-file
command line arguments to the ansible
or ansible-playbook
command.
- name: Show the content of the SSH Key
debug:
msg: '{{ lookup("file", "ANSIBLE_NET_SSH_KEYFILE") }}'
TASK [Show the content of the SSH Key] *****************************************
[WARNING]: Unable to find 'ANSIBLE_NET_SSH_KEYFILE' in expected paths (use
-vvvvv to see paths)
fatal: [man3-rc-core4500-01]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'file'. Error was a <class 'ansible.errors.AnsibleError'>, original message: could not locate file in lookup: ANSIBLE_NET_SSH_KEYFILE"}
[WARNING]: Unable to find 'ANSIBLE_NET_SSH_KEYFILE' in expected paths (use
-vvvvv to see paths)
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/604f7d25-85c7-4619-b83a-2de2694b56f8%40googlegroups.com.
ok: [man2-rc-access4200-09a] => {
"msg": "/tmp/awx_92_i0z9B7/tmpZvwup0"
ok: [man2-rc-access4200-09a] => {
"msg": "-----BEGIN RSA PRIVATE KEY-----\nProc-Type: 4,ENCRYPTED\nDEK-Info: AES-128-CBC,14\n\nPRIVATE_RANDOM_KEY_n/xZiB\n-----END RSA PRIVATE KEY-----",
TASK [Retrieving full config from devices] *************************************
e30=DeyJ1dWlkIjogImFkNmU2YTM0LWVjNmMtNDY0My04OTYwLTQ1MDlhZTg5YjE5NSJ9Dfatal: [man3-rc-voip4200-02]: FAILED! => {"changed": false, "msg": "Unable to make a PyEZ connection: ConnectAuthError(man3-rc-voip4200-02)"}
---
- name: NET - PULLING CONFIG
hosts: OFFICES
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
- name: Show the path of the SSH Key passed from AWX
debug:
msg: '{{ SSH_LOCATION }}'
- name: Show the content of the SSH Key passed from AWX
debug:
msg: '{{ lookup("file", "{{ SSH_LOCATION }}") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'netscript'
ssh_private_key_file: '{{ SSH_LOCATION }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
- get_conf
[OFFICES:vars]
SSH_LOCATION='{{ lookup("env", "ANSIBLE_NET_SSH_KEYFILE") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'netscript'
ssh_private_key_file: '{{ SSH_LOCATION }}'
password: '{{ ANSIBLE_NET_SSH_KEY_PASSPHRASE }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
- get_conf
- name: NET - PULLING CONFIG
hosts: OFFICES
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
# COMMENTED WAS USED FOR DEBUGGING PURPOSES
# - name: Show the path of the SSH Key passed from AWX
# debug:
# msg: '{{ SSH_LOCATION }}'
# - name: Show the content of the SSH Key passed from AWX
# debug:
# msg: '{{ lookup("file", "{{ SSH_LOCATION }}") }}'
# - name: Show the content of the SSH Passphrase from AWX
# debug:
# msg: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'netscript'
ssh_private_key_file: '{{ SSH_LOCATION }}'
passwd: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
- get_conf
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/50b947ed-a05b-4b36-9207-10983167c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/50b947ed-a05b-4b36-9207-10983167c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/50b947ed-a05b-4b36-9207-10983167c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to a topic in the Google Groups "AWX Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/awx-project/ce95ooS2sp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to awx-project...@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/dd9ae5bf-6aa7-4a5c-81b9-c8ad5166baa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/50b947ed-a05b-4b36-9207-10983167c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to a topic in the Google Groups "AWX Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/awx-project/ce95ooS2sp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to awx-project+unsubscribe@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/dd9ae5bf-6aa7-4a5c-81b9-c8ad5166baa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
- name: NET - PULLING CONFIG
hosts: OFFICES
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
- name: Show the path of the SSH Key passed from AWX
debug:
msg: '{{ SSH_LOCATION }}'
- name: Show the content of the SSH Key passed from AWX
debug:
msg: '{{ lookup("file", "{{ SSH_LOCATION }}") }}'
- name: Show the content of the ssh password field from AWX
debug:
msg: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'netscript'
ssh_private_key_file: '{{ SSH_LOCATION }}'
passwd: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
- get_conf
TASK [Show the content of the SSH Passphrase from AWX] *************************
ok: [man3-rc-voip4200-01] => {
"msg": "ssh-password"
}
ok: [man3-rc-voip4200-02] => {
"msg": "ssh-password"
}
ok: [man3-rc-voip4200-04] => {
"msg": "ssh-password"
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/50b947ed-a05b-4b36-9207-10983167c793%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
You received this message because you are subscribed to a topic in the Google Groups "AWX Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/awx-project/ce95ooS2sp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to awx-project...@googlegroups.com.
To post to this group, send email to awx-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/dd9ae5bf-6aa7-4a5c-81b9-c8ad5166baa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
--
---
- name: NET - PULLING CONFIG
hosts: OFFICES
connection: local
gather_facts: false
roles:
- Juniper.junos
tasks:
- name: Show the content of the SSH Passphrase from AWX
debug:
msg: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
- name: Show the content of the ANSIBLE_NET_SSH_KEYFILE
debug:
msg: '{{ lookup("env", "ANSIBLE_NET_SSH_KEYFILE") }}'
- name: Retrieving full config from devices
juniper_junos_config:
host: '{{ inventory_hostname }}'
user: 'test_user'
# ssh_private_key_file: '{{ SSH_LOCATION }}'
ssh_private_key_file: '{{ lookup("env", "ANSIBLE_NET_SSH_KEYFILE") }}'
# passwd: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}'
port: 830
timeout: 300
format: text
return_output: false
retrieve: committed
dest_dir: 'output/'
tags:
PLAY [NET - PULLING CONFIG] ****************************************************
TASK [Show the content of the SSH Passphrase from AWX] *************************
}
ok: [man4-rc-access3400-05] => {
120
"msg": ""
}
...