(a300) [admin@gitlab stumble]$ ansible-playbook -i inventory.ini test.yml
PLAY [ios] *********************************************************************
TASK [show] ********************************************************************
ok: [ios01]
TASK [debug] *******************************************************************
ok: [ios01] => {
"msg": [
"GigabitEthernet0/0 is up, line protocol is up ",
" Hardware is iGbE, address is 5254.0001.xxxx (bia 5254.0001.xxx)",
" Internet address is 192.168.1.11/24",
" MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec, ",
" reliability 255/255, txload 1/255, rxload 1/255",
" Encapsulation ARPA, loopback not set",
" Keepalive set (10 sec)",
" Auto Duplex, Auto Speed, link type is auto, media type is RJ45",
" output flow-control is unsupported, input flow-control is unsupported",
" ARP type: ARPA, ARP Timeout 04:00:00",
" Last input 00:00:00, output
...(略)...
---- hosts: nxos
connection: ansible.netcommon.network_cli
gather_facts:falsevars:ansible_network_os: cisco.nxos.nxos
ansible_user:"changeme"ansible_password:"changeme"tasks:- name:"Fetch interface state and parse with pyats"ansible.utils.cli_parse:command: show interface
parser:name: ansible.netcommon.pyats
register: nxos_pyats_show_interface
- name: print structured interface state data
ansible.builtin.debug:msg:"{{ nxos_pyats_show_interface['parsed'] }}"
ansible.utils.cli_parse モジュール関連のエラー
ansible.utils.cli_parse モジュールが見つからないエラー。
ERROR! couldn't resolve module/action 'ansible.utils.cli_parse'. This often indicates a misspelling, missing collection, or incorrect module path.
上記エラーの対策として、ansible.utils collection をインストール。
(a210) [admin@gitlab stumble]$ ansible-galaxy collection install ansible.utils
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'ansible.utils:1.0.1' to '/home/admin/.ansible/collections/ansible_collections/ansible/utils'
Downloading https://galaxy.ansible.com/download/ansible-utils-1.0.1.tar.gz to /home/admin/.ansible/tmp/ansible-local-23876jjourm5u/tmppi521mhv
ansible.utils (1.0.1) was installed successfully
paramiko 関連のエラー
再度 Playbook 実行で、paramiko が見つからないエラー。
TASK [Fetch interface state and parse with pyats] *****************************************************************************
fatal: [nxos01]: FAILED! => {"changed": false, "msg": ["paramiko is not installed: No module named 'paramiko'"]}
上記エラーの対策として、paramiko をインストール。
pip install paramiko
pyats 関連のエラー
再度 Playbook 実行で、pyats が見つからないエラー。
TASK [Fetch interface state and parse with pyats] *****************************************************************************
fatal: [nxos01]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (genie) on gitlab's Python /home/admin/envs/a210/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter Failed to import the required Python library (pyats) on gitlab's Python /home/admin/envs/a210/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
(a29) [admin@gitlab stumble]$ ansible-config list
ACTION_WARNINGS:default:truedescription:- By default Ansible will issue a warning when received from a task action (module
or action plugin)
- These warnings can be silenced by adjusting this setting to False.
env:- name: ANSIBLE_ACTION_WARNINGS
ini:- key: action_warnings
section: defaults
name: Toggle action warnings
type: boolean
version_added:'2.5'
(a29) [admin@gitlab stumble]$ ansible-playbook -i inventory.ini sv.yml
PLAY [sv] ******************************************************************************************************************
TASK [install] *************************************************************************************************************
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is SHA256xxx.
ECDSA key fingerprint is MD5:xxx.
Are you sure you want to continue connecting (yes/no)?