-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from wttech/Support_management_of_certificates…
…_in_aem_global_trust_store_ Support management of certificates in aem global trust store
- Loading branch information
Showing
5 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- name: Test instances | ||
hosts: localhost | ||
tasks: | ||
|
||
# Gts tests | ||
|
||
- name: Get status of GTS | ||
wttech.aem.gts: | ||
command: status | ||
instance_id: local_author | ||
|
||
- name: Create GTS | ||
wttech.aem.gts: | ||
command: create | ||
instance_id: local_author | ||
password: test | ||
|
||
- name: Add Cert to GTS | ||
wttech.aem.gts_certificate: | ||
command: add | ||
instance_id: local_author | ||
path: ~/projects/data/cert.cer | ||
register: cert_data | ||
|
||
- name: Read Cert from GTS | ||
wttech.aem.gts_certificate: | ||
command: read | ||
instance_id: local_author | ||
alias: "{{ cert_data.data.added }}" | ||
|
||
- name: Remove Cert from GTS | ||
wttech.aem.gts_certificate: | ||
command: remove | ||
instance_id: local_author | ||
alias: "{{ cert_data.data.added }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
|
||
__metaclass__ = type | ||
|
||
from ..module_utils.action import AemActionBase | ||
|
||
|
||
class ActionModule(AemActionBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from __future__ import (absolute_import, division, print_function) | ||
|
||
__metaclass__ = type | ||
|
||
from ..module_utils.action import AemActionBase | ||
|
||
|
||
class ActionModule(AemActionBase): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/python | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ..module_utils.cli import AEMC, AEMC_arg_spec | ||
|
||
DOCUMENTATION = r''' | ||
--- | ||
module: gts_certificate | ||
short_description: Communicate with Global Trust Store | ||
version_added: "1.3.6" | ||
author: | ||
- Jan Kowalczyk ([email protected]) | ||
''' | ||
|
||
EXAMPLES = r''' | ||
''' | ||
|
||
RETURN = r''' | ||
''' | ||
|
||
|
||
def run_module(): | ||
module = AnsibleModule( | ||
argument_spec=AEMC_arg_spec(dict( | ||
command=dict(type='str', required=True), | ||
instance_id=dict(type='str'), | ||
password=dict(type='str'), | ||
)), | ||
required_if=[ | ||
('command', 'create', ['instance_id','password']), | ||
('command', 'status', ['instance_id']), | ||
] | ||
) | ||
aemc = AEMC(module) | ||
command = module.params['command'] | ||
|
||
args = ['gts', command] | ||
|
||
instance_id = module.params['instance_id'] | ||
if instance_id: | ||
args.extend(['--instance-id', instance_id]) | ||
|
||
password = module.params['password'] | ||
if password: | ||
args.extend(['--password', password]) | ||
|
||
aemc.handle_json(args=args) | ||
|
||
|
||
def main(): | ||
run_module() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/python | ||
|
||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
from ..module_utils.cli import AEMC, AEMC_arg_spec | ||
|
||
DOCUMENTATION = r''' | ||
--- | ||
module: gts_certificate | ||
short_description: Manage certificates in Global Trust Store | ||
version_added: "1.3.6" | ||
author: | ||
- Jan Kowalczyk ([email protected]) | ||
''' | ||
|
||
EXAMPLES = r''' | ||
''' | ||
|
||
RETURN = r''' | ||
''' | ||
|
||
|
||
def run_module(): | ||
module = AnsibleModule( | ||
argument_spec=AEMC_arg_spec(dict( | ||
command=dict(type='str', required=True), | ||
instance_id=dict(type='str'), | ||
alias=dict(type='str'), | ||
path=dict(type='str'), | ||
)), | ||
required_if=[ | ||
('command', 'add', ['instance_id','path']), | ||
('command', 'remove', ['instance_id','alias']), | ||
('command', 'read', ['instance_id','alias']), | ||
] | ||
) | ||
|
||
aemc = AEMC(module) | ||
command = module.params['command'] | ||
|
||
args = ['gts', 'certificate', command] | ||
|
||
instance_id = module.params['instance_id'] | ||
if instance_id: | ||
args.extend(['--instance-id', instance_id]) | ||
|
||
alias = module.params['alias'] | ||
if alias: | ||
args.extend(['--alias', alias]) | ||
|
||
path = module.params['path'] | ||
if path: | ||
args.extend(['--path', path]) | ||
|
||
aemc.handle_json(args=args) | ||
|
||
|
||
def main(): | ||
run_module() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |