2017-02-27 11:44:09 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# (c) 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
|
|
|
|
|
2017-02-27 11:44:09 +00:00
|
|
|
|
2017-03-14 16:07:22 +00:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.0',
|
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
2017-02-27 11:44:09 +00:00
|
|
|
|
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
module: hponcfg
|
|
|
|
author: Dag Wieers (@dagwieers)
|
|
|
|
version_added: "2.3"
|
|
|
|
short_description: Configure HP iLO interface using hponcfg
|
|
|
|
description:
|
|
|
|
- This modules configures the HP iLO interface using hponcfg.
|
|
|
|
options:
|
|
|
|
path:
|
|
|
|
description:
|
|
|
|
- The XML file as accepted by hponcfg
|
|
|
|
required: true
|
|
|
|
aliases: ['src']
|
|
|
|
minfw:
|
|
|
|
description:
|
|
|
|
- The minimum firmware level needed
|
|
|
|
requirements:
|
|
|
|
- hponcfg tool
|
|
|
|
notes:
|
|
|
|
- You need a working hponcfg on the target system.
|
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
- name: Example hponcfg configuration XML
|
|
|
|
copy:
|
|
|
|
content: |
|
|
|
|
<ribcl VERSION="2.0">
|
|
|
|
<login USER_LOGIN="user" PASSWORD="password">
|
|
|
|
<rib_info MODE="WRITE">
|
|
|
|
<mod_global_settings>
|
|
|
|
<session_timeout value="0"/>
|
|
|
|
<ssh_status value="Y"/>
|
|
|
|
<ssh_port value="22"/>
|
|
|
|
<serial_cli_status value="3"/>
|
|
|
|
<serial_cli_speed value="5"/>
|
|
|
|
</mod_global_settings>
|
|
|
|
</rib_info>
|
|
|
|
</login>
|
|
|
|
</ribcl>
|
|
|
|
dest: /tmp/enable-ssh.xml
|
|
|
|
|
|
|
|
- name: Configure HP iLO using enable-ssh.xml
|
|
|
|
hponcfg:
|
|
|
|
src: /tmp/enable-ssh.xml
|
|
|
|
'''
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
|
2017-08-04 09:52:31 +00:00
|
|
|
|
2017-02-27 11:44:09 +00:00
|
|
|
def main():
|
|
|
|
|
|
|
|
module = AnsibleModule(
|
2017-08-04 09:52:31 +00:00
|
|
|
argument_spec=dict(
|
|
|
|
src=dict(type='path', required=True, aliases=['path']),
|
|
|
|
minfw=dict(type='str'),
|
2017-02-27 11:44:09 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Consider every action a change (not idempotent yet!)
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
src = module.params['src']
|
|
|
|
minfw = module.params['minfw']
|
|
|
|
|
|
|
|
options = ' -f %s' % src
|
|
|
|
|
|
|
|
# Add -v for debugging
|
|
|
|
# options += ' -v'
|
|
|
|
|
|
|
|
if minfw:
|
2017-07-23 01:15:46 +00:00
|
|
|
options += ' -m %s' % minfw
|
2017-02-27 11:44:09 +00:00
|
|
|
|
|
|
|
rc, stdout, stderr = module.run_command('hponcfg %s' % options)
|
|
|
|
|
|
|
|
if rc != 0:
|
|
|
|
module.fail_json(rc=rc, msg="Failed to run hponcfg", stdout=stdout, stderr=stderr)
|
|
|
|
|
|
|
|
module.exit_json(changed=changed, stdout=stdout, stderr=stderr)
|
|
|
|
|
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
|
|
|
|
2017-02-27 11:44:09 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|