Skip to content

Commit 740b201

Browse files
Missing modules added
1 parent 12bb83e commit 740b201

9 files changed

Lines changed: 705 additions & 4 deletions

File tree

plugins/action/content.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import (absolute_import, division, print_function)
2+
3+
__metaclass__ = type
4+
5+
from ..module_utils.action import AemActionBase
6+
7+
8+
class ActionModule(AemActionBase):
9+
pass

plugins/action/instance_backup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import (absolute_import, division, print_function)
2+
3+
__metaclass__ = type
4+
5+
from ..module_utils.action import AemActionBase
6+
7+
8+
class ActionModule(AemActionBase):
9+
pass

plugins/action/oak.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import (absolute_import, division, print_function)
2+
3+
__metaclass__ = type
4+
5+
from ..module_utils.action import AemActionBase
6+
7+
8+
class ActionModule(AemActionBase):
9+
pass

plugins/action/replication.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from __future__ import (absolute_import, division, print_function)
2+
3+
__metaclass__ = type
4+
5+
from ..module_utils.action import AemActionBase
6+
7+
8+
class ActionModule(AemActionBase):
9+
pass

plugins/modules/content.py

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
#!/usr/bin/python
2+
3+
from __future__ import (absolute_import, division, print_function)
4+
__metaclass__ = type
5+
6+
from ansible.module_utils.basic import AnsibleModule
7+
from ..module_utils.cli import AEMC, AEMC_arg_spec
8+
9+
DOCUMENTATION = r'''
10+
---
11+
module: content
12+
13+
short_description: Manages JCR content on AEM instance(s)
14+
15+
version_added: "1.4.0"
16+
17+
description:
18+
- Clean, download, pull, push, and copy JCR content between AEM instances.
19+
- Supports Vault filter files and filter roots for selective content operations.
20+
21+
options:
22+
command:
23+
description:
24+
- The content operation to perform.
25+
- C(clean) - Normalize content files.
26+
- C(download) - Download content from instance to local file.
27+
- C(pull) - Pull content from instance and unpack to JCR root directory.
28+
- C(push) - Push content from JCR root directory to instance.
29+
- C(copy) - Copy content between instances.
30+
required: true
31+
type: str
32+
choices: ['clean', 'download', 'pull', 'push', 'copy']
33+
instance_id:
34+
description: Use only AEM instance with specified ID.
35+
type: str
36+
dir:
37+
description: JCR root directory path.
38+
type: str
39+
file:
40+
description: Local file path.
41+
type: str
42+
path:
43+
description: JCR root path or local file path.
44+
type: str
45+
filter_roots:
46+
description: Vault filter root paths.
47+
type: list
48+
elements: str
49+
filter_file:
50+
description: Vault filter file path.
51+
type: str
52+
target_file:
53+
description: File path for downloaded package.
54+
type: str
55+
target_pid:
56+
description: Package ID (group:name:version) for downloaded package.
57+
type: str
58+
clean:
59+
description: Normalize content during operation.
60+
type: bool
61+
replace:
62+
description: Replace content after downloading (for pull command).
63+
type: bool
64+
filter_mode:
65+
description: Override default filter mode (for push command).
66+
type: str
67+
instance_target_url:
68+
description: Destination instance URL(s) for copy command.
69+
type: list
70+
elements: str
71+
instance_target_id:
72+
description: Destination instance ID(s) for copy command.
73+
type: list
74+
elements: str
75+
76+
author:
77+
- Krystian Panek (krystian.panek@wundermanthompson.com)
78+
'''
79+
80+
EXAMPLES = r'''
81+
- name: Clean content directory
82+
wttech.aem.content:
83+
command: clean
84+
path: /path/to/jcr_root/content/mysite
85+
86+
- name: Download content from instance
87+
wttech.aem.content:
88+
command: download
89+
instance_id: local_author
90+
filter_roots:
91+
- /content/mysite
92+
- /content/dam/mysite
93+
target_file: /tmp/content.zip
94+
95+
- name: Pull content from instance
96+
wttech.aem.content:
97+
command: pull
98+
instance_id: local_author
99+
dir: /path/to/jcr_root/content/mysite
100+
filter_roots:
101+
- /content/mysite
102+
clean: true
103+
104+
- name: Push content to instance
105+
wttech.aem.content:
106+
command: push
107+
instance_id: local_author
108+
dir: /path/to/jcr_root/content/mysite
109+
110+
- name: Copy content between instances
111+
wttech.aem.content:
112+
command: copy
113+
instance_id: local_author
114+
instance_target_id:
115+
- local_publish
116+
filter_roots:
117+
- /content/mysite
118+
'''
119+
120+
RETURN = r'''
121+
'''
122+
123+
124+
def run_module():
125+
module = AnsibleModule(
126+
argument_spec=AEMC_arg_spec(dict(
127+
command=dict(type='str', required=True, choices=['clean', 'download', 'pull', 'push', 'copy']),
128+
instance_id=dict(type='str'),
129+
dir=dict(type='str'),
130+
file=dict(type='str'),
131+
path=dict(type='str'),
132+
filter_roots=dict(type='list', elements='str'),
133+
filter_file=dict(type='str'),
134+
target_file=dict(type='str'),
135+
target_pid=dict(type='str'),
136+
clean=dict(type='bool'),
137+
replace=dict(type='bool'),
138+
filter_mode=dict(type='str'),
139+
instance_target_url=dict(type='list', elements='str'),
140+
instance_target_id=dict(type='list', elements='str'),
141+
)),
142+
required_if=[
143+
('command', 'clean', ['dir', 'file', 'path'], True),
144+
('command', 'download', ['target_file']),
145+
('command', 'download', ['filter_roots', 'filter_file'], True),
146+
('command', 'pull', ['dir', 'file', 'path'], True),
147+
('command', 'push', ['dir', 'file', 'path'], True),
148+
('command', 'copy', ['filter_roots', 'filter_file'], True),
149+
('command', 'copy', ['instance_target_url', 'instance_target_id'], True),
150+
],
151+
mutually_exclusive=[
152+
['dir', 'file', 'path'],
153+
['filter_roots', 'filter_file'],
154+
['instance_target_url', 'instance_target_id'],
155+
]
156+
)
157+
aemc = AEMC(module)
158+
command = module.params['command']
159+
160+
args = ['content', command]
161+
162+
instance_id = module.params['instance_id']
163+
if instance_id:
164+
args.extend(['--instance-id', instance_id])
165+
166+
dir_param = module.params['dir']
167+
if dir_param:
168+
args.extend(['--dir', dir_param])
169+
170+
file_param = module.params['file']
171+
if file_param:
172+
args.extend(['--file', file_param])
173+
174+
path = module.params['path']
175+
if path:
176+
args.extend(['--path', path])
177+
178+
filter_roots = module.params['filter_roots']
179+
if filter_roots:
180+
for root in filter_roots:
181+
args.extend(['--filter-roots', root])
182+
183+
filter_file = module.params['filter_file']
184+
if filter_file:
185+
args.extend(['--filter-file', filter_file])
186+
187+
target_file = module.params['target_file']
188+
if target_file:
189+
args.extend(['--target-file', target_file])
190+
191+
target_pid = module.params['target_pid']
192+
if target_pid:
193+
args.extend(['--target-pid', target_pid])
194+
195+
clean = module.params['clean']
196+
if clean is not None:
197+
args.extend(['--clean', 'true' if clean else 'false'])
198+
199+
replace = module.params['replace']
200+
if replace is not None:
201+
args.extend(['--replace', 'true' if replace else 'false'])
202+
203+
filter_mode = module.params['filter_mode']
204+
if filter_mode:
205+
args.extend(['--filter-mode', filter_mode])
206+
207+
instance_target_url = module.params['instance_target_url']
208+
if instance_target_url:
209+
for url in instance_target_url:
210+
args.extend(['--instance-target-url', url])
211+
212+
instance_target_id = module.params['instance_target_id']
213+
if instance_target_id:
214+
for target_id in instance_target_id:
215+
args.extend(['--instance-target-id', target_id])
216+
217+
aemc.handle_json(args=args)
218+
219+
220+
def main():
221+
run_module()
222+
223+
224+
if __name__ == '__main__':
225+
main()

