From ae340128e6e35873fb2e25c742babd56bad2120e Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 16 Nov 2018 15:07:15 +0000 Subject: [PATCH] Make ansible_host optional for all switch types The Juniper device support allows ansible_host variable to not be set for a switch, in which case the inventory_hostname will be used instead. This change applies this default consistently across all switch types. Change-Id: Ibc1e673a6b988f2e8d7bb6c62d30ccdb7ce96351 Story: 2004358 Task: 27958 --- ansible/group_vars/all/switches/dell | 2 +- ansible/group_vars/all/switches/dell-powerconnect | 2 +- ansible/group_vars/all/switches/mellanox | 2 +- doc/source/configuration/physical-network.rst | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ansible/group_vars/all/switches/dell b/ansible/group_vars/all/switches/dell index 56d61538e..4e3004e4c 100644 --- a/ansible/group_vars/all/switches/dell +++ b/ansible/group_vars/all/switches/dell @@ -7,7 +7,7 @@ # For DellOS switches, this defines a 'provider' argument to the dellos_* # modules. switch_dellos_provider: - host: "{{ ansible_host }}" + host: "{{ ansible_host|default(inventory_hostname) }}" username: "{{ ansible_user }}" password: "{{ ansible_ssh_pass }}" transport: cli diff --git a/ansible/group_vars/all/switches/dell-powerconnect b/ansible/group_vars/all/switches/dell-powerconnect index d98fc38b2..b6a188910 100644 --- a/ansible/group_vars/all/switches/dell-powerconnect +++ b/ansible/group_vars/all/switches/dell-powerconnect @@ -7,6 +7,6 @@ # For DellOS switches, this defines a 'provider' argument to the # dell_powerconnect_switch role. switch_dell_powerconnect_provider: - host: "{{ ansible_host }}" + host: "{{ ansible_host|default(inventory_hostname) }}" username: "{{ ansible_user }}" auth_pass: "{{ switch_auth_pass }}" diff --git a/ansible/group_vars/all/switches/mellanox b/ansible/group_vars/all/switches/mellanox index 7cb697916..759d77725 100644 --- a/ansible/group_vars/all/switches/mellanox +++ b/ansible/group_vars/all/switches/mellanox @@ -7,6 +7,6 @@ # For Mellanox switches, this defines a 'provider' argument to the # mellanox-switch role. switch_mellanox_provider: - host: "{{ ansible_host }}" + host: "{{ ansible_host|default(inventory_hostname) }}" username: "{{ ansible_user }}" auth_pass: "{{ switch_auth_pass }}" diff --git a/doc/source/configuration/physical-network.rst b/doc/source/configuration/physical-network.rst index 2903f0a36..77af47449 100644 --- a/doc/source/configuration/physical-network.rst +++ b/doc/source/configuration/physical-network.rst @@ -182,7 +182,7 @@ Configuration for these devices is applied using the ``dellos6_config`` and Provider ^^^^^^^^ -* ``ansible_host`` is the hostname or IP address. +* ``ansible_host`` is the hostname or IP address. Optional. * ``ansible_user`` is the SSH username. @@ -205,7 +205,7 @@ Configuration for these devices is applied using the Provider ^^^^^^^^ -* ``ansible_host`` is the hostname or IP address. +* ``ansible_host`` is the hostname or IP address. Optional. * ``ansible_user`` is the SSH username. @@ -254,7 +254,7 @@ Ansible module to automate interaction with the switch CLI via SSH. Provider ^^^^^^^^ -* ``ansible_host`` is the hostname or IP address. +* ``ansible_host`` is the hostname or IP address. Optional. * ``ansible_user`` is the SSH username.