Skip to content

Commit

Permalink
Allow ceph-ansible to be run on a locally built/installed Ceph
Browse files Browse the repository at this point in the history
-First install ceph into a directory with CMake
	cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DWITH_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX:PATH:=/usr <ceph_src_dir> && make DESTDIR=<install_dir> install/strip

-Ceph-ansible copies over the install_dir

-User can use rundep_installer.sh to install any runtime dependencies that ceph needs onto the machine from rundep
  • Loading branch information
Daniel Lin committed Aug 12, 2016
1 parent f37a9d1 commit 08766a2
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 16 deletions.
16 changes: 14 additions & 2 deletions group_vars/all.sample
Expand Up @@ -84,12 +84,24 @@ dummy:

## Configure package origin
#
#ceph_origin: 'upstream' # or 'distro'
#ceph_origin: 'upstream' #'distro' or 'local'
# 'distro' means that no separate repo file will be added
# you will get whatever version of Ceph is included in your Linux distro.
# 'local' means that the ceph binaries will be copied over from the local machine

# LOCAL CEPH INSTALLATION (ceph_origin==local)
#
#ceph_use_distro_backports: false # DEBIAN ONLY
# Path to DESTDIR of the ceph install
#ceph_installation_dir: "/path/to/ceph_installation/"
# Whether or not to use installer script rundep_installer.sh
# This script takes in rundep and installs the packages line by line onto the machine
# If this is set to false then it is assumed that the machine ceph is being copied onto will already have
# all runtime dependencies installed
#use_installer: false
# Root directory for ceph-ansible
#ansible_dir: "/path/to/ceph-ansible"

#ceph_use_distro_backports: false # DEBIAN ONLY

# STABLE
########
Expand Down
16 changes: 14 additions & 2 deletions roles/ceph-common/defaults/main.yml
Expand Up @@ -76,12 +76,24 @@ ceph_test: False

## Configure package origin
#
ceph_origin: 'upstream' # or 'distro'
ceph_origin: 'upstream' # or 'distro' or 'local'
# 'distro' means that no separate repo file will be added
# you will get whatever version of Ceph is included in your Linux distro.
# 'local' means that the ceph binaries will be copied over from the local machine

# LOCAL CEPH INSTALLATION (ceph_origin==local)
#
ceph_use_distro_backports: false # DEBIAN ONLY
# Path to DESTDIR of the ceph install
#ceph_installation_dir: "/path/to/ceph_installation/"
# Whether or not to use installer script rundep_installer.sh
# This script takes in rundep and installs the packages line by line onto the machine
# If this is set to false then it is assumed that the machine ceph is being copied onto will already have
# all runtime dependencies installed
#use_installer: false
# Root directory for ceph-ansible
#ansible_dir: "/path/to/ceph-ansible"

ceph_use_distro_backports: false # DEBIAN ONLY

# STABLE
########
Expand Down
1 change: 1 addition & 0 deletions roles/ceph-common/tasks/checks/check_mandatory_vars.yml
Expand Up @@ -5,6 +5,7 @@
when:
- ceph_origin != 'upstream'
- ceph_origin != 'distro'
- ceph_origin != 'local'
tags:
- package-install

Expand Down
72 changes: 63 additions & 9 deletions roles/ceph-common/tasks/installs/install_on_redhat.yml
Expand Up @@ -39,13 +39,67 @@
include: redhat_ceph_repository.yml
when: ceph_origin == 'upstream'

- name: make sure /tmp exists
file:
path: /tmp
state: directory
when:
- ceph_origin == 'local'
- use_installer

- name: use mktemp to create name for rundep
command: "mktemp /tmp/rundep.XXXXXXXX"
register: rundep_location
when:
- ceph_origin == 'local'
- use_installer

- name: copy rundep
copy:
src: "{{ansible_dir}}/rundep"
dest: "{{ item }}"
with_items: rundep_location.stdout_lines
when:
- ceph_origin == 'local'
- use_installer

- name: install ceph dependencies
script: "{{ ansible_dir }}/rundep_installer.sh {{ item }}"
become: true
with_items: rundep_location.stdout_lines
when:
- ceph_origin == 'local'
- use_installer

- name: install ceph
yum:
name: ceph
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
when: not use_server_package_split
when:
- not use_server_package_split
- ansible_pkg_mgr == "yum"
- ceph_origin != 'local'

