Update stor4nfv install scripts according to opensds aruba release
[stor4nfv.git] / tutorials / stor4nfv-only-scenario.md
1 ## 1. How to install an opensds local cluster
2 ### Pre-config (Ubuntu 16.04)
3 All the installation work is tested on `Ubuntu 16.04`, please make sure you have installed the right one. Also `root` user is suggested before the installation work starts.
4
5 * packages
6
7 Install following packages:
8 ```bash
9 apt-get install -y git curl wget
10 ```
11 * docker
12
13 Install docker:
14 ```bash
15 wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb
16 dpkg -i docker-ce_18.03.1~ce-0~ubuntu_amd64.deb 
17 ```
18 * golang
19
20 Check golang version information:
21 ```bash
22 root@proxy:~# go version
23 go version go1.9.2 linux/amd64
24 ```
25 You can install golang by executing commands below:
26 ```bash
27 wget https://storage.googleapis.com/golang/go1.9.2.linux-amd64.tar.gz
28 tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz
29 echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
30 echo 'export GOPATH=$HOME/gopath' >> /etc/profile
31 source /etc/profile
32 ```
33
34 ### Download opensds-installer code
35 ```bash
36 git clone https://gerrit.opnfv.org/gerrit/stor4nfv
37 cd stor4nfv/ci/ansible
38 ```
39
40 ### Install ansible tool
41 To install ansible, run the commands below:
42 ```bash
43 # This step is needed to upgrade ansible to version 2.4.2 which is required for the "include_tasks" ansible command.
44 chmod +x ./install_ansible.sh && ./install_ansible.sh
45 ansible --version # Ansible version 2.4.x is required.
46 ```
47
48 ### Configure opensds cluster variables:
49 ##### System environment:
50 If you want to integrate stor4nfv with k8s csi, please modify `nbp_plugin_type` to `csi` and also change `opensds_endpoint` field in `group_vars/common.yml`:
51 ```yaml
52 # 'hotpot_only' is the default integration way, but you can change it to 'csi'
53 # or 'flexvolume'
54 nbp_plugin_type: hotpot_only
55 # The IP (127.0.0.1) should be replaced with the opensds actual endpoint IP
56 opensds_endpoint: http://127.0.0.1:50040
57 ```
58
59 ##### LVM
60 If `lvm` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
61 ```yaml
62 enabled_backend: lvm 
63 ```
64
65 Modify ```group_vars/lvm/lvm.yaml```, change `tgtBindIp` to your real host ip if needed:
66 ```yaml
67 tgtBindIp: 127.0.0.1 
68 ```
69
70 ##### Ceph
71 If `ceph` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
72 ```yaml
73 enabled_backend: ceph # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'.
74 ```
75
76 Configure ```group_vars/ceph/all.yml``` with an example below:
77 ```yml
78 ceph_origin: repository
79 ceph_repository: community
80 ceph_stable_release: luminous # Choose luminous as default version
81 public_network: "192.168.3.0/24" # Run 'ip -4 address' to check the ip address
82 cluster_network: "{{ public_network }}"
83 monitor_interface: eth1 # Change to the network interface on the target machine
84 devices: # For ceph devices, append ONE or MULTIPLE devices like the example below:
85   - '/dev/sda' # Ensure this device exists and available if ceph is chosen
86   #- '/dev/sdb'  # Ensure this device exists and available if ceph is chosen
87 osd_scenario: collocated
88 ```
89
90 ##### Cinder
91 If `cinder` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
92 ```yaml
93 enabled_backend: cinder # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'
94
95 # Use block-box install cinder_standalone if true, see details in:
96 use_cinder_standalone: true
97 ```
98
99 Configure the auth and pool options to access cinder in `group_vars/cinder/cinder.yaml`. Do not need to make additional configure changes if using cinder standalone.
100
101 ### Check if the hosts can be reached
102 ```bash
103 ansible all -m ping -i local.hosts
104 ```
105
106 ### Run opensds-ansible playbook to start deploy
107 ```bash
108 ansible-playbook site.yml -i local.hosts
109 ```
110
111 ## 2. How to test opensds cluster
112 ### OpenSDS CLI
113 Firstly configure opensds CLI tool:
114 ```bash
115 sudo cp /opt/opensds-linux-amd64/bin/osdsctl /usr/local/bin/
116 export OPENSDS_ENDPOINT=http://{your_real_host_ip}:50040
117 export OPENSDS_AUTH_STRATEGY=keystone
118 source /opt/stack/devstack/openrc admin admin
119
120 osdsctl pool list # Check if the pool resource is available
121 ```
122
123 Then create a default profile:
124 ```
125 osdsctl profile create '{"name": "default", "description": "default policy"}'
126 ```
127
128 Create a volume:
129 ```
130 osdsctl volume create 1 --name=test-001
131 ```
132
133 List all volumes:
134 ```
135 osdsctl volume list
136 ```
137
138 Delete the volume:
139 ```
140 osdsctl volume delete <your_volume_id>
141 ```
142
143 ### OpenSDS UI
144 OpenSDS UI dashboard is available at `http://{your_host_ip}:8088`, please login the dashboard using the default admin credentials: `admin/opensds@123`. Create tenant, user, and profiles as admin.
145
146 Logout of the dashboard as admin and login the dashboard again as a non-admin user to create volume, snapshot, expand volume, create volume from snapshot, create volume group.
147
148 ## 3. How to purge and clean opensds cluster
149
150 ### Run opensds-ansible playbook to clean the environment
151 ```bash
152 ansible-playbook clean.yml -i local.hosts
153 ```
154
155 ### Run ceph-ansible playbook to clean ceph cluster if ceph is deployed
156 ```bash
157 cd /opt/ceph-ansible
158 sudo ansible-playbook infrastructure-playbooks/purge-cluster.yml -i ceph.hosts
159 ```
160
161 In addition, clean up the logical partition on the physical block device used by ceph, using the ```fdisk``` tool.
162
163 ### Remove ceph-ansible source code (optional)
164 ```bash
165 sudo rm -rf /opt/ceph-ansible
166 ```