Declarative method configuration example
Learn how to set up an SMB cluster and share by using the declarative method with the example.
Using the resource descriptions, the following example creates a cluster and shares from scratch, based on a resource configuration file.
- Create the YAML with the required configurations.
resources: # Define an AD member server cluster - resource_type: ceph.smb.cluster cluster_id: tango auth_mode: active-directory domain_settings: realm: DOMAIN1.SINK.TEST join_sources: - source_type: resource ref: join1-admin custom_dns: - "192.168.76.204" # deploy 1 set of samba containers on a host labeled "ilovesmb" placement: count: 1 label: ilovesmb # Define a join auth that our cluster will use to join AD # Warning: Typically you do not want to use the Administrator user # to perform joins on a production AD - resource_type: ceph.smb.join.auth auth_id: join1-admin auth: username: Administrator password: Passw0rd # A share that uses the root of a subvolume # The share name is the same as its id - resource_type: ceph.smb.share cluster_id: tango share_id: cache cephfs: volume: cephfs subvolumegroup: smb1 subvolume: cache path: / # A share that uses the a sub-dir of a subvolume # The share name is not the same as its id - resource_type: ceph.smb.share cluster_id: tango share_id: sp1 name: "Staff Pics" cephfs: volume: cephfs path: /pics subvolumegroup: smb1 subvolume: staff - Save the YAML file as resources.yaml, and make it available on a cluster admin host.
- Apply the YAML file.
The command shows a summary of the changes that are made and automatically deploys the needed resources.ceph smb apply -i resources.yaml -
If you do not need these resources, you can clean up in one action with a new file
removed.yamlthat contains the configurations to be removed.Use the following command to remove the
removed.yamlfile.ceph smb apply -i removed.yamlremoved.yaml file:resources: - resource_type: ceph.smb.cluster cluster_id: tango intent: removed - resource_type: ceph.smb.join.auth auth_id: join1-admin intent: removed - resource_type: ceph.smb.share cluster_id: tango share_id: cache intent: removed - resource_type: ceph.smb.share cluster_id: tango share_id: sp1 intent: removed