Skip to content

Commit 2c61b31

Browse files
authored
Ubuntu support and fixes (#7)
* Ubuntu support * Fix cephadm_bootstrap fact * Fix public key save/copy * Use ansible_hostname instead of inventory_hostname in specs * Fix usage of empty cephadm_fsid
1 parent 8650d45 commit 2c61b31

File tree

8 files changed

+53
-18
lines changed

8 files changed

+53
-18
lines changed

roles/cephadm/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
cephadm_ceph_release: octopus
23
cephadm_skip_prechecks: False
34
# FSID
45
cephadm_fsid: ""

roles/cephadm/tasks/bootstrap.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
--registry-password={{ cephadm_registry_password }}
2222
{% endif %}
2323
--skip-pull
24+
{% if cephadm_fsid | length > 0 %}
2425
--fsid={{ cephadm_fsid }}
26+
{% endif %}
2527
--mon-ip={{ mon_ip }}
2628
become: true
2729
when: not cephadm_check_ceph_conf.stat.exists
@@ -37,10 +39,19 @@
3739
when: cephadm_cluster_network | length > 0
3840
become: true
3941

42+
- name: Get cluster fsid
43+
command:
44+
cmd: "cephadm shell -- ceph fsid"
45+
when: cephadm_fsid | length == 0
46+
become: true
47+
register: cephadm_fsid_current
48+
4049
- name: Template out cluster.yml
50+
vars:
51+
fsid: "{{ cephadm_fsid if cephadm_fsid | length > 0 else cephadm_fsid_current.stdout }}"
4152
template:
4253
src: "templates/cluster.yml.j2"
43-
dest: "/var/run/ceph/{{ cephadm_fsid }}/cephadm_cluster.yml"
54+
dest: "/var/run/ceph/{{ fsid }}/cephadm_cluster.yml"
4455
owner: root
4556
group: root
4657
mode: 0644

roles/cephadm/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
- include_tasks: "prechecks.yml"
66
when: not cephadm_skip_prechecks | bool
77

8+
- include_tasks: "pkg_{{ ansible_os_family | lower }}.yml"
9+
810
- include_tasks: "prereqs.yml"
911

1012
- include_tasks: "bootstrap.yml"

roles/cephadm/tasks/pkg_debian.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
- name: Add Ceph signing keys
3+
apt_key:
4+
keyserver: keyserver.ubuntu.com
5+
id: E84AC2C0460F3994
6+
become: true
7+
8+
- name: Add Ceph repository
9+
apt_repository:
10+
repo: "deb https://download.ceph.com/debian-{{ cephadm_ceph_release }}/ {{ ansible_distribution_release }} main"
11+
state: present
12+
when: not cephadm_custom_repos | bool
13+
become: true
14+
15+
- name: Install cephadm package
16+
apt:
17+
name: "cephadm"
18+
state: present
19+
become: true

roles/cephadm/tasks/pkg_redhat.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Install centos-release-ceph-octopus package
3+
dnf:
4+
name: "centos-release-ceph-octopus"
5+
state: present
6+
when: not cephadm_custom_repos | bool
7+
become: true
8+
9+
- name: Install cephadm package
10+
dnf:
11+
name: "cephadm"
12+
state: present
13+
become: true

roles/cephadm/tasks/prechecks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
- name: Set cephadm_bootstrap
66
set_fact:
77
cephadm_bootstrap: True
8-
when: ansible_facts.services['ceph.target'] is defined
8+
when: ansible_facts.services['ceph.target'] is not defined

roles/cephadm/tasks/prereqs.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
---
2-
- name: Install centos-release-ceph-octopus package
3-
dnf:
4-
name: "centos-release-ceph-octopus"
5-
state: present
6-
when: not cephadm_custom_repos | bool
7-
become: true
8-
9-
- name: Install cephadm package
10-
dnf:
11-
name: "cephadm"
12-
state: present
13-
become: true
14-
152
- name: Prepare cephadm bootstrap dependencies
163
block:
174
- name: Ensure /etc/ceph directory exists
@@ -44,7 +31,7 @@
4431

4532
- name: Save public key
4633
copy:
47-
content: "{{ cephadm_ssh_key.public_key }}"
34+
content: "{{ cephadm_ssh_key.public_key | default }}"
4835
dest: "{{ cephadm_ssh_public_key }}"
4936
owner: root
5037
group: root
@@ -55,8 +42,10 @@
5542
run_once: True
5643

5744
- name: Copy cephadm public key to all hosts
45+
vars:
46+
content: "{{ lookup('file', cephadm_ssh_public_key) if cephadm_check_ceph_id.stat.exists else cephadm_ssh_key.public_key }}"
5847
authorized_key:
5948
user: root
6049
state: present
61-
key: "{{ cephadm_ssh_key.public_key }}"
50+
key: "{{ content }}"
6251
become: true

roles/cephadm/templates/cluster.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% for host in groups['ceph'] %}
22
---
33
service_type: host
4-
hostname: {{ host }}
4+
hostname: {{ hostvars[host]['ansible_hostname'] }}
55
labels:
66
{% if host in groups['mons'] %}
77
- mon

0 commit comments

Comments
 (0)