Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Hej,
Ktoś miał może styczność z tworzeniem automatyki do zarządzania infrastrukturą sieciową z użyciem ansible'a ? Mam sprzęt z Cisco 3550/3560+ HP Procurve, i o ile z Cisco udało mi się stworzyć komunikację między ansiblem a sprzętem, o tyle z sprzętem HP mam problem.
Dodam że przy tworzeniu skryptów testowych w pythonie z użyciem paramiko, działa wszystko poprawnie zarówno dla Cisco jak i HP.
[b]root@vm:/etc/ansible# ansible cisco -u username -m raw -a "show arp"[/b]
switch1 | success | rc=0 >> Protocol Address Age (min) Hardware Addr Type Interface Internet X 197 0000.0c07.ac0a ARPA Vlan267 Internet X 0 001d.a1b6.0800 ARPA Vlan267 Internet X 174 0024.97dd.6b7f ARPA Vlan267 Internet X 53 0024.97dd.4a85 ARPA Vlan267 Internet X 0 5c5e.ab68.b882 ARPA Vlan267 Internet X - 001a.6d13.c341 ARPA Vlan267
[b]root@vm:/etc/ansible# ansible -vvvv hp -u username -m raw -a "show arp"[/b]
<10.167.X.X> ESTABLISH CONNECTION FOR USER: username on PORT 22 TO 10.167.X.X <10.167.X.X> EXEC show arp switch2 | FAILED => Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/__init__.py", line 586, in _executor exec_rc = self._executor_internal(host, new_stdin) File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/__init__.py", line 789, in _executor_internal return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args) File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/__init__.py", line 1036, in _executor_internal_r result = handler.run(conn, tmp, module_name, module_args, inject, complex_args) File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/action_plugins/raw.py", line 47, in run become=self.runner.become) File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/__init__.py", line 1174, in _low_level_exec_comd in_data=in_data) File "/usr/local/lib/python2.7/dist-packages/ansible-1.9.4-py2.7.egg/ansible/runner/connection_plugins/paramiko_ssh.py", line 222, d chan.exec_command(quoted_command) File "build/bdist.linux-x86_64/egg/paramiko/channel.py", line 60, in _check return func(self, *args, **kwds) File "build/bdist.linux-x86_64/egg/paramiko/channel.py", line 234, in exec_command self._wait_for_event() File "build/bdist.linux-x86_64/egg/paramiko/channel.py", line 1109, in _wait_for_event raise e SSHException: Channel closed.
---
[b]
ansible.cfg[/b]
[defaults] inventory = /etc/ansible/hosts library = /usr/share/ansible/ transport = paramiko host_key_checking = False
[b]hosts[/b]
[hp] switch1 [cisco] switch2 [hp:vars] platform = hp_procurve ansible_ssh_user=username ansible_ssh_pass=pass123 ansible_ssh_host=10.167.Y.Y [cisco:vars] platform = cisco_ios ansible_ssh_user=username ansible_ssh_pass=pass123 ansible_ssh_host=10.167.X.X
Za jakiekolwiek rady będę wdzięczny :)
Offline
Ok udało mi się rozwiązać problem. Trzeba było ręcznie podać 'dir_template' do szablonów ntc, teraz playbooki działają normalnie.
Offline
Time (s) | Query |
---|---|
0.00011 | SET CHARSET latin2 |
0.00006 | SET NAMES latin2 |
0.00096 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.149.235.171' WHERE u.id=1 |
0.00080 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.149.235.171', 1732684425) |
0.00050 | SELECT * FROM punbb_online WHERE logged<1732684125 |
0.00061 | DELETE FROM punbb_online WHERE ident='185.191.171.9' |
0.00075 | DELETE FROM punbb_online WHERE ident='54.36.148.216' |
0.00067 | SELECT topic_id FROM punbb_posts WHERE id=306286 |
0.00097 | SELECT id FROM punbb_posts WHERE topic_id=29047 ORDER BY posted |
0.00060 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=29047 AND t.moved_to IS NULL |
0.00007 | SELECT search_for, replace_with FROM punbb_censoring |
0.00094 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=29047 ORDER BY p.id LIMIT 0,25 |
0.00074 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=29047 |
Total query time: 0.00778 s |