ansible_cisco_1
仕事で何とか使えるようにならないか、試行錯誤中
とりあえず、簡単なところから・・・
$ ansible --version
ansible 2.3.0.0
config file = /home/ansible/.ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.5 (default, Nov 20 2015, 02:00:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
```
$ cat cisco.yml
---
- hosts: cisco
gather_facts: no
tasks:
- name: sh ver
raw : "show ver"
register: show_ver
- name: sh ver output
local_action: shell /bin/echo "{{ show_ver.stdout }}" > /home/ansible/show_ver
- name: sh run
raw : "show run"
register: show_run
- name: sh run output
local_action: shell /bin/echo "{{ show_run.stdout }}" > /home/ansible/show_run
[ansible@cent-ansible cisco]$
```
これでshow ver / show runの実行結果を取得し、/home/ansible配下に保存
```
$ cat cisco.ini
[cisco]
cisco ansible_host=192.168.x.xx
[all:vars]
ansible_user = cisco
ansible_ssh_pass = cisco
```
上記でAnsibleの実行結果を得る為のCiscoの設定
username cisco privilege 15 password 0 cisco