Closed mwegrzynek closed 6 years ago
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @qalthos @samdoran click here for bot help
The EdgeOS modules are network modules and as such work slightly differently from other modules in Ansible (see http://docs.ansible.com/ansible/2.5/network/getting_started/network_differences.html).
The short version is that you need to specify connection: network_cli
on EdgeOS hosts, either with -c network_cli
or as vars in your inventory.
@samdoran this should probably be clearer in terms of documentation and error messages, similar to how some of the other modules have been updated recently.
@mwegrzynek I am able to connect to EdgeOS 1.10.1 successfully. Can you try setting connection
to network_cli
and see if that resolves your issue?
- name: EdgeOS Testing
hosts: edgeos:&lab
gather_facts: no
become: no
connection: network_cli
tasks:
- name: Gather facts
edgeos_facts:
gather_subset:
- config
- default
- debug:
var: ansible_net_version
- edgeos_command:
commands:
- show date
- show interfaces
- show hardware cpu
- show hardware mem
register: output
- debug:
var: output.stdout_lines
- edgeos_config:
backup: yes
save: yes
lines:
- set system config-management commit-revisions 50
tags: config
> ansible-playbook edgeos.yml
PLAY [EdgeOS Testing] ****************************************************************************************************
TASK [Gather facts] ******************************************************************************************************
ok: [er-01]
TASK [debug] *************************************************************************************************************
ok: [er-01] => {
"ansible_net_version": "1.10.1"
}
TASK [edgeos_command] ****************************************************************************************************
ok: [er-01]
TASK [debug] *************************************************************************************************************
ok: [er-01] => {
"output.stdout_lines": [
[
"Mon Apr 30 18:01:31 EDT 2018"
],
[
"Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down",
"Interface IP Address S/L Description ",
"--------- ---------- --- ----------- ",
"br0 192.168.0.0/28 u/u Admin ",
"br0.110 192.168.0.0/27 u/u IOT ",
"br0.120 192.168.0.0/27 u/u Guest ",
"br0.130 192.168.0.0/26 u/u Inside ",
"eth0 5.5.5.5/23 u/u Internet ",
"eth1 - u/u AP ",
"eth2 - u/u AP ",
"eth3 - u/u AP ",
"eth4 - u/u Uplink to switch ",
"lo 127.0.0.1/8 u/u ",
" ::1/128 ",
"switch0 - u/u Admin ",
"vtun0 192.168.0.029/28 u/u VPN ",
"vtun1 10.99.99.1 u/u VPN ",
"vtun2 10.99.99.3 u/u VPN"
],
[
"Architecture: mips64",
"Byte Order: Big Endian",
"CPU(s): 2",
"On-line CPU(s) list: 0,1",
"Thread(s) per core: 1",
"Core(s) per socket: 1",
"Socket(s): 2",
"L1d cache: 16K",
"L1i cache: 32K",
"L2 cache: 128K"
],
[
"\u001b=",
"MemTotal: 495520 kB\u001b[m",
"MemFree: 247940 kB\u001b[m",
"Buffers: 31252 kB\u001b[m",
"Cached: 117208 kB\u001b[m",
"SwapCached: 0 kB\u001b[m",
"Active: 71976 kB\u001b[m",
"Inactive: 113412 kB\u001b[m",
"Active(anon): 39104 kB\u001b[m",
"Inactive(anon): 120 kB\u001b[m",
"Active(file): 32872 kB\u001b[m",
"Inactive(file): 113292 kB\u001b[m",
"Unevictable: 0 kB\u001b[m",
"Mlocked: 0 kB\u001b[m",
"SwapTotal: 0 kB\u001b[m",
"SwapFree: 0 kB\u001b[m",
"Dirty: 8 kB\u001b[m",
"Writeback: 0 kB\u001b[m",
"AnonPages: 37024 kB\u001b[m",
"Mapped: 20044 kB\u001b[m",
"Shmem: 2296 kB\u001b[m",
"Slab: 32600 kB\u001b[m",
"SReclaimable: 13844 kB\u001b[m",
"SUnreclaim: 18756 kB\u001b[m",
"KernelStack: 1712 kB\u001b[m",
"PageTables: 1216 kB\u001b[m",
"NFS_Unstable: 0 kB\u001b[m",
"Bounce: 0 kB\u001b[m",
"WritebackTmp: 0 kB\u001b[m",
"CommitLimit: 247760 kB\u001b[m",
"Committed_AS: 272812 kB\u001b[m",
"VmallocTotal: 534773760 kB\u001b[m",
"VmallocUsed: 25748 kB\u001b[m",
"VmallocChunk: 534685052 kB\u001b[m",
"HugePages_Total: 0\u001b[m",
"HugePages_Free: 0\u001b[m",
"HugePages_Rsvd: 0\u001b[m",
"HugePages_Surp: 0\u001b[m",
"Hugepagesize: 2048 kB\u001b[m"
]
]
}
TASK [edgeos_config] *****************************************************************************************************
ok: [er-01]
PLAY RECAP ***************************************************************************************************************
er-01 : ok=5 changed=0 unreachable=0 failed=0
needs_info
@Qalthos What would be the best place for better error reporting? In the terminal plugin?
@samdoran Thanks, it seems setting network_cli fixes the problems. I had also pass ansible_network_os=edgeos (I'm running SSH on non-standard port on the EdgeRouters). Without ansible_network_os I was getting:
er-03.redacted.domain.com | FAILED! => {
"msg": "Unable to automatically determine host network os. Please manually configure ansible_network_os value for this host"
}
Thanks once again!
@mwegrzynek Yup, those are two key pieces to using Ansible Networking: setting ansible_network_os
and setting ansible_connection: network_cli
. I'll see about adding some warnings/info to the modules to better convey this.
What would be the best place for better error reporting?
The other modules do it in the action plugin. edgeos
doesn't have an action plugin, but something along the lines of
class ActionModule(_ActionModule):
def run(self, task_vars=None):
if self._play_context.connection != 'network_cli':
return {'failed': True, 'msg': 'Connection type %s is not valid for this module' % self._play_context.connection}
return super(ActionModule, self).run(task_vars=task_vars)
might be reasonable. Other than that, something in the notes:
section of the modules to indicate supported connection type might help.
@Qalthos That's enough to get me started. Thanks!
ISSUE TYPE
COMPONENT NAME
edgeos_facts
ANSIBLE VERSION
CONFIGURATION
ANSIBLE_PIPELINING(/home/redacted_username/.ansible.cfg) = True CACHE_PLUGIN(/home/redacted_username/.ansible.cfg) = jsonfile CACHE_PLUGIN_CONNECTION(/home/redacted_username/.ansible.cfg) = /home/redacted_username/Projekty/Ansible/cache/facts CACHE_PLUGIN_TIMEOUT(/home/redacted_username/.ansible.cfg) = 86400 DEFAULT_GATHERING(/home/redacted_username/.ansible.cfg) = smart DEFAULT_HOST_LIST(/home/redacted_username/.ansible.cfg) = [u'/home/redacted_username/Projekty/Ansible/hosts'] DEFAULT_REMOTE_USER(/home/redacted_username/.ansible.cfg) = root DEFAULT_VAULT_PASSWORD_FILE(/home/redacted_username/.ansible.cfg) = /home/redacted_username/.vault-pass
OS / ENVIRONMENT
Ansible is running on Arch, the target is an Edge Router 6P running firmware version 1.10.1
SUMMARY
I'm not able to execute any commands on an EdgeRouter 6P (even edgeos_facts is not working). Seems like a permission/aufs related problem, but I wasn't able to debug it myself.
STEPS TO REPRODUCE
EXPECTED RESULTS
A reply with a list of facts regarding the EdgeRouter 6P
ACTUAL RESULTS