···11+## Overview
22+33+This is a simple Ansible playbook to setup a Rook Storage Cluster inside an already available Kubernetes Cluster.
44+55+## Pre-Requisites
66+77+Node in the `k8s_master` group of the `inventory/hosts.cfg` is the Kubernetes cluster's master node. It's assumed that `kubectl` command is available and setup there for the tasks in the playbook to work. Along with the Kubernetes cluster, Rook Operator also need to be setup in the same cluster as mentioned 
88+99+## Approach & Configuration
1010+1111+The approach to setup Rook Storage cluster in this playbook is that a particular mount point in all the nodes assigned for storage will be used as the storage cluster's directories. This same information is mentioned in the `templates/rook-cluster-config.ymk.j2`.
1212+1313+Along with the Rook cluster, this playbook also sets up Rook Toolbox required to monitor the Rook / Ceph cluster.
1414+1515+The `storage_nodes` in the `inventory/hosts.cfg` denotes the storage node details. Other relvant values for the Rook cluster setup is in the `inventory/group_vars/k8s_master.yml`. The `inventory/group_vars/all/vault.yml` contain some sensitive information like the actual IPs and ssh user, please make sure to edit them before executing the playbook.
1616+1717+For more details check on ,  and 
1818+1919+## Playbook execution
2020+2121+```
2222+$ ansible-playbook -i inventory/hosts.cfg -kK -v --ask-vault-pass playbook.yml
2323+```
···11+apiVersion: v1
22+kind: Namespace
33+metadata:
44+ name: {{ rook_cluster_namespace }}
55+---
66+apiVersion: rook.io/v1alpha1
77+kind: Cluster
88+metadata:
99+ name: rook
1010+ namespace: {{ rook_cluster_namespace }}
1111+spec:
1212+ # The path on the host where configuration files will be persisted. If not specified, a kubernetes emptyDir will be created (not recommended).
1313+ # Important: if you reinstall the cluster, make sure you delete this directory from each host or else the mons will fail to start on the new cluster.
1414+ dataDirHostPath: {{data_dir_host_path}}
1515+ placement:
1616+ all:
1717+ nodeAffinity:
1818+ requiredDuringSchedulingIgnoredDuringExecution:
1919+ nodeSelectorTerms:
2020+ - matchExpressions:
2121+ - key: node-type
2222+ operator: In
2323+ values:
2424+ - storage-node
2525+2626+ # toggle to use hostNetwork
2727+ hostNetwork: false
2828+ # set the amount of mons to be started
2929+ monCount: 3
3030+ storage: # cluster level storage configuration and selection
3131+ useAllNodes: false
3232+ useAllDevices: false
3333+ deviceFilter:
3434+ metadataDevice:
3535+ location:
3636+ storeConfig:
3737+ storeType: {{storageconfig.storetype | default("bluestore")}}
3838+ databaseSizeMB: {{storageconfig.databasesize | default(1024)}} # this value can be removed for environments with normal sized disks (100 GB or larger)
3939+ journalSizeMB: {{storageconfig.journalsize | default(1024)}} # this value can be removed for environments with normal sized disks (20 GB or larger)
4040+4141+ directories:
4242+{% for d in storageconfig.directory.paths %}
4343+ - path: "{{ d }}"
4444+{% endfor %}
4545+4646+ nodes:
4747+{% for n in groups['storage_nodes'] %}
4848+ - name: "{{ hostvars[n]['k8s_host_name'] }}"
4949+5050+{% endfor %}