#NEWLINE# def main( ) : #NEWLINE# #INDENT# BASE_MODULE_ARGS = dict ( cadir = dict ( default = '/etc/certs' ) , hostname = dict ( required = True ) , store_password = dict ( required = True ) , hosts_to_trust = dict ( required = True , type = 'list' ) , state = dict ( default = 'present' , choices = [ 'present' , 'absent' ] ) ) #NEWLINE# module = AnsibleModule ( argument_spec = BASE_MODULE_ARGS , supports_check_mode = True ) #NEWLINE# keytool = Keytool ( module . params [ 'cadir' ] , module . params [ 'hostname' ] , module . params [ 'store_password' ] , module . params [ 'hosts_to_trust' ] ) #NEWLINE# isValid = keytool . validate ( ) #NEWLINE# if isValid [ 'success' ] : #NEWLINE# #INDENT# if ( module . params [ 'state' ] == 'present' ) : #NEWLINE# #INDENT# isValid = keytool . build_trust_store ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# isValid = keytool . remove_trust_store ( ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not isValid [ 'success' ] ) : #NEWLINE# #INDENT# module . fail_json ( msg = isValid [ 'msg' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# module . exit_json ( ** isValid )