OS Environment
macOS Sierra
version 10.12.5
Ansible Version
ansible 2.3.1.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
cisco.yml
---
- hosts: cisco
connection: local
gather_facts: yes
tasks:
- name: run show version on remoter devices
ios_command:
provider:
host: FQDN or IP
username: 使用者
password: ssh的連線密碼
authorize: yes
auth_pass: 特權模式密碼
commands:
- show version
register: version
- name: show version
debug:
var: version.stdout_lines
with_items: version.results
authorize
跟 auth_pass
要一起使用,因為這是要進入 特權模式
重點還是要看官方的用法,下面只是參考而已,有些寫法未來可能會被拔掉
這是我執行某一個寫法的時候吐的訊息
[WARNING]: argument username has been deprecated and will be removed in a future version
[WARNING]: argument host has been deprecated and will be removed in a future version
[WARNING]: argument password has been deprecated and will be removed in a future version
Reference:
謝謝提供,可是您是不是還少了什麼配置@@ 直接執行會輸出
回覆刪除PLAY [cisco]
skipping: no hosts matched
謝謝
不好意思…您可能需要自已加上 invertory
刪除