From 2e33f30a1f0a17692d6d0348248df10b98cfb498 Mon Sep 17 00:00:00 2001 From: liyuenan Date: Sat, 14 Jan 2017 11:31:08 +0800 Subject: Deploy OpenStack Newton on CentOS hosts JIRA: COMPASS-518 Make Centos Newton ppa. Update host Centos version to 7.3. Support Centos Newton Deploy. Support Ceph Deploy. Change-Id: I6dd110cc10d425a9d590e1dcb5777ade5cce96aa Signed-off-by: liyuenan --- .../roles/ceph-osd/files/ceph-crush-location.in | 79 ++++++++++++++++++++++ .../ansible/roles/ceph-osd/tasks/install_osd.yml | 7 ++ 2 files changed, 86 insertions(+) create mode 100644 deploy/adapters/ansible/roles/ceph-osd/files/ceph-crush-location.in (limited to 'deploy/adapters/ansible/roles/ceph-osd') diff --git a/deploy/adapters/ansible/roles/ceph-osd/files/ceph-crush-location.in b/deploy/adapters/ansible/roles/ceph-osd/files/ceph-crush-location.in new file mode 100644 index 00000000..d7637510 --- /dev/null +++ b/deploy/adapters/ansible/roles/ceph-osd/files/ceph-crush-location.in @@ -0,0 +1,79 @@ +#!/bin/sh +# +# Generate a CRUSH location for the given entity +# +# The CRUSH location consists of a list of key=value pairs, separated +# by spaces, all on a single line. This describes where in CRUSH +# hierarhcy this entity should be placed. +# +# Arguments: +# --cluster name of the cluster (see /etc/ceph/$cluster.conf) +# --type daemon/entity type +# --id id (osd number, mds name, client name) +# + +# if we start up as ./ceph-crush-location, assume everything else is +# in the current directory too. +if [ `dirname $0` = "." ] && [ $PWD != "/usr/bin" ]; then + BINDIR=. + SBINDIR=. + LIBDIR=. + ETCDIR=. +else + BINDIR=@bindir@ + SBINDIR=@prefix@/sbin + LIBDIR=@libdir@/ceph + ETCDIR=@sysconfdir@/ceph +fi + +usage_exit() { + echo "usage: $0 [--cluster ] --id --type " + exit +} + +cluster="ceph" +type="" +id="" +while [ $# -ge 1 ]; do + case $1 in + --cluster | -C) + shift + cluster="$1" + shift + ;; + --id | -i) + shift + id="$1" + shift + ;; + --type | -t) + shift + type="$1" + shift + ;; + *) + echo "unrecognized option '$1'" + usage_exit + ;; + esac +done + +if [ -z "$type" ]; then + echo "must specify entity type" + usage_exit +fi + +if [ -z "$id" ]; then + echo "must specify id" + usage_exit +fi + +# try a generic location +location="$($BINDIR/ceph-conf --cluster=${cluster:-ceph} --name=$type.$id --lookup crush_location || :)" +if [ -n "$location" ]; then + echo $location + exit 0 +fi + +# spit out something generic +echo "host=$(hostname -s) root=default" diff --git a/deploy/adapters/ansible/roles/ceph-osd/tasks/install_osd.yml b/deploy/adapters/ansible/roles/ceph-osd/tasks/install_osd.yml index 78d62f67..2a9ea3a5 100644 --- a/deploy/adapters/ansible/roles/ceph-osd/tasks/install_osd.yml +++ b/deploy/adapters/ansible/roles/ceph-osd/tasks/install_osd.yml @@ -30,6 +30,13 @@ shell: chown -R ceph:ceph /var/local/osd when: ansible_os_family == "Debian" +- name: copy ceph-crush-location to osd host + copy: + src: ceph-crush-location.in + dest: /usr/bin/ceph-crush-location + mode: 0755 + when: ansible_os_family == "RedHat" + - name: activate osd node shell: ceph-disk activate /var/local/osd -- cgit 1.2.3-korg