summaryrefslogtreecommitdiffstats
path: root/roles/lib_timedatectl
diff options
context:
space:
mode:
authorJoel Diaz <jdiaz@redhat.com>2016-04-08 13:48:13 -0400
committerJoel Diaz <jdiaz@redhat.com>2016-04-15 09:35:54 -0400
commit3681ab5fb2a39ccb06024e6ad514ad50df21f9d2 (patch)
tree5d1dd7da5404f431a60241a419155204a7784dcc /roles/lib_timedatectl
parent51e390459d7eda90c44d9ffd7f1199a3590beac1 (diff)
downloadopenshift-3681ab5fb2a39ccb06024e6ad514ad50df21f9d2.tar.gz
openshift-3681ab5fb2a39ccb06024e6ad514ad50df21f9d2.tar.bz2
openshift-3681ab5fb2a39ccb06024e6ad514ad50df21f9d2.tar.xz
openshift-3681ab5fb2a39ccb06024e6ad514ad50df21f9d2.zip
cleanup roles after roles move to openshift-tools
also removing inventory/multi_inventory* things left behind unchanged even though they were copied: playbooks/adhoc/* roles/dns roles/kube_nfs_volumes roles/os_update_latest
Diffstat (limited to 'roles/lib_timedatectl')
-rw-r--r--roles/lib_timedatectl/library/timedatectl.py74
1 files changed, 0 insertions, 74 deletions
diff --git a/roles/lib_timedatectl/library/timedatectl.py b/roles/lib_timedatectl/library/timedatectl.py
deleted file mode 100644
index b6eab5918..000000000
--- a/roles/lib_timedatectl/library/timedatectl.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-'''
- timedatectl ansible module
-
- This module supports setting ntp enabled
-'''
-import subprocess
-
-
-
-
-def do_timedatectl(options=None):
- ''' subprocess timedatectl '''
-
- cmd = ['/usr/bin/timedatectl']
- if options:
- cmd += options.split()
-
- proc = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE)
- proc.wait()
- return proc.stdout.read()
-
-def main():
- ''' Ansible module for timedatectl
- '''
-
- module = AnsibleModule(
- argument_spec=dict(
- #state=dict(default='enabled', type='str'),
- ntp=dict(default=True, type='bool'),
- ),
- #supports_check_mode=True
- )
-
- # do something
- ntp_enabled = False
-
- results = do_timedatectl()
-
- for line in results.split('\n'):
- if 'NTP enabled' in line:
- if 'yes' in line:
- ntp_enabled = True
-
- ########
- # Enable NTP
- ########
- if module.params['ntp']:
- if ntp_enabled:
- module.exit_json(changed=False, results="enabled", state="enabled")
-
- # Enable it
- # Commands to enable ntp
- else:
- results = do_timedatectl('set-ntp yes')
- module.exit_json(changed=True, results="enabled", state="enabled", cmdout=results)
-
- #########
- # Disable NTP
- #########
- else:
- if not ntp_enabled:
- module.exit_json(changed=False, results="disabled", state="disabled")
-
- results = do_timedatectl('set-ntp no')
- module.exit_json(changed=True, results="disabled", state="disabled")
-
- module.exit_json(failed=True, changed=False, results="Something went wrong", state="unknown")
-
-# Pylint is getting in the way of basic Ansible
-# pylint: disable=redefined-builtin,wildcard-import,unused-wildcard-import
-from ansible.module_utils.basic import *
-
-main()