2014-09-26 01:01:01 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# Copyright 2012 Dag Wieers <dag@wieers.com>
|
Remove wildcard imports
Made the following changes:
* Removed wildcard imports
* Replaced long form of GPL header with short form
* Removed get_exception usage
* Added from __future__ boilerplate
* Adjust division operator to // where necessary
For the following files:
* web_infrastructure modules
* system modules
* linode, lxc, lxd, atomic, cloudscale, dimensiondata, ovh, packet,
profitbricks, pubnub, smartos, softlayer, univention modules
* compat dirs (disabled as its used intentionally)
2017-07-28 05:55:24 +00:00
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
|
|
|
|
2014-09-26 01:01:01 +00:00
|
|
|
|
2017-08-16 03:16:38 +00:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
2017-03-14 16:07:22 +00:00
|
|
|
'status': ['stableinterface'],
|
|
|
|
'supported_by': 'core'}
|
|
|
|
|
2016-12-06 10:35:05 +00:00
|
|
|
|
2014-09-26 01:01:01 +00:00
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
module: debug
|
|
|
|
short_description: Print statements during execution
|
|
|
|
description:
|
|
|
|
- This module prints statements during execution and can be useful
|
|
|
|
for debugging variables or expressions without necessarily halting
|
|
|
|
the playbook. Useful for debugging together with the 'when:' directive.
|
2017-06-26 15:26:53 +00:00
|
|
|
- This module is also supported for Windows targets.
|
2014-09-26 01:01:01 +00:00
|
|
|
version_added: "0.8"
|
|
|
|
options:
|
|
|
|
msg:
|
|
|
|
description:
|
|
|
|
- The customized message that is printed. If omitted, prints a generic
|
|
|
|
message.
|
|
|
|
required: false
|
|
|
|
default: "Hello world!"
|
|
|
|
var:
|
|
|
|
description:
|
|
|
|
- A variable name to debug. Mutually exclusive with the 'msg' option.
|
2016-02-18 15:01:39 +00:00
|
|
|
verbosity:
|
|
|
|
description:
|
|
|
|
- A number that controls when the debug is run, if you set to 3 it will only run debug when -vvv or above
|
|
|
|
required: False
|
|
|
|
default: 0
|
|
|
|
version_added: "2.1"
|
2017-06-26 15:26:53 +00:00
|
|
|
notes:
|
|
|
|
- This module is also supported for Windows targets.
|
2016-11-15 20:21:47 +00:00
|
|
|
author:
|
2015-06-15 19:53:30 +00:00
|
|
|
- "Dag Wieers (@dagwieers)"
|
|
|
|
- "Michael DeHaan"
|
2014-09-26 01:01:01 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
# Example that prints the loopback address and gateway for each host
|
2016-11-15 20:21:47 +00:00
|
|
|
- debug:
|
|
|
|
msg: "System {{ inventory_hostname }} has uuid {{ ansible_product_uuid }}"
|
2014-09-26 01:01:01 +00:00
|
|
|
|
2016-11-15 20:21:47 +00:00
|
|
|
- debug:
|
|
|
|
msg: "System {{ inventory_hostname }} has gateway {{ ansible_default_ipv4.gateway }}"
|
2014-09-26 01:01:01 +00:00
|
|
|
when: ansible_default_ipv4.gateway is defined
|
|
|
|
|
|
|
|
- shell: /usr/bin/uptime
|
|
|
|
register: result
|
|
|
|
|
2016-11-15 20:21:47 +00:00
|
|
|
- debug:
|
|
|
|
var: result
|
|
|
|
verbosity: 2
|
2014-09-26 01:01:01 +00:00
|
|
|
|
|
|
|
- name: Display all variables/facts known for a host
|
2016-11-15 20:21:47 +00:00
|
|
|
debug:
|
|
|
|
var: hostvars[inventory_hostname]
|
|
|
|
verbosity: 4
|
2014-09-26 01:01:01 +00:00
|
|
|
'''
|