Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions roles/cephadm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ All Ceph hosts must be in the `ceph` group.
* `cephadm_ssh_public_key`: Location where ssh public key used by cephadm will be saved (default: /etc/ceph/cephadm.pub)
* `cephadm_ssh_private_key`: Location where ssh private key used by cephadm will be saved (default: /etc/ceph/cephadm.id)
* `cephadm_ssh_user`: Pre-existing user name that should be used for bootstrapping the cluster. User must have passwordless sudo enabled. Since 1.4.0 (default: `ansible_user`)
* `cephadm_bootstrap_additional_parameters`: additional arguments to pass to `cephadm bootstrap`
* `cephadm_apt_repo_dist`: overide (default) `ansible_distribution_release` for debian package repository
* MONs and MGRs
* `cephadm_mon_count`: Number of MONs to deploy (default: equals to number of hosts in `mons` Ansible group)
* `cephadm_mgr_count`: Number of MGRs to deploy (default: equals to number of hosts in `mgrs` Ansible group)
Expand Down
2 changes: 2 additions & 0 deletions roles/cephadm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ cephadm_install_ceph_cli: False
cephadm_ssh_public_key: "/etc/ceph/cephadm.pub"
cephadm_ssh_private_key: "/etc/ceph/cephadm.id"
cephadm_ssh_user: "{{ ansible_user }}"
cephadm_bootstrap_additional_parameters: ""
cephadm_apt_repo_dist: "{{ ansible_facts.distribution_release }}"
# MONs and MGRs
cephadm_mon_count: "{{ groups.get('mons', []) | length }}"
cephadm_mgr_count: "{{ groups.get('mgrs', []) | length }}"
Expand Down
3 changes: 3 additions & 0 deletions roles/cephadm/tasks/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
{{ firewalld }}
--ssh-private-key={{ cephadm_ssh_private_key }}
--ssh-public-key={{ cephadm_ssh_public_key }}
{% if cephadm_ssh_user | length > 0 %}
--ssh-user "{{ cephadm_ssh_user }}"
{% endif %}
{% if cephadm_registry_url | length > 0 %}
--registry-url={{ cephadm_registry_url }}
--registry-username={{ cephadm_registry_username }}
Expand All @@ -30,6 +32,7 @@
--fsid={{ cephadm_fsid }}
{% endif %}
--mon-ip={{ mon_ip }}
{{ cephadm_bootstrap_additional_parameters }}
become: true
when: not cephadm_check_ceph_conf.stat.exists

Expand Down
2 changes: 1 addition & 1 deletion roles/cephadm/tasks/pkg_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

- name: Ensure Ceph repositories are defined
apt_repository:
repo: "deb https://download.ceph.com/debian-{{ item }}/ {{ ansible_facts.distribution_release }} main"
repo: "deb https://download.ceph.com/debian-{{ item }}/ {{ cephadm_apt_repo_dist }} main"
state: "{{ 'present' if item == cephadm_ceph_release else 'absent' }}"
when: not cephadm_custom_repos | bool
become: true
Expand Down
1 change: 1 addition & 0 deletions roles/cephadm/tasks/prereqs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
user: "{{ cephadm_ssh_user }}"
state: present
key: "{{ content }}"
when: "cephadm_ssh_user | length > 0"
become: true

- name: Ensure the Logrotate package is installed
Expand Down
28 changes: 28 additions & 0 deletions roles/commands/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# commands

This role executes arbitrary commands against a Ceph cluster using `cephadm`.

## Prerequisites

### Host prerequisites

* The role assumes target hosts connection over SSH with user that has passwordless sudo configured.
* Either direct Internet access or private registry with desired Ceph image accessible to all hosts is required.

### Inventory

This role assumes the existence of the following groups:

* `mons`

with at least one host in it - see the `cephadm` role for more details.

## Role variables

* `cephadm_commands`: A list of commands to pass to `cephadm shell -- ceph`
Example:
```
cephadm_commands:
- "fs new cephfs cephfs_metadata cephfs_data"
- "orch apply mds cephfs --placement 3"
```
2 changes: 2 additions & 0 deletions roles/commands/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
cephadm_commands: []
11 changes: 11 additions & 0 deletions roles/commands/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Execute custom commands
command:
cmd: "cephadm shell -- ceph {{ item }}"
register: cephadm_commands_result
with_items: "{{ cephadm_commands }}"
become: true
when: cephadm_commands | length > 0

delegate_to: "{{ groups['mons'][0] }}"
run_once: True