|
|
@ -87,21 +87,17 @@ EXAMPLES = """
|
|
|
|
s3_key_prefix='' region=us-east-1
|
|
|
|
s3_key_prefix='' region=us-east-1
|
|
|
|
|
|
|
|
|
|
|
|
- name: remove cloudtrail
|
|
|
|
- name: remove cloudtrail
|
|
|
|
local_action: cloudtrail state=absent name=main region=us-east-1
|
|
|
|
local_action: cloudtrail state=disabled name=main region=us-east-1
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
import time
|
|
|
|
HAS_BOTO = False
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
from collections import Counter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boto_import_failed = False
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
import boto
|
|
|
|
import boto
|
|
|
|
import boto.cloudtrail
|
|
|
|
import boto.cloudtrail
|
|
|
|
from boto.regioninfo import RegionInfo
|
|
|
|
from boto.regioninfo import RegionInfo
|
|
|
|
|
|
|
|
HAS_BOTO = True
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
boto_import_failed = True
|
|
|
|
HAS_BOTO = False
|
|
|
|
|
|
|
|
|
|
|
|
class CloudTrailManager:
|
|
|
|
class CloudTrailManager:
|
|
|
|
"""Handles cloudtrail configuration"""
|
|
|
|
"""Handles cloudtrail configuration"""
|
|
|
@ -152,9 +148,6 @@ class CloudTrailManager:
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
|
|
|
|
|
|
|
|
if not has_libcloud:
|
|
|
|
|
|
|
|
module.fail_json(msg='boto is required.')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec = ec2_argument_spec()
|
|
|
|
argument_spec.update(dict(
|
|
|
|
argument_spec.update(dict(
|
|
|
|
state={'required': True, 'choices': ['enabled', 'disabled'] },
|
|
|
|
state={'required': True, 'choices': ['enabled', 'disabled'] },
|
|
|
@ -166,6 +159,10 @@ def main():
|
|
|
|
required_together = ( ['state', 's3_bucket_name'] )
|
|
|
|
required_together = ( ['state', 's3_bucket_name'] )
|
|
|
|
|
|
|
|
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together)
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not HAS_BOTO:
|
|
|
|
|
|
|
|
module.fail_json(msg='boto is required.')
|
|
|
|
|
|
|
|
|
|
|
|
ec2_url, access_key, secret_key, region = get_ec2_creds(module)
|
|
|
|
ec2_url, access_key, secret_key, region = get_ec2_creds(module)
|
|
|
|
aws_connect_params = dict(aws_access_key_id=access_key,
|
|
|
|
aws_connect_params = dict(aws_access_key_id=access_key,
|
|
|
|
aws_secret_access_key=secret_key)
|
|
|
|
aws_secret_access_key=secret_key)
|
|
|
|