Skip to content

Commit 2ada6f1

Browse files
authored
Merge pull request #58 from piersharding/bootstrap-for-single-host
Enable bootstrap for single host
2 parents a4fc42f + 829e646 commit 2ada6f1

File tree

8 files changed

+50
-1
lines changed

8 files changed

+50
-1
lines changed

roles/cephadm/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ All Ceph hosts must be in the `ceph` group.
4141
* `cephadm_ssh_public_key`: Location where ssh public key used by cephadm will be saved (default: /etc/ceph/cephadm.pub)
4242
* `cephadm_ssh_private_key`: Location where ssh private key used by cephadm will be saved (default: /etc/ceph/cephadm.id)
4343
* `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`)
44+
* `cephadm_bootstrap_additional_parameters`: additional arguments to pass to `cephadm bootstrap`
45+
* `cephadm_apt_repo_dist`: overide (default) `ansible_distribution_release` for debian package repository
4446
* MONs and MGRs
4547
* `cephadm_mon_count`: Number of MONs to deploy (default: equals to number of hosts in `mons` Ansible group)
4648
* `cephadm_mgr_count`: Number of MGRs to deploy (default: equals to number of hosts in `mgrs` Ansible group)

roles/cephadm/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ cephadm_install_ceph_cli: False
2222
cephadm_ssh_public_key: "/etc/ceph/cephadm.pub"
2323
cephadm_ssh_private_key: "/etc/ceph/cephadm.id"
2424
cephadm_ssh_user: "{{ ansible_user }}"
25+
cephadm_bootstrap_additional_parameters: ""
26+
cephadm_apt_repo_dist: "{{ ansible_facts.distribution_release }}"
2527
# MONs and MGRs
2628
cephadm_mon_count: "{{ groups.get('mons', []) | length }}"
2729
cephadm_mgr_count: "{{ groups.get('mgrs', []) | length }}"

roles/cephadm/tasks/bootstrap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
{{ firewalld }}
2020
--ssh-private-key={{ cephadm_ssh_private_key }}
2121
--ssh-public-key={{ cephadm_ssh_public_key }}
22+
{% if cephadm_ssh_user | length > 0 %}
2223
--ssh-user "{{ cephadm_ssh_user }}"
24+
{% endif %}
2325
{% if cephadm_registry_url | length > 0 %}
2426
--registry-url={{ cephadm_registry_url }}
2527
--registry-username={{ cephadm_registry_username }}
@@ -30,6 +32,7 @@
3032
--fsid={{ cephadm_fsid }}
3133
{% endif %}
3234
--mon-ip={{ mon_ip }}
35+
{{ cephadm_bootstrap_additional_parameters }}
3336
become: true
3437
when: not cephadm_check_ceph_conf.stat.exists
3538

roles/cephadm/tasks/pkg_debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
- name: Ensure Ceph repositories are defined
99
apt_repository:
10-
repo: "deb https://download.ceph.com/debian-{{ item }}/ {{ ansible_facts.distribution_release }} main"
10+
repo: "deb https://download.ceph.com/debian-{{ item }}/ {{ cephadm_apt_repo_dist }} main"
1111
state: "{{ 'present' if item == cephadm_ceph_release else 'absent' }}"
1212
when: not cephadm_custom_repos | bool
1313
become: true

roles/cephadm/tasks/prereqs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
user: "{{ cephadm_ssh_user }}"
5656
state: present
5757
key: "{{ content }}"
58+
when: "cephadm_ssh_user | length > 0"
5859
become: true
5960

6061
- name: Ensure the Logrotate package is installed

roles/commands/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# commands
2+
3+
This role executes arbitrary commands against a Ceph cluster using `cephadm`.
4+
5+
## Prerequisites
6+
7+
### Host prerequisites
8+
9+
* The role assumes target hosts connection over SSH with user that has passwordless sudo configured.
10+
* Either direct Internet access or private registry with desired Ceph image accessible to all hosts is required.
11+
12+
### Inventory
13+
14+
This role assumes the existence of the following groups:
15+
16+
* `mons`
17+
18+
with at least one host in it - see the `cephadm` role for more details.
19+
20+
## Role variables
21+
22+
* `cephadm_commands`: A list of commands to pass to `cephadm shell -- ceph`
23+
Example:
24+
```
25+
cephadm_commands:
26+
- "fs new cephfs cephfs_metadata cephfs_data"
27+
- "orch apply mds cephfs --placement 3"
28+
```

roles/commands/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
cephadm_commands: []

roles/commands/tasks/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Execute custom commands
3+
command:
4+
cmd: "cephadm shell -- ceph {{ item }}"
5+
register: cephadm_commands_result
6+
with_items: "{{ cephadm_commands }}"
7+
become: true
8+
when: cephadm_commands | length > 0
9+
10+
delegate_to: "{{ groups['mons'][0] }}"
11+
run_once: True

0 commit comments

Comments
 (0)