diff --git a/README.md b/README.md index c91a60bcb049fb57f9afc4406c6761a92fd02424..061e3a5cf34b51e5a6d179e23457e71adaacde60 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ There are plugin parameters to define how the plugin will behave: **force** (optional, defaults to False): If an object already exists whether it should be updated **cache** (optional, defaults to None): Fully qualified filename for a cache of der Server Density data **cleanup** (optional, defaults to False): Decides if undefined alerts in your Ansible inventory available at Server Density should be deleted +**readonly** (optional, defaults to False): If set to True it will only read the current settings from SD and stores them in a temporary file and does nothing else. This is useful when you want to find out some variable names for alerts or similar things ##Installation## diff --git a/action_plugins/serverdensity.py b/action_plugins/serverdensity.py index a7f28039c20693f7bb4f62e4a4088948812740ef..3736351f3ac997b6b45ab4d54787eceeb0d4fa3e 100644 --- a/action_plugins/serverdensity.py +++ b/action_plugins/serverdensity.py @@ -44,11 +44,21 @@ class ActionModule(object): self.force_update = args.get('force', False) self.cache_file_name = args.get('cache', None) cleanup = args.get('cleanup', False) + just_download = args.get('readonly', False) + + if just_download: + self.force_update = False + self.cache_file_name = os.tmpnam() + cleanup = False result = {} self.list_all() + if just_download: + vv('Downloaded settings to %s' % self.cache_file_name) + return + services = {} devicegroup_alerts = {} servicegroup_alerts = {}