Skip to main content

Ansible Network

EdgeRouter 配置#

# 添加 ssh keyscp [email protected]:/tmp/key
ssh [email protected]configure# key 需要有说明否则会说不合法loadkey admin /tmp/keycommitsaveexit
edgerouter:  hosts:    er-1:      ansible_host:      ansible_user: admin      ansible_network_os: edgeos      connection: network_cli


- name: Network facts  connection: network_cli  gather_facts: false  hosts: edgerouter  tasks:    - name: Get facts      edgeos_facts:        gather_subset: all
    - name: Display the config      debug:        msg:          - 'Hostname : {{ansible_net_hostname}}'          - 'Model    : {{ansible_net_model}} v{{ ansible_net_version }}'          - 'Serial   : {{ansible_net_serialnum}}'
ansible -m ping edgerouteransible-playbook net-facts.yaml

socket_path must be a value#