From 20e246de8f628e23d372c6ccdacea529acbbfba7 Mon Sep 17 00:00:00 2001 From: Nolan Brubaker Date: Tue, 25 Oct 2016 17:39:54 -0400 Subject: [PATCH] Remove ansible_ssh_host variable from inventory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to upstream Ansible deprecating the `ansible_ssh_host` variable, this key is removed from the generated inventory in order to avoid confusion. While Newton also supports Ansible 2.x, this change is intended to only be in effect from Ocata forward. From http://docs.ansible.com/ansible/intro_inventory.html#hosts-and-groups: "Ansible 2.0 has deprecated the “ssh” from ansible_ssh_user, ansible_ssh_host, and ansible_ssh_port to become ansible_user, ansible_host, and ansible_port. If you are using a version of Ansible prior to 2.0, you should continue using the older style variables (ansible_ssh_*). These shorter variables are ignored, without warning, in older versions of Ansible." Fixes-Bug: #1636606 Change-Id: If43b28247a9df3db76217b1147fab785f1235532 --- lib/generate.py | 8 ++------ .../ansible_ssh_host_var_removed-984abb4bbeb17366.yaml | 6 ++++++ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/ansible_ssh_host_var_removed-984abb4bbeb17366.yaml diff --git a/lib/generate.py b/lib/generate.py index ccf0edb993..e8aaf2608e 100755 --- a/lib/generate.py +++ b/lib/generate.py @@ -42,7 +42,6 @@ INVENTORY_SKEL = { REQUIRED_HOSTVARS = [ 'properties', 'ansible_host', - 'ansible_ssh_host', 'physical_host_group', 'container_address', 'container_name', @@ -244,7 +243,6 @@ def _build_container_hosts(container_affinity, container_hosts, type_and_name, hostvars_options.update({ 'properties': properties, 'ansible_host': address, - 'ansible_ssh_host': address, 'container_address': address, 'container_name': container_host_name, 'physical_host': host_type, @@ -459,7 +457,6 @@ def user_defined_setup(config, inventory): hvs[_key].update({ 'ansible_host': _value['ip'], - 'ansible_ssh_host': _value['ip'], 'container_address': _value['ip'], 'is_metal': True, 'physical_host_group': key @@ -590,7 +587,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface, :param netmask: ``str`` netmask to use. :param interface: ``str`` interface name to set for the network. :param user_config: ``dict`` user defined configuration details. - :param is_ssh_address: ``bol`` set this address as ansible_ssh_host. + :param is_ssh_address: ``bol`` set this address as ansible_host. :param is_container_address: ``bol`` set this address to container_address. :param static_routes: ``list`` List containing static route dicts. """ @@ -684,7 +681,6 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface, if is_ssh_address is True: container['ansible_host'] = networks[old_address]['address'] - container['ansible_ssh_host'] = networks[old_address]['address'] if is_container_address is True: container['container_address'] = networks[old_address]['address'] @@ -1235,7 +1231,7 @@ def main(config=None, check=False, debug=False, environment=None, **kwargs): for _host, _vars in dynamic_inventory['_meta']['hostvars'].iteritems(): host_hash = hostnames_ips[_host] = {} for _key, _value in _vars.iteritems(): - if _key.endswith('address') or _key == 'ansible_ssh_host': + if _key.endswith('address') or _key == 'ansible_host': host_hash[_key] = _value # Save a list of all hosts and their given IP addresses diff --git a/releasenotes/notes/ansible_ssh_host_var_removed-984abb4bbeb17366.yaml b/releasenotes/notes/ansible_ssh_host_var_removed-984abb4bbeb17366.yaml new file mode 100644 index 0000000000..85805c3b4c --- /dev/null +++ b/releasenotes/notes/ansible_ssh_host_var_removed-984abb4bbeb17366.yaml @@ -0,0 +1,6 @@ +--- +upgrades: + - The `ansible_ssh_host` variable is removed in favor of `ansible_host`. + Generated inventory will no longer contain the `ssh` variant. For more + details, see + http://docs.ansible.com/ansible/intro_inventory.html#hosts-and-groups.