2 This is an installation tool for opensds using ansible.
\r
4 ## 1. How to install an opensds local cluster
\r
5 This installation document assumes there is a clean Ubuntu 16.04 environment. If golang is already installed in the environment, make sure the following parameters are configured in ```/etc/profile``` and run ``source /etc/profile``:
\r
7 export GOROOT=/usr/local/go
\r
8 export GOPATH=$HOME/gopath
\r
9 export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
\r
12 ### Pre-config (Ubuntu 16.04)
\r
13 First download some system packages:
\r
15 sudo apt-get install -y openssh-server git make gcc
\r
17 Then config ```/etc/ssh/sshd_config``` file and change one line:
\r
21 Next generate ssh-token:
\r
24 ssh-copy-id -i ~/.ssh/id_rsa.pub <ip_address> # IP address of the target machine of the installation
\r
28 If use a standalone cinder as backend, you also need to install docker to run cinder service. Please see the [docker installation document](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/) for details.
\r
30 ### Install ansible tool
\r
32 sudo add-apt-repository ppa:ansible/ansible # This step is needed to upgrade ansible to version 2.4.2 which is required for the ceph backend.
\r
34 sudo apt-get install ansible
\r
35 ansible --version # Ansible version 2.4.2 or higher is required for ceph; 2.0.0.2 or higher is needed for other backends.
\r
38 ### Download opensds source code
\r
40 mkdir -p $HOME/gopath/src/github.com/opensds && cd $HOME/gopath/src/github.com/opensds
\r
41 git clone https://github.com/opensds/opensds.git -b <specified_branch_name>
\r
42 cd opensds/contrib/ansible
\r
45 ### Configure opensds cluster variables:
\r
46 ##### System environment:
\r
47 Configure the ```workplace``` in `group_vars/common.yml`:
\r
49 workplace: /home/your_username # Change this field according to your username. If login as root, configure this parameter to '/root'
\r
53 If `lvm` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
\r
55 enabled_backend: lvm # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'
\r
56 pv_device: "your_pv_device_path" # Specify a block device and ensure it exists if lvm is chosen
\r
57 vg_name: "specified_vg_name" # Specify a name for VG if choosing lvm
\r
59 Modify ```group_vars/lvm/lvm.yaml```, change pool name to be the same as `vg_name` above:
\r
61 "vg001" # change pool name to be the same as vg_name
\r
64 If `ceph` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
\r
66 enabled_backend: ceph # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'.
\r
67 ceph_pool_name: "specified_pool_name" # Specify a name for ceph pool if choosing ceph
\r
69 Modify ```group_vars/ceph/ceph.yaml```, change pool name to be the same as `ceph_pool_name`:
\r
71 "rbd" # change pool name to be the same as ceph pool
\r
73 Configure two files under ```group_vars/ceph```: `all.yml` and `osds.yml`. Here is an example:
\r
75 ```group_vars/ceph/all.yml```:
\r
77 ceph_origin: repository
\r
78 ceph_repository: community
\r
79 ceph_stable_release: luminous # Choose luminous as default version
\r
80 public_network: "192.168.3.0/24" # Run 'ip -4 address' to check the ip address
\r
81 cluster_network: "{{ public_network }}"
\r
82 monitor_interface: eth1 # Change to the network interface on the target machine
\r
84 ```group_vars/ceph/osds.yml```:
\r
86 devices: # For ceph devices, append one or multiple devices like the example below:
\r
87 - '/dev/sda' # Ensure this device exists and available if ceph is chosen
\r
88 - '/dev/sdb' # Ensure this device exists and available if ceph is chosen
\r
89 osd_scenario: collocated
\r
93 If `cinder` is chosen as storage backend, modify `group_vars/osdsdock.yml`:
\r
95 enabled_backend: cinder # Change it according to the chosen backend. Supported backends include 'lvm', 'ceph', and 'cinder'
\r
97 # Use block-box install cinder_standalone if true, see details in:
\r
98 use_cinder_standalone: true
\r
99 # If true, you can configure cinder_container_platform, cinder_image_tag,
\r
100 # cinder_volume_group.
\r
102 # Default: debian:stretch, and ubuntu:xenial, centos:7 is also supported.
\r
103 cinder_container_platform: debian:stretch
\r
104 # The image tag can be arbitrarily modified, as long as follow the image naming
\r
105 # conventions, default: debian-cinder
\r
106 cinder_image_tag: debian-cinder
\r
107 # The cinder standalone use lvm driver as default driver, therefore `volume_group`
\r
108 # should be configured, the default is: cinder-volumes. The volume group will be
\r
109 # removed when use ansible script clean environment.
\r
110 cinder_volume_group: cinder-volumes
\r
113 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.
\r
115 ### Check if the hosts can be reached
\r
117 sudo ansible all -m ping -i local.hosts
\r
120 ### Run opensds-ansible playbook to start deploy
\r
122 sudo ansible-playbook site.yml -i local.hosts
\r
125 ## 2. How to test opensds cluster
\r
127 ### Configure opensds CLI tool
\r
129 sudo cp $GOPATH/src/github.com/opensds/opensds/build/out/bin/osdsctl /usr/local/bin
\r
130 export OPENSDS_ENDPOINT=http://127.0.0.1:50040
\r
131 osdsctl pool list # Check if the pool resource is available
\r
134 ### Create a default profile first.
\r
136 osdsctl profile create '{"name": "default", "description": "default policy"}'
\r
139 ### Create a volume.
\r
141 osdsctl volume create 1 --name=test-001
\r
143 For cinder, az needs to be specified.
\r
145 osdsctl volume create 1 --name=test-001 --az nova
\r
148 ### List all volumes.
\r
150 osdsctl volume list
\r
153 ### Delete the volume.
\r
155 osdsctl volume delete <your_volume_id>
\r
159 ## 3. How to purge and clean opensds cluster
\r
161 ### Run opensds-ansible playbook to clean the environment
\r
163 sudo ansible-playbook clean.yml -i local.hosts
\r
166 ### Run ceph-ansible playbook to clean ceph cluster if ceph is deployed
\r
168 cd /tmp/ceph-ansible
\r
169 sudo ansible-playbook infrastructure-playbooks/purge-cluster.yml -i ceph.hosts
\r
172 In addition, clean up the logical partition on the physical block device used by ceph, using the ```fdisk``` tool.
\r
174 ### Remove ceph-ansible source code (optional)
\r
177 sudo rm -rf /tmp/ceph-ansible
\r