|
| 1 | +roles: |
| 2 | +# Test is for basic smb deployment & functionality. one node cluster is OK |
| 3 | +- - host.a |
| 4 | + - mon.a |
| 5 | + - mgr.x |
| 6 | + - osd.0 |
| 7 | + - osd.1 |
| 8 | + - client.0 |
| 9 | +- - host.b |
| 10 | + - mon.b |
| 11 | + - osd.2 |
| 12 | + - osd.3 |
| 13 | +- - host.c |
| 14 | + - mon.c |
| 15 | + - osd.4 |
| 16 | + - osd.5 |
| 17 | +# Reserve a host for acting as a domain controller and smb client |
| 18 | +- - host.d |
| 19 | + - cephadm.exclude |
| 20 | +overrides: |
| 21 | + ceph: |
| 22 | + log-only-match: |
| 23 | + - CEPHADM_ |
| 24 | +tasks: |
| 25 | +- cephadm.deploy_samba_ad_dc: |
| 26 | + role: host.d |
| 27 | +- cephadm: |
| 28 | + |
| 29 | +- cephadm.shell: |
| 30 | + host.a: |
| 31 | + - ceph fs volume create cephfs |
| 32 | +- cephadm.wait_for_service: |
| 33 | + service: mds.cephfs |
| 34 | + |
| 35 | +- cephadm.shell: |
| 36 | + host.a: |
| 37 | + # add subvolgroup & subvolumes for test |
| 38 | + - cmd: ceph fs subvolumegroup create cephfs smb |
| 39 | + - cmd: ceph fs subvolume create cephfs sv1 --group-name=smb --mode=0777 |
| 40 | + - cmd: ceph fs subvolume create cephfs sv2 --group-name=smb --mode=0777 |
| 41 | + # set up smb cluster and shares |
| 42 | + - cmd: ceph mgr module enable smb |
| 43 | + # TODO: replace sleep with poll of mgr state? |
| 44 | + - cmd: sleep 30 |
| 45 | + - cmd: ceph smb apply -i - |
| 46 | + stdin: | |
| 47 | + # --- Begin Embedded YAML |
| 48 | + - resource_type: ceph.smb.cluster |
| 49 | + cluster_id: adctdb1 |
| 50 | + auth_mode: active-directory |
| 51 | + domain_settings: |
| 52 | + realm: DOMAIN1.SINK.TEST |
| 53 | + join_sources: |
| 54 | + - source_type: resource |
| 55 | + ref: join1-admin |
| 56 | + custom_dns: |
| 57 | + - "{{ctx.samba_ad_dc_ip}}" |
| 58 | + placement: |
| 59 | + count: 3 |
| 60 | + - resource_type: ceph.smb.join.auth |
| 61 | + auth_id: join1-admin |
| 62 | + auth: |
| 63 | + username: Administrator |
| 64 | + password: Passw0rd |
| 65 | + - resource_type: ceph.smb.share |
| 66 | + cluster_id: adctdb1 |
| 67 | + share_id: share1 |
| 68 | + cephfs: |
| 69 | + volume: cephfs |
| 70 | + subvolumegroup: smb |
| 71 | + subvolume: sv1 |
| 72 | + path: / |
| 73 | + - resource_type: ceph.smb.share |
| 74 | + cluster_id: adctdb1 |
| 75 | + share_id: share2 |
| 76 | + cephfs: |
| 77 | + volume: cephfs |
| 78 | + subvolumegroup: smb |
| 79 | + subvolume: sv2 |
| 80 | + path: / |
| 81 | + # --- End Embedded YAML |
| 82 | +# Wait for the smb service to start |
| 83 | +- cephadm.wait_for_service: |
| 84 | + service: smb.adctdb1 |
| 85 | +# Since this is a true cluster there should be a clustermeta in rados |
| 86 | +- cephadm.shell: |
| 87 | + host.a: |
| 88 | + - cmd: rados --pool=.smb -N adctdb1 get cluster.meta.json /dev/stdout |
| 89 | + |
| 90 | +# Check if shares exist |
| 91 | +- cephadm.exec: |
| 92 | + host.d: |
| 93 | + - sleep 30 |
| 94 | + - "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.a'|role_to_remote|attr('ip_address')}}/share1 -c ls" |
| 95 | + - "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.a'|role_to_remote|attr('ip_address')}}/share2 -c ls" |
| 96 | + |
| 97 | +# verify CTDB is healthy, cluster well formed |
| 98 | +- cephadm.exec: |
| 99 | + host.a: |
| 100 | + - "{{ctx.cephadm}} ls --no-detail | {{ctx.cephadm}} shell jq -r 'map(select(.name | startswith(\"smb.adctdb1\")))[-1].name' > /tmp/svcname" |
| 101 | + - "{{ctx.cephadm}} enter -n $(cat /tmp/svcname) ctdb status > /tmp/ctdb_status" |
| 102 | + - cat /tmp/ctdb_status |
| 103 | + - grep 'pnn:0 .*OK' /tmp/ctdb_status |
| 104 | + - grep 'pnn:1 .*OK' /tmp/ctdb_status |
| 105 | + - grep 'pnn:2 .*OK' /tmp/ctdb_status |
| 106 | + - grep 'Number of nodes:3' /tmp/ctdb_status |
| 107 | + - rm -rf /tmp/svcname /tmp/ctdb_status |
| 108 | + |
| 109 | +# Test a different host in the cluster |
| 110 | +- cephadm.exec: |
| 111 | + host.d: |
| 112 | + - sleep 30 |
| 113 | + - "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.c'|role_to_remote|attr('ip_address')}}/share1 -c ls" |
| 114 | + - "{{ctx.samba_client_container_cmd|join(' ')}} smbclient -U DOMAIN1\\\\ckent%1115Rose. //{{'host.c'|role_to_remote|attr('ip_address')}}/share2 -c ls" |
| 115 | + |
| 116 | +- cephadm.shell: |
| 117 | + host.a: |
| 118 | + - cmd: ceph smb apply -i - |
| 119 | + stdin: | |
| 120 | + # --- Begin Embedded YAML |
| 121 | + - resource_type: ceph.smb.cluster |
| 122 | + cluster_id: adctdb1 |
| 123 | + intent: removed |
| 124 | + - resource_type: ceph.smb.join.auth |
| 125 | + auth_id: join1-admin |
| 126 | + intent: removed |
| 127 | + - resource_type: ceph.smb.share |
| 128 | + cluster_id: adctdb1 |
| 129 | + share_id: share1 |
| 130 | + intent: removed |
| 131 | + - resource_type: ceph.smb.share |
| 132 | + cluster_id: adctdb1 |
| 133 | + share_id: share2 |
| 134 | + intent: removed |
| 135 | + # --- End Embedded YAML |
| 136 | +# Wait for the smb service to be removed |
| 137 | +- cephadm.wait_for_service_not_present: |
| 138 | + service: smb.adctdb1 |
0 commit comments