eos_hostname
Manages hostname resource module
Collection: arista.eos
Full Name: arista.eos.eos_hostname
Controller module — runs on the local controller, not on remote hosts.
Synopsis
Manages hostname resource module
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| config | dict | |||
| running_config | str | |||
| state | str | merged |
Example
yaml
# Using state: merged
# Before state:
# -------------
# test#show running-config | section ^hostname
# hostname eos
# Merged play:
# ------------
- name: Apply the provided configuration
arista.eos.eos_hostname:
config:
hostname: eos
state: merged
# Commands Fired:
# ---------------
# "commands": [
# "hostname eos",
# ],
# After state:
# ------------
# test#show running-config | section ^hostname
# hostname eos
# Using state: deleted
# Before state:
# -------------
# test#show running-config | section ^hostname
# hostname eosTest
# Deleted play:
# -------------
- name: Remove all existing configuration
arista.eos.eos_hostname:
state: deleted
# Commands Fired:
# ---------------
# "commands": [
# "no hostname eosTest",
# ],
# After state:
# ------------
# test#show running-config | section ^hostname
# hostname eos
# Using state: overridden
# Before state:
# -------------
# test#show running-config | section ^hostname
# hostname eos
# Overridden play:
# ----------------
- name: Override commands with provided configuration
arista.eos.eos_hostname:
config:
hostname: eosTest
state: overridden
# Commands Fired:
# ---------------
# "commands": [
# "hostname eosTest",
# ],
# After state:
# ------------
# test#show running-config | section ^hostname
# hostname eosTest
# Using state: replaced
# Before state:
# -------------
# test#show running-config | section ^hostname
# hostname eosTest
# Replaced play:
# --------------
- name: Replace commands with provided configuration
arista.eos.eos_hostname:
config:
hostname: eosTest
state: replaced
# Commands Fired:
# ---------------
# "commands": [],
# After state:
# ------------
# test#show running-config | section ^hostname
# hostname eosTest
# Using state: gathered
# Before state:
# -------------
# test#show running-config | section ^hostname
# hostname eosTest
# Gathered play:
# --------------
- name: Gather listed hostname config
arista.eos.eos_hostname:
state: gathered
# Module Execution Result:
# ------------------------
# "gathered": {
# "hostname": "eosTest"
# },
# Using state: rendered
# Rendered play:
# --------------
- name: Render the commands for provided configuration
arista.eos.eos_hostname:
config:
hostname: eosTest
state: rendered
# Module Execution Result:
# ------------------------
# "rendered": [
# "hostname eosTest",
# ]
# Using state: parsed
# File: parsed.cfg
# ----------------
# hostname eosTest
# Parsed play:
# ------------
- name: Parse the provided configuration with the existing running configuration
arista.eos.eos_hostname:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
# "parsed": {
# "hostname": "eosTest"
# }