1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
import logging
import yaml
from teuthology import misc as teuthology
log = logging.getLogger(__name__)
def _shell(ctx, cluster_name, remote, args, extra_cephadm_args=[], **kwargs):
teuthology.get_testdir(ctx)
return remote.run(
args=[
'sudo',
ctx.cephadm,
'--image', ctx.ceph[cluster_name].image,
'shell',
'-c', '/etc/ceph/{}.conf'.format(cluster_name),
'-k', '/etc/ceph/{}.client.admin.keyring'.format(cluster_name),
'--fsid', ctx.ceph[cluster_name].fsid,
] + extra_cephadm_args + [
'--',
] + args,
**kwargs
)
def apply(ctx, config):
"""
Apply spec
tasks:
- rgw_module.apply:
specs:
- rgw_realm: myrealm1
rgw_zonegroup: myzonegroup1
rgw_zone: myzone1
placement:
hosts:
- ceph-node-0
- ceph-node-1
spec:
rgw_frontend_port: 5500
"""
cluster_name = config.get('cluster', 'ceph')
specs = config.get('specs', [])
y = yaml.dump_all(specs)
log.info(f'Applying spec(s):\n{y}')
_shell(
ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote,
['ceph', 'rgw', 'realm', 'bootstrap', '-i', '-'],
stdin=y,
)
|