2018-08-08 00:07:33 +08:00
============
2017-04-06 00:27:06 +08:00
ceph-ansible
============
2017-08-03 21:30:25 +08:00
2017-04-06 00:27:06 +08:00
Ansible playbooks for Ceph, the distributed filesystem.
2017-08-17 23:23:59 +08:00
Installation
============
2017-04-06 00:27:06 +08:00
2018-07-04 16:42:34 +08:00
GitHub
2017-08-17 23:23:59 +08:00
------
2018-08-08 00:07:33 +08:00
2018-07-04 16:42:34 +08:00
You can install directly from the source on GitHub by following these steps:
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
- Clone the repository:
.. code-block :: console
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
$ git clone https://github.com/ceph/ceph-ansible.git
2017-08-17 23:23:59 +08:00
- Next, you must decide which branch of `` ceph-ansible `` you wish to use. There
2022-05-25 02:40:00 +08:00
are stable branches to choose from or you could use the main branch:
2018-08-07 16:56:59 +08:00
.. code-block :: console
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
$ git checkout $branch
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
- Next, use pip and the provided requirements.txt to install Ansible and other
needed Python libraries:
2018-05-03 02:09:59 +08:00
2018-08-07 16:56:59 +08:00
.. code-block :: console
$ pip install -r requirements.txt
2018-05-03 02:09:59 +08:00
2017-10-10 03:38:31 +08:00
.. _ansible-on-rhel-family:
2017-10-04 01:38:58 +08:00
Ansible on RHEL and CentOS
--------------------------
2018-08-08 00:07:33 +08:00
2018-06-21 17:46:05 +08:00
You can acquire Ansible on RHEL and CentOS by installing from `Ansible channel <https://access.redhat.com/articles/3174981> `_ .
2017-10-04 01:38:58 +08:00
2018-08-07 16:56:59 +08:00
On RHEL:
.. code-block :: console
2017-10-04 01:38:58 +08:00
2018-08-07 16:56:59 +08:00
$ subscription-manager repos --enable=rhel-7-server-ansible-2-rpms
2017-10-04 01:38:58 +08:00
(CentOS does not use subscription-manager and already has "Extras" enabled by default.)
2018-08-07 16:56:59 +08:00
.. code-block :: console
2017-10-04 01:38:58 +08:00
2018-08-07 16:56:59 +08:00
$ sudo yum install ansible
2017-10-04 01:38:58 +08:00
Ansible on Ubuntu
-----------------
2018-08-07 16:56:59 +08:00
2017-10-10 03:38:31 +08:00
You can acquire Ansible on Ubuntu by using the `Ansible PPA <https://launchpad.net/~ansible/+archive/ubuntu/ansible> `_ .
2017-10-04 01:38:58 +08:00
2018-08-07 16:56:59 +08:00
.. code-block :: console
2017-10-04 01:38:58 +08:00
2018-08-07 16:56:59 +08:00
$ sudo add-apt-repository ppa:ansible/ansible
$ sudo apt update
$ sudo apt install ansible
2017-10-04 01:38:58 +08:00
2022-01-13 23:57:50 +08:00
Ansible collections
-------------------
In order to install third-party collections that are required for ceph-ansible,
please run:
.. code-block :: console
$ ansible-galaxy install -r requirements.yml
2017-10-04 01:38:58 +08:00
2017-08-17 23:23:59 +08:00
Releases
========
The following branches should be used depending on your requirements. The `` stable-* ``
2021-03-11 00:53:45 +08:00
branches have been QE tested and sometimes receive backport fixes throughout their lifecycle.
2022-05-25 02:40:00 +08:00
The `` main `` branch should be considered experimental and used with caution.
2017-08-17 23:23:59 +08:00
2019-04-18 21:59:11 +08:00
- `` stable-3.0 `` Supports Ceph versions `` jewel `` and `` luminous `` . This branch requires Ansible version `` 2.4 `` .
2018-07-18 21:54:33 +08:00
2019-04-18 21:59:11 +08:00
- `` stable-3.1 `` Supports Ceph versions `` luminous `` and `` mimic `` . This branch requires Ansible version `` 2.4 `` .
2017-10-30 22:49:51 +08:00
2019-04-18 21:59:11 +08:00
- `` stable-3.2 `` Supports Ceph versions `` luminous `` and `` mimic `` . This branch requires Ansible version `` 2.6 `` .
2018-11-19 16:42:08 +08:00
2021-01-29 04:28:14 +08:00
- `` stable-4.0 `` Supports Ceph version `` nautilus `` . This branch requires Ansible version `` 2.9 `` .
2019-04-18 21:59:11 +08:00
2020-03-24 22:48:58 +08:00
- `` stable-5.0 `` Supports Ceph version `` octopus `` . This branch requires Ansible version `` 2.9 `` .
2022-06-13 15:22:10 +08:00
- `` stable-6.0 `` Supports Ceph version `` pacific `` . This branch requires Ansible version `` 2.10 `` .
2021-02-10 20:47:21 +08:00
2022-06-15 00:18:36 +08:00
- `` stable-7.0 `` Supports Ceph version `` quincy `` . This branch requires Ansible version `` 2.12 `` .
- `` main `` Supports the main (devel) branch of Ceph. This branch requires Ansible version `` 2.12 `` .
2017-08-17 23:23:59 +08:00
2020-07-03 13:14:57 +08:00
.. NOTE :: `` stable-3.0 `` and `` stable-3.1 `` branches of ceph-ansible are deprecated and no longer maintained.
2017-08-17 23:23:59 +08:00
Configuration and Usage
=======================
2017-08-03 21:30:25 +08:00
2018-08-08 00:07:33 +08:00
This project assumes you have a basic knowledge of how Ansible works and have already prepared your hosts for
configuration by Ansible.
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
After you've cloned the `` ceph-ansible `` repository, selected your branch and installed Ansible then you'll need to create
your inventory file, playbook and configuration for your Ceph cluster.
2017-08-17 23:23:59 +08:00
Inventory
---------
2018-08-08 00:07:33 +08:00
The Ansible inventory file defines the hosts in your cluster and what roles each host plays in your Ceph cluster. The default
2017-08-17 23:23:59 +08:00
location for an inventory file is `` /etc/ansible/hosts `` but this file can be placed anywhere and used with the `` -i `` flag of
2018-08-08 00:07:33 +08:00
`` ansible-playbook `` .
An example inventory file would look like:
2018-08-07 16:56:59 +08:00
.. code-block :: ini
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
[mons]
mon1
mon2
mon3
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
[osds]
osd1
osd2
osd3
2017-08-17 23:23:59 +08:00
.. note ::
2018-08-08 00:07:33 +08:00
For more information on Ansible inventories please refer to the Ansible documentation: http://docs.ansible.com/ansible/latest/intro_inventory.html
2017-08-17 23:23:59 +08:00
Playbook
--------
You must have a playbook to pass to the `` ansible-playbook `` command when deploying your cluster. There is a sample playbook at the root of the `` ceph-ansible ``
project called `` site.yml.sample `` . This playbook should work fine for most usages, but it does include by default every daemon group which might not be
appropriate for your cluster setup. Perform the following steps to prepare your playbook:
2017-04-06 00:27:06 +08:00
2017-08-17 23:23:59 +08:00
- Rename the sample playbook: `` mv site.yml.sample site.yml ``
2017-04-06 00:27:06 +08:00
2017-08-17 23:23:59 +08:00
- Modify the playbook as necessary for the requirements of your cluster
.. note ::
2018-08-08 00:07:33 +08:00
It's important the playbook you use is placed at the root of the `` ceph-ansible `` project. This is how Ansible will be able to find the roles that
2017-08-17 23:23:59 +08:00
`` ceph-ansible `` provides.
2018-05-11 00:30:39 +08:00
Configuration Validation
------------------------
2018-08-07 16:56:59 +08:00
2018-05-11 00:30:39 +08:00
The `` ceph-ansible `` project provides config validation through the `` ceph-validate `` role. If you are using one of the provided playbooks this role will
be run early in the deployment as to ensure you've given `` ceph-ansible `` the correct config. This check is only making sure that you've provided the
proper config settings for your cluster, not that the values in them will produce a healthy cluster. For example, if you give an incorrect address for
`` monitor_address `` then the mon will still fail to join the cluster.
2018-08-07 16:56:59 +08:00
An example of a validation failure might look like:
2018-05-11 00:30:39 +08:00
2018-08-07 16:56:59 +08:00
.. code-block :: console
2018-05-11 00:30:39 +08:00
2018-08-07 16:56:59 +08:00
TASK [ceph-validate : validate provided configuration] ***** ***** ***** ***** *****
task path: /Users/andrewschoen/dev/ceph-ansible/roles/ceph-validate/tasks/main.yml:3
Wednesday 02 May 2018 13:48:16 -0500 (0:00:06.984) 0:00:18.803 ***** *** *
[ERROR]: [mon0] Validation failed for variable: osd_objectstore
2018-05-11 00:30:39 +08:00
2018-08-07 16:56:59 +08:00
[ERROR]: [mon0] Given value for osd_objectstore: foo
2018-05-11 00:30:39 +08:00
2018-08-07 16:56:59 +08:00
[ERROR]: [mon0] Reason: osd_objectstore must be either 'bluestore' or 'filestore'
2018-05-11 00:30:39 +08:00
2018-08-07 16:56:59 +08:00
fatal: [mon0]: FAILED! => {
"changed": false
}
2018-05-11 00:30:39 +08:00
2018-09-21 22:54:43 +08:00
Supported Validation
^^^^^^^^^^^^^^^^^^^^
The `` ceph-validate `` role currently supports validation of the proper config for the following
osd scenarios:
- `` collocated ``
- `` non-collocated ``
- `` lvm ``
The following install options are also validated by the `` ceph-validate `` role:
- `` ceph_origin `` set to `` distro ``
- `` ceph_origin `` set to `` repository ``
- `` ceph_origin `` set to `` local ``
- `` ceph_repository `` set to `` dev ``
- `` ceph_repository `` set to `` community ``
2018-08-08 00:07:33 +08:00
Installation methods
--------------------
2017-08-03 21:30:25 +08:00
Ceph can be installed through several methods.
.. toctree ::
:maxdepth: 1
installation/methods
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
Configuration
-------------
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
The configuration for your Ceph cluster will be set by the use of ansible variables that `` ceph-ansible `` provides. All of these options and their default
2017-08-17 23:23:59 +08:00
values are defined in the `` group_vars/ `` directory at the root of the `` ceph-ansible `` project. Ansible will use configuration in a `` group_vars/ `` directory
2018-08-08 00:07:33 +08:00
that is relative to your inventory file or your playbook. Inside of the `` group_vars/ `` directory there are many sample Ansible configuration files that relate
2021-03-11 00:53:45 +08:00
to each of the Ceph daemon groups by their filename. For example, the `` osds.yml.sample `` contains all the default configuration for the OSD daemons. The `` all.yml.sample ``
2017-08-17 23:23:59 +08:00
file is a special `` group_vars `` file that applies to all hosts in your cluster.
.. note ::
2018-08-08 00:07:33 +08:00
For more information on setting group or host specific configuration refer to the Ansible documentation: http://docs.ansible.com/ansible/latest/intro_inventory.html#splitting-out-host-and-group-specific-data
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
At the most basic level you must tell `` ceph-ansible `` what version of Ceph you wish to install, the method of installation, your clusters network settings and
2017-08-17 23:23:59 +08:00
how you want your OSDs configured. To begin your configuration rename each file in `` group_vars/ `` you wish to use so that it does not include the `` .sample ``
at the end of the filename, uncomment the options you wish to change and provide your own value.
2019-04-11 16:08:22 +08:00
An example configuration that deploys the upstream `` octopus `` version of Ceph with lvm batch method would look like this in `` group_vars/all.yml `` :
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
.. code-block :: yaml
2017-08-17 23:23:59 +08:00
2018-08-07 16:56:59 +08:00
ceph_origin: repository
ceph_repository: community
public_network: "192.168.3.0/24"
cluster_network: "192.168.4.0/24"
2019-02-22 17:04:28 +08:00
monitor_interface: eth1
2018-08-07 16:56:59 +08:00
devices:
- '/dev/sda'
- '/dev/sdb'
2017-08-17 23:23:59 +08:00
The following config options are required to be changed on all installations but there could be other required options depending on your OSD scenario
selection or other aspects of your cluster.
2017-08-03 21:30:25 +08:00
- `` ceph_origin ``
2017-08-17 23:23:59 +08:00
- `` public_network ``
- `` monitor_interface `` or `` monitor_address ``
2018-10-09 20:31:28 +08:00
When deploying RGW instance(s) you are required to set the `` radosgw_interface `` or `` radosgw_address `` config option.
2017-08-17 23:23:59 +08:00
2018-08-08 00:07:33 +08:00
`` ceph.conf `` Configuration File
---------------------------------
The supported method for defining your `` ceph.conf `` is to use the `` ceph_conf_overrides `` variable. This allows you to specify configuration options using
an INI format. This variable can be used to override sections already defined in `` ceph.conf `` (see: `` roles/ceph-config/templates/ceph.conf.j2 `` ) or to provide
new configuration options.
The following sections in `` ceph.conf `` are supported:
2017-08-17 23:23:59 +08:00
2019-04-12 05:09:04 +08:00
* `` [global] ``
2018-08-08 00:07:33 +08:00
* `` [mon] ``
* `` [osd] ``
* `` [mds] ``
2019-04-12 05:09:04 +08:00
* `` [client.rgw.{instance_name}] ``
2017-08-18 00:13:55 +08:00
2018-08-07 16:56:59 +08:00
An example:
2017-08-18 00:13:55 +08:00
2018-08-07 16:56:59 +08:00
.. code-block :: yaml
ceph_conf_overrides:
global:
foo: 1234
bar: 5678
osd:
osd_mkfs_type: ext4
2017-08-17 23:23:59 +08:00
2017-08-18 00:13:55 +08:00
.. note ::
2018-08-07 16:56:59 +08:00
2018-08-08 00:07:33 +08:00
We will no longer accept pull requests that modify the `` ceph.conf `` template unless it helps the deployment. For simple configuration tweaks
2018-08-07 16:56:59 +08:00
please use the `` ceph_conf_overrides `` variable.
2017-08-18 00:13:55 +08:00
2018-08-08 00:07:33 +08:00
Full documentation for configuring each of the Ceph daemon types are in the following sections.
2017-08-17 23:23:59 +08:00
OSD Configuration
2018-07-04 16:35:20 +08:00
-----------------
2017-08-17 23:23:59 +08:00
2019-04-11 16:08:22 +08:00
OSD configuration was used to be set by selecting an OSD scenario and providing the configuration needed for
that scenario. As of nautilus in stable-4.0, the only scenarios available is `` lvm `` .
2017-04-06 00:27:06 +08:00
2017-07-20 03:15:44 +08:00
.. toctree ::
:maxdepth: 1
osds/scenarios
2017-08-03 21:30:25 +08:00
2020-04-21 15:50:27 +08:00
Day-2 Operations
----------------
ceph-ansible provides a set of playbook in `` infrastructure-playbooks `` directory in order to perform some basic day-2 operations.
.. toctree ::
:maxdepth: 1
day-2/osds
day-2/purge
2020-05-25 21:44:12 +08:00
day-2/upgrade
2020-04-21 15:50:27 +08:00
2022-05-12 23:22:54 +08:00
RBD Mirroring
-------------
Ceph-ansible provides the role `` ceph-rbd-mirror `` that can setup an RBD mirror replication.
.. toctree ::
:maxdepth: 1
rbdmirror/index
2017-08-18 00:25:56 +08:00
Contribution
============
See the following section for guidelines on how to contribute to `` ceph-ansible `` .
.. toctree ::
:maxdepth: 1
dev/index
2017-08-17 23:23:59 +08:00
Testing
=======
2017-07-20 03:15:44 +08:00
2018-08-08 00:07:33 +08:00
Documentation for writing functional testing scenarios for `` ceph-ansible `` .
2017-04-06 00:27:06 +08:00
2017-08-17 23:23:59 +08:00
* :doc: `Testing with ceph-ansible <testing/index>`
* :doc: `Glossary <testing/glossary>`
2017-08-18 00:09:37 +08:00
Demos
=====
Vagrant Demo
------------
2020-03-06 18:38:31 +08:00
Deployment from scratch on vagrant machines: https://youtu.be/E8-96NamLDo
2017-08-18 00:09:37 +08:00
Bare metal demo
---------------
Deployment from scratch on bare metal machines: https://youtu.be/dv_PEp9qAqg