]>
Commit | Line | Data |
---|---|---|
a4b75251 TL |
1 | tasks: |
2 | - vip: | |
3 | ||
4 | # make sure cephadm notices the new IP | |
5 | - cephadm.shell: | |
6 | host.a: | |
7 | - ceph orch device ls --refresh | |
8 | ||
9 | # stop kernel nfs server, if running | |
10 | - vip.exec: | |
11 | all-hosts: | |
12 | - systemctl stop nfs-server | |
13 | ||
14 | - cephadm.shell: | |
15 | host.a: | |
16 | - ceph orch apply rgw foorgw --port 8800 | |
17 | - ceph nfs cluster create foo --ingress --virtual-ip {{VIP0}}/{{VIPPREFIXLEN}} | |
18 | ||
19 | - vip.exec: | |
20 | host.a: | |
21 | - dnf install -y python3-boto3 || apt install -y python3-boto3 | |
22 | - /home/ubuntu/cephtest/cephadm shell radosgw-admin user create --uid foouser --display-name foo > /tmp/user.json | |
23 | ||
24 | - python: | |
25 | host.a: | | |
26 | import boto3 | |
27 | import json | |
28 | ||
29 | with open('/tmp/user.json', 'rt') as f: | |
30 | info = json.loads(f.read()) | |
31 | s3 = boto3.resource( | |
32 | 's3', | |
33 | aws_access_key_id=info['keys'][0]['access_key'], | |
34 | aws_secret_access_key=info['keys'][0]['secret_key'], | |
35 | endpoint_url='http://localhost:8800', | |
36 | ) | |
37 | bucket = s3.Bucket('foobucket') | |
38 | bucket.create() | |
39 | bucket.put_object(Key='myobject', Body='thebody') | |
40 | ||
41 | - cephadm.shell: | |
42 | host.a: | |
43 | - ceph nfs export create rgw --cluster-id foo --pseudo-path /foouser --user-id foouser | |
44 | ||
45 | - cephadm.wait_for_service: | |
46 | service: nfs.foo | |
47 | - cephadm.wait_for_service: | |
48 | service: ingress.nfs.foo | |
49 | ||
50 | ## export and mount | |
51 | ||
52 | - vip.exec: | |
53 | host.a: | |
54 | - mkdir /mnt/foo | |
55 | - sleep 5 | |
56 | - mount -t nfs {{VIP0}}:/foouser /mnt/foo | |
57 | - test -d /mnt/foo/foobucket | |
58 | - find /mnt/foo -ls | |
59 | - grep thebody /mnt/foo/foobucket/myobject | |
60 | - echo test > /mnt/foo/foobucket/newobject | |
61 | - sync | |
62 | ||
63 | - python: | |
64 | host.a: | | |
65 | import boto3 | |
66 | import json | |
67 | from io import BytesIO | |
68 | ||
69 | with open('/tmp/user.json', 'rt') as f: | |
70 | info = json.loads(f.read()) | |
71 | s3 = boto3.resource( | |
72 | 's3', | |
73 | aws_access_key_id=info['keys'][0]['access_key'], | |
74 | aws_secret_access_key=info['keys'][0]['secret_key'], | |
75 | endpoint_url='http://localhost:8800', | |
76 | ) | |
77 | bucket = s3.Bucket('foobucket') | |
78 | data = BytesIO() | |
79 | bucket.download_fileobj(Fileobj=data, Key='newobject') | |
80 | print(data.getvalue()) | |
81 | assert data.getvalue().decode() == 'test\n' | |
82 | ||
83 | - vip.exec: | |
84 | host.a: | |
85 | - umount /mnt/foo | |
86 | ||
87 | - cephadm.shell: | |
88 | host.a: | |
89 | - ceph nfs export rm foo /foouser | |
90 | - ceph nfs cluster rm foo |