From 3dda38a90f2b951f8bd4c815b31bd1286aba2307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Fri, 21 Oct 2016 08:46:59 +0200 Subject: [PATCH] doc: add_host: add example without deprecated vars (#5323) ansible_ssh_* are deprecated since 2.0 --- lib/ansible/modules/inventory/add_host.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/inventory/add_host.py b/lib/ansible/modules/inventory/add_host.py index ef01ed1051b..d2873e28f85 100644 --- a/lib/ansible/modules/inventory/add_host.py +++ b/lib/ansible/modules/inventory/add_host.py @@ -37,7 +37,7 @@ options: notes: - This module bypasses the play host loop and only runs once for all the hosts in the play, if you need it to iterate use a with\_ directive. -author: +author: - "Ansible Core Team" - "Seth Vidal" ''' @@ -49,8 +49,13 @@ EXAMPLES = ''' # add a host with a non-standard port local to your machines - add_host: name={{ new_ip }}:{{ new_port }} -# add a host alias that we reach through a tunnel +# add a host alias that we reach through a tunnel (Ansible <= 1.9) - add_host: hostname={{ new_ip }} ansible_ssh_host={{ inventory_hostname }} ansible_ssh_port={{ new_port }} + +# add a host alias that we reach through a tunnel (Ansible >= 2.0) +- add_host: hostname={{ new_ip }} + ansible_host={{ inventory_hostname }} + ansible_port={{ new_port }} '''