From e32b0da0b063f10700b6769cbab682087f4e376a Mon Sep 17 00:00:00 2001 From: Fabio Alessandro Locati Date: Sat, 10 Dec 2016 15:24:13 +0100 Subject: [PATCH] Improve examples - monitoring/logicmonitor_facts.py (#19158) --- .../modules/monitoring/logicmonitor_facts.py | 58 ++++++------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/lib/ansible/modules/monitoring/logicmonitor_facts.py b/lib/ansible/modules/monitoring/logicmonitor_facts.py index 5ade901a76a..39521a2b42b 100644 --- a/lib/ansible/modules/monitoring/logicmonitor_facts.py +++ b/lib/ansible/modules/monitoring/logicmonitor_facts.py @@ -120,46 +120,24 @@ options: ''' EXAMPLES = ''' -#example of querying a list of hosts -``` ---- -- hosts: hosts - user: root - vars: - company: 'yourcompany' - user: 'Luigi' - password: 'ImaLuigi,number1!' - tasks: - - name: query a list of hosts - # All tasks should use local_action - local_action: - logicmonitor_facts: - target: host - company: '{{ company }}' - user: '{{ user }}' - password: '{{ password }}' -``` - -#example of querying a hostgroup -``` ---- -- hosts: somemachine.superheroes.com - user: root - vars: - company: 'yourcompany' - user: 'mario' - password: 'itsame.Mario!' - tasks: - - name: query a host group - # All tasks should use local_action - local_action: - logicmonitor_facts: - target: hostgroup - fullpath: '/servers/production' - company: '{{ company }}' - user: '{{ user }}' - password: '{{ password }}' -``` +# Always run those modules on localhost using delegate_to:localhost, or localaction + +- name: query a list of hosts + logicmonitor_facts: + target: host + company: yourcompany + user: Luigi + password: ImaLuigi,number1! + delegate_to: localhost + +- name: query a host group + logicmonitor_facts: + target: hostgroup + fullpath: /servers/production + company: yourcompany + user: mario + password: itsame.Mario! + delegate_to: localhost '''