plugins/modules/crypto.py

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,52 @@
1111
---
1212
module: crypto
1313
14-
short_description: Manages Crypto Support
14+
short_description: Manages AEM Crypto Support
1515
1616
version_added: "1.0.28"
1717
18+
description:
19+
- Manage AEM crypto keys and encrypt/decrypt values.
20+
- Supports key generation, protection, and file-based key management.
21+
22+
options:
23+
command:
24+
description:
25+
- The crypto operation to perform.
26+
- C(key) - Generate or manage crypto keys.
27+
- C(protect) - Protect (encrypt) a plain text value.
28+
required: true
29+
type: str
30+
choices: ['key', 'protect']
31+
instance_id:
32+
description: Use only AEM instance with specified ID.
33+
type: str
34+
hmac_file:
35+
description: Path to HMAC key file.
36+
type: str
37+
master_file:
38+
description: Path to master key file.
39+
type: str
40+
value:
41+
description: Plain text value to protect (encrypt). Required for protect command.
42+
type: str
43+
no_log: true
44+
1845
author:
1946
- Krystian Panek (krystian.panek@wundermanthompson.com)
2047
'''
2148

2249
EXAMPLES = r'''
50+
- name: Generate crypto keys
51+
wttech.aem.crypto:
52+
command: key
53+
instance_id: local_author
54+
55+
- name: Protect a plain text value
56+
wttech.aem.crypto:
57+
command: protect
58+
instance_id: local_author
59+
value: "my-secret-password"
2360
'''
2461

2562
RETURN = r'''
@@ -29,11 +66,15 @@
2966
def run_module():
3067
module = AnsibleModule(
3168
argument_spec=AEMC_arg_spec(dict(
32-
command=dict(type='str', required=True),
69+
command=dict(type='str', required=True, choices=['key', 'protect']),
3370
instance_id=dict(type='str'),
3471
hmac_file=dict(type='str'),
3572
master_file=dict(type='str'),
36-
))
73+
value=dict(type='str', no_log=True),
74+
)),
75+
required_if=[
76+
('command', 'protect', ['value']),
77+
],
3778
)
3879
aemc = AEMC(module)
3980
command = module.params['command']
@@ -49,9 +90,13 @@ def run_module():
4990
args.extend(['--hmac-file', hmac_file])
5091

5192
master_file = module.params['master_file']
52-
if hmac_file:
93+
if master_file:
5394
args.extend(['--master-file', master_file])
5495

96+
value = module.params['value']
97+
if value:
98+
args.extend(['--value', value])
99+
55100
aemc.handle_json(args=args)
56101

57102

0 commit comments

Comments
 (0)