QuestionQ81

Infrastructure and Automation

Drag the code options onto the missing locations in the snippet to complete this Ansible playbook. Not every option is used.

Drag & Drop
name-server
208.67.222.222
dns_servers
dns-address
---
- hosts: ios
  gather_facts: no
  vars:

    dns_servers:
      - ip name-server 
      - ip name-server 208.67.220.220

  tasks:

  - name: set name-server commands
    with_items: "{{  }}"
    ios_config:
      lines:
        - "{{item}}"
    register: set_dns
Explanation

with_items iterates over the dns_servers list, exposing each command as item. The IOS configuration module accepts an ordered lines list, so the task sends both complete ip name-server commands. The two OpenDNS resolver addresses in the list are 208.67.222.222 and 208.67.220.220.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!