API Guide

2. Ansible Galaxy 网页下载并安装 Dell EMC Networking Ansible 角色例如
$ ansible-galaxy install dell-networking.dellos-users
$ ansible-galaxy install dell-networking.dellos-logging
$ ansible-galaxy install dell-networking.dellos-ntp
3. 创建用于存储清单和行动手册文件的目录例如
$ mkdir AnsibleOS10
4. 导航到目录并创建一个清单文件。
$ cd AnsibleOS10/
$ vim inventory.yaml
5. inventory.yaml 文件中的每个交换机添加 IP 地址和操作系统。在一个命令行上输入每个交换机的命令。
OS10switch-1 ansible_host=192.168.1.203 ansible_network_os=dellos10
OS10switch-2 ansible_host=192.168.1.204 ansible_network_os=dellos10
6. 创建用于特定于交换机的变量文件的 host_vars 目录。
$ mkdir host_vars
7. 创建主机变量文件例如host_vars/OS10switch-1.yaml。然后定义主机名称和登录凭据
$ vim host_vars/OS10switch-1.yaml
hostname: OS10switch-1
dellos_cfg_generate: True
build_dir: /home/user/config
ansible_ssh_user: admin
ansible_ssh_pass: admin
dellos_logging:
logging:
- ip: 1.1.1.1
state: present
dellos_users:
- username: u1
password: test@2468
role: sysadmin
privilege: 0
state: present
dellos_ntp:
server:
- ip: 3.3.3.3
$ vim host_vars/OS10switch-2.yaml
hostname: OS10switch-2
dellos_cfg_generate: True
build_dir: /home/user/config
ansible_ssh_user: admin
ansible_ssh_pass: admin
dellos_logging:
logging:
- ip: 1.1.1.1
state: present
dellos_users:
- username: u1
password: Test@1347
role: sysadmin
privilege: 0
OS10 调配 107