Ansible : get running config from aruba switches

Hello,

I’m new user of ansible and for the first projet, I would to get current config of aruba (2930F) switches (for backup).

I read these documentations :

https://docs.ansible.com/ansible/devel/network/getting_started/first_playbook.html

https://docs.ansible.com/ansible/2.4/aruba_config_module.html

For the debug, I test with this commande :

ansible all -i swautc02, -c network_cli -u manager -m aruba_config -e ansible_network_os=aruba -vvvv --private-key=bkpkey.key

but return :

ansible 2.5.0 (stable-2.5 955ef020ef) last updated 2018/04/12 16:44:14 (GMT +200)
config file = /opt/ansible/ansible.cfg
configured module search path = [u’/opt/ansible/library’]
ansible python module location = /opt/ansible/lib/ansible
executable location = /opt/ansible/bin/ansible
python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]
Using /opt/ansible/ansible.cfg as config file
setting up inventory plugins
Parsed swautc02, inventory source with host_list plugin
Loading callback plugin minimal of type stdout, v2.0 from /opt/ansible/lib/ansible/plugins/callback/minimal.pyc
META: ran handlers
attempting to start connection
using connection plugin network_cli
local domain socket does not exist, starting it
control socket path is /home/mchavigny/.ansible/pc/632ab3f093

The full traceback is:
Traceback (most recent call last):
File “/usr/bin/ansible-connection”, line 70, in start
self.connection._connect()
File “/opt/ansible/lib/ansible/plugins/connection/network_cli.py”, line 316, in _connect
self.receive()
File “/opt/ansible/lib/ansible/plugins/connection/network_cli.py”, line 391, in receive
data = self._ssh_shell.recv(256)
File “/usr/lib/python2.7/site-packages/paramiko/channel.py”, line 685, in recv
raise socket.timeout()
timeout
swautc02 | FAILED! => {
“msg”: “”
}

I check log on the aruba switch and I see :

I 04/13/18 12:55:00 03363 auth: User ‘manager’ logged out of SSH session from
172.20.0.25
I 04/13/18 12:54:59 00179 mgr: SME SSH from 172.20.0.25 - MANAGER Mode
I 04/13/18 12:54:49 03344 ssh: User manager : SSH session established with
public-key authentication

Can you help me for this problem ?

Best regards,

Log in ansible :

2018-04-13 15:26:16,799 p=4956 u=mchavigny | ansible 2.5.0 (stable-2.5 955ef020ef) last updated 2018/04/12 16:44:14 (GMT +200)
config file = /opt/ansible/ansible.cfg
configured module search path = [u’/opt/ansible/library’]
ansible python module location = /opt/ansible/lib/ansible
executable location = /opt/ansible/bin/ansible
python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]
2018-04-13 15:26:16,799 p=4956 u=mchavigny | Using /opt/ansible/ansible.cfg as config file
2018-04-13 15:26:16,800 p=4956 u=mchavigny | setting up inventory plugins
2018-04-13 15:26:16,926 p=4956 u=mchavigny | Parsed swautc02, inventory source with host_list plugin
2018-04-13 15:26:19,696 p=4956 u=mchavigny | Loading callback plugin minimal of type stdout, v2.0 from /opt/ansible/lib/ansible/plugins/callback/minimal.pyc
2018-04-13 15:26:22,368 p=4956 u=mchavigny | META: ran handlers
2018-04-13 15:26:35,095 paramiko.transport starting thread (client mode): 0xfd7283d0L
2018-04-13 15:26:35,096 paramiko.transport Local version/idstring: SSH-2.0-paramiko_2.4.1
2018-04-13 15:26:35,097 paramiko.transport Remote version/idstring: SSH-2.0-Mocana SSH 6.3
2018-04-13 15:26:35,097 paramiko.transport Connected (version 2.0, client Mocana)
2018-04-13 15:26:35,108 paramiko.transport kex algos:[u’diffie-hellman-group14-sha1’] server key:[u’ssh-rsa’] client encrypt:[u’aes256-ctr’, u’aes256-cbc’, u’rijndael-cbc@lysator.liu.se’, u’aes192-ctr’, u’aes192-cbc’, u’aes128-ctr’, u’aes128-cbc’, u’3des-cbc’] server encrypt:[u’aes256-ctr’, u’aes256-cbc’, u’rijndael-cbc@lysator.liu.se’, u’aes192-ctr’, u’aes192-cbc’, u’aes128-ctr’, u’aes128-cbc’, u’3des-cbc’] client mac:[u’hmac-sha1-96’, u’hmac-md5’, u’hmac-sha1’, u’hmac-md5-96’] server mac:[u’hmac-sha1-96’, u’hmac-md5’, u’hmac-sha1’, u’hmac-md5-96’] client compress:[u’none’] server compress:[u’none’] client lang:[u’‘] server lang:[u’'] kex follows?False
2018-04-13 15:26:35,108 paramiko.transport Kex agreed: diffie-hellman-group14-sha1
2018-04-13 15:26:35,109 paramiko.transport HostKey agreed: ssh-rsa
2018-04-13 15:26:35,109 paramiko.transport Cipher agreed: aes128-ctr
2018-04-13 15:26:35,109 paramiko.transport MAC agreed: hmac-sha1
2018-04-13 15:26:35,110 paramiko.transport Compression agreed: none
2018-04-13 15:26:35,542 paramiko.transport kex engine KexGroup14 specified hash_algo
2018-04-13 15:26:35,543 paramiko.transport Switch to new keys …
2018-04-13 15:26:35,582 paramiko.transport Trying discovered key 931806b200d37ba37c23ed0f745877c3 in /opt/ansible/bkpkey.key
2018-04-13 15:26:35,750 paramiko.transport userauth is OK
2018-04-13 15:26:35,840 paramiko.transport Auth banner: We’d like to keep you up to date about:

2018-04-13 15:26:35,892 paramiko.transport Authentication (publickey) successful!
2018-04-13 15:26:35,896 paramiko.transport [chan 0] Max packet in: 32768 bytes
2018-04-13 15:26:35,942 paramiko.transport [chan 0] Max packet out: 32768 bytes
2018-04-13 15:26:35,942 paramiko.transport Secsh channel 0 opened.
2018-04-13 15:26:36,047 paramiko.transport [chan 0] Sesch channel 0 request ok
2018-04-13 15:26:36,153 paramiko.transport [chan 0] Sesch channel 0 request ok
2018-04-13 15:26:46,678 p=160 u=mchavigny | shutdown complete
2018-04-13 15:26:46,693 paramiko.transport EOF in transport thread
2018-04-13 15:26:46,764 p=4956 u=mchavigny | The full traceback is:
Traceback (most recent call last):
File “/usr/bin/ansible-connection”, line 70, in start
self.connection._connect()
File “/opt/ansible/lib/ansible/plugins/connection/network_cli.py”, line 316, in _connect
self.receive()
File “/opt/ansible/lib/ansible/plugins/connection/network_cli.py”, line 391, in receive
data = self._ssh_shell.recv(256)
File “/usr/lib/python2.7/site-packages/paramiko/channel.py”, line 685, in recv
raise socket.timeout()
timeout

2018-04-13 15:26:46,772 p=4956 u=mchavigny | swautc02 | FAILED! => {
“msg”: “”
}

I don't use Aruba switches, but to me it looks like aruba_config is for setting config not getting it.

Thank for your response,

I think use backup parameter on aruba_config. The parameter allow you to get running-config and backup file to the backup folder in playbook directory.