Bookmark this page

Configuring System Settings

Objectives

After completing this section, you should be able to make basic configuration settings such as the DNS name servers or domain name on Cisco IOS and VyOS network devices.

Contextualizing Configuration Statements

By default, configuration statements apply to the top level or global command context. The parents keyword applies a command or set of command lines in the context of a parent command.

The following task sets commands at the global level:

- name: configure top level commands
  ios_config:
    lines:
      - hostname {{ inventory_hostname }}
      - domain-name {{ domain_name }}
      - ip name-server {{ nameserver1 }}
      - username {{ ansible_user }} privilege 15 secret {{ ansible_ssh_pass }}

The following task applies commands within the context of a given interface:

- name: configure an interface
  ios_config:
    lines:
      - switchport access vlan {{ interface.vlan }}
      - description: {{ interface.description }}
      - no shutdown
    parents: interface {{ interface.name }}
Revision: do457-2.5-4693601