- name: synchronize ceph install
synchronize:
src: "{{ceph_installation_dir}}/"
dest: "/"
when:
- ceph_origin == 'local'

- name: create user group ceph
group:
name: 'ceph'
when:
- ceph_origin == 'local'

- name: create user ceph
user:
name: 'ceph'
when:
- ceph_origin == 'local'

- name: install distro or red hat storage ceph mon
- name: install distro or red hat storage ceph mon via yum
yum:
name: "ceph-mon"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -57,7 +111,7 @@
or ceph_origin == "distro"
or ceph_custom

- name: install distro or red hat storage ceph mon
- name: install distro or red hat storage ceph mon via dnf
dnf:
name: "ceph-mon"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -69,7 +123,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph osd
- name: install distro or red hat storage ceph osd via yum
yum:
name: "ceph-osd"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -81,7 +135,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph osd
- name: install distro or red hat storage ceph osd via dnf
dnf:
name: "ceph-osd"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -93,7 +147,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph mds
- name: install distro or red hat storage ceph mds via yum
yum:
name: "ceph-mds"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -105,7 +159,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph mds
- name: install distro or red hat storage ceph mds via dnf
dnf:
name: "ceph-mds"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -117,7 +171,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph base
- name: install distro or red hat storage ceph base via yum
yum:
name: "ceph-base"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand All @@ -129,7 +183,7 @@
or ceph_dev
or ceph_custom

- name: install distro or red hat storage ceph base
- name: install distro or red hat storage ceph base via dnf
dnf:
name: "ceph-base"
state: "{{ (upgrade_ceph_packages|bool) | ternary('latest','present') }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/ceph-mon/tasks/deploy_monitors.yml
Expand Up @@ -53,7 +53,7 @@
- is_after_hammer

- name: ceph monitor mkfs without keyring (for or after infernalis release)
command: ceph-mon --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
command: ceph-mon --cluster {{ cluster }} --setuser ceph --setgroup ceph --mkfs -i {{ monitor_name }} --fsid {{ fsid }}
args:
creates: /var/lib/ceph/mon/{{ cluster }}-{{ monitor_name }}/store.db
when:
Expand Down
6 changes: 4 additions & 2 deletions roles/ceph-mon/tasks/start_monitor.yml
Expand Up @@ -10,13 +10,15 @@
with_items:
- done
- upstart
when: not use_systemd
when:
- not use_systemd

- name: start and add that the monitor service to the init sequence (ubuntu)
command: initctl emit ceph-mon cluster={{ cluster }} id={{ monitor_name }}
changed_when: false
failed_when: false
when: not use_systemd
when:
- not use_systemd

# NOTE (leseb): somehow the service ansible module is messing things up
# as a safety measure we run the raw command
Expand Down
45 changes: 45 additions & 0 deletions rundep.sample
@@ -0,0 +1,45 @@
#Package lines can be commented out with '#'
#
#boost-atomic
#boost-chrono
#boost-date-time
#boost-iostreams
#boost-program
#boost-random
#boost-regex
#boost-system
#boost-thread
#bzip2-libs
#cyrus-sasl-lib
#expat
#fcgi
#fuse-libs
#glibc
#hdparm
#keyutils-libs
#leveldb
#libaio
#libatomic_ops
#libattr
#libblkid
#libcap
#libcom_err
#libcurl
#libgcc
#libicu
#libidn
#libnghttp2
#libpsl
#libselinux
#libssh2
#libstdc++
#libunistring
#nss-softokn-freebl
#openldap
#openssl-libs
#pcre
#python-nose
#python-sphinx
#snappy
#systemd-libs
#zlib
27 changes: 27 additions & 0 deletions rundep_installer.sh
@@ -0,0 +1,27 @@
#!/bin/bash -e
#
# Copyright (C) 2014, 2015 Red Hat <contact@redhat.com>
#
# Author: Daniel Lin <danielin@umich.edu>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#

if test -f /etc/redhat-release ; then
PACKAGE_INSTALLER=yum
elif type apt-get > /dev/null 2>&1 ; then
PACKAGE_INSTALLER=apt-get
else
echo "ERROR: Package Installer could not be determined"
exit 1
fi

while read p; do
if [[ $p =~ ^#.* ]] ; then
continue
fi
$PACKAGE_INSTALLER install $p -y
done < $1

0 comments on commit 08766a2

Please sign in to comment.