Skip to content

Commit 007bf49

Browse files
authored
Merge pull request #97 from stackhpc/xena-cephadm
Xena: Add playbooks & configuration for Cephadm
2 parents 6e7f26a + 6db34c4 commit 007bf49

File tree

11 files changed

+304
-12
lines changed

11 files changed

+304
-12
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Define Ceph CRUSH rules
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-crush-rules
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.crush_rules

etc/kayobe/ansible/cephadm-deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Deploy Ceph using Cephadm
3+
any_errors_fatal: true
4+
gather_facts: true
5+
hosts: ceph
6+
tags:
7+
- cephadm
8+
- cephadm-deploy
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.cephadm
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Define Ceph EC profiles
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-ec-profiles
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.ec_profiles
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
- name: Gather Ceph configuration and keys and populate kayobe-config
3+
gather_facts: false
4+
hosts: mons
5+
run_once: true
6+
tags:
7+
- cephadm
8+
- cephadm-gather-keys
9+
vars:
10+
# Map from an OpenStack service to the directory in which to store Ceph keys for it.
11+
kolla_service_to_key_dir:
12+
cinder-backup: cinder/cinder-backup
13+
cinder-volume: cinder/cinder-volume
14+
glance: glance
15+
manila: manila
16+
nova: nova
17+
# Map from an OpenStack service to the directory in which to store Ceph configuration for it.
18+
kolla_service_to_conf_dir:
19+
cinder-backup: cinder
20+
cinder-volume: cinder
21+
glance: glance
22+
manila: manila
23+
nova: nova
24+
tasks:
25+
- name: Get Ceph keys
26+
stackhpc.cephadm.cephadm_key:
27+
name: "{{ item }}"
28+
state: info
29+
register: cephadm_key_info
30+
become: true
31+
loop: "{{ kolla_ceph_services | selectattr('required') | map(attribute='keys') | flatten | unique }}"
32+
33+
- name: Generate ceph.conf
34+
command: "cephadm shell -- ceph config generate-minimal-conf"
35+
become: true
36+
register: cephadm_ceph_conf
37+
changed_when: false
38+
39+
- name: Ensure Kolla config directories are present
40+
file:
41+
state: directory
42+
path: "{{ kayobe_env_config_path }}/kolla/config/{{ kolla_service_to_key_dir[item.name] }}"
43+
loop: "{{ kolla_ceph_services | selectattr('required') }}"
44+
loop_control:
45+
label:
46+
service: "{{ item.name }}"
47+
delegate_to: localhost
48+
49+
- name: Save Ceph keys to Kayobe configuration
50+
vars:
51+
key_info: "{{ cephadm_key_info.results | selectattr('item', 'equalto', item.1) | first }}"
52+
cephadm_key: "{{ (key_info.stdout | from_json | first)['key'] }}"
53+
cephadm_user: "{{ (key_info.stdout | from_json | first)['entity'] }}"
54+
copy:
55+
content: "{{ cephadm_key }}"
56+
dest: "{{ kayobe_env_config_path }}/kolla/config/{{ kolla_service_to_key_dir[item.0.name] }}/ceph.{{ cephadm_user }}.keyring"
57+
loop: "{{ query('subelements', kolla_ceph_services | selectattr('required'), 'keys') }}"
58+
loop_control:
59+
label:
60+
service: "{{ item.0.name }}"
61+
key: "{{ item.1 }}"
62+
delegate_to: localhost
63+
notify: Please add and commit the Kayobe configuration
64+
65+
- name: Save ceph.conf to Kayobe configuration
66+
copy:
67+
content: "{{ cephadm_ceph_conf.stdout }}"
68+
dest: "{{ kayobe_env_config_path }}/kolla/config/{{ kolla_service_to_conf_dir[item.0.name] }}/ceph.conf"
69+
loop: "{{ query('subelements', kolla_ceph_services | selectattr('required'), 'keys') }}"
70+
loop_control:
71+
label:
72+
service: "{{ item.0.name }}"
73+
key: "{{ item.1 }}"
74+
delegate_to: localhost
75+
notify: Please add and commit the Kayobe configuration
76+
77+
handlers:
78+
- name: Please add and commit the Kayobe configuration
79+
debug:
80+
msg: >-
81+
Please add and commit the Ceph configuration files and keys in Kayobe
82+
configuration. Remember to encrypt the keys using Ansible Vault.

etc/kayobe/ansible/cephadm-keys.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Generate Ceph keys
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-keys
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.keys

etc/kayobe/ansible/cephadm-pools.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- name: Define Ceph pools
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-keys
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.pools

etc/kayobe/ansible/cephadm.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# Deploy Ceph via Cephadm. Create EC profiles, CRUSH rules, pools and keys.
3+
- import_playbook: cephadm-deploy.yml
4+
- import_playbook: cephadm-ec-profiles.yml
5+
- import_playbook: cephadm-crush-rules.yml
6+
- import_playbook: cephadm-pools.yml
7+
- import_playbook: cephadm-keys.yml

etc/kayobe/ansible/requirements.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
collections:
3+
- name: stackhpc.cephadm
4+
version: 1.7.0
35
- name: stackhpc.pulp
46
version: 0.3.0
57
- name: pulp.squeezer

etc/kayobe/cephadm.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
###############################################################################
3+
# Cephadm deployment configuration.
4+
5+
# Ceph release name.
6+
cephadm_ceph_release: "pacific"
7+
8+
# Ceph FSID.
9+
#cephadm_fsid:
10+
11+
# Ceph container image.
12+
cephadm_image: "{{ stackhpc_docker_registry }}/ceph/ceph:{{ cephadm_image_tag }}"
13+
14+
# Ceph container image tag.
15+
cephadm_image_tag: "v16.2.5"
16+
17+
# Ceph container image registry URL.
18+
cephadm_registry_url: "{{ stackhpc_docker_registry }}"
19+
20+
# Ceph container image registry username.
21+
cephadm_registry_username: "{{ stackhpc_docker_registry_username }}"
22+
23+
# Ceph container image registry password.
24+
cephadm_registry_password: "{{ stackhpc_docker_registry_password }}"
25+
26+
# Ceph public network interface.
27+
cephadm_public_interface: "{{ storage_net_name | net_interface }}"
28+
29+
# Ceph public network subnet CIDR.
30+
cephadm_public_network: "{{ storage_net_name | net_cidr }}"
31+
32+
# Ceph cluster network interface.
33+
cephadm_cluster_interface: "{{ storage_mgmt_net_name | net_interface }}"
34+
35+
# Ceph cluster network subnet CIDR.
36+
cephadm_cluster_network: "{{ storage_mgmt_net_name | net_cidr }}"
37+
38+
# Whether to enable firewalld for Ceph storage hosts.
39+
#cephadm_enable_firewalld:
40+
41+
# Ceph OSD specification.
42+
#cephadm_osd_spec:
43+
44+
###############################################################################
45+
# Ceph post-deployment configuration.
46+
47+
# List of Ceph erasure coding profiles. See stackhpc.cephadm.ec_profiles role
48+
# for format.
49+
#cephadm_ec_profiles:
50+
51+
# List of Ceph CRUSH rules. See stackhpc.cephadm.crush_rules role for format.
52+
#cephadm_crush_rules:
53+
54+
# List of Ceph pools. See stackhpc.cephadm.pools role for format.
55+
#cephadm_pools:
56+
57+
# List of Cephx keys. See stackhpc.cephadm.keys role for format.
58+
#cephadm_keys:
59+
60+
###############################################################################
61+
# Kolla Ceph auto-configuration.
62+
63+
# List of Kolla Ansible services that require Ceph configuration files.
64+
kolla_ceph_services:
65+
- name: cinder-backup
66+
keys:
67+
- client.cinder
68+
- client.cinder-backup
69+
required: "{{ kolla_ceph_cinder_backup_required | bool }}"
70+
- name: cinder-volume
71+
keys:
72+
- client.cinder
73+
required: "{{ kolla_ceph_cinder_volume_required | bool }}"
74+
- name: glance
75+
keys:
76+
- client.glance
77+
required: "{{ kolla_ceph_glance_required | bool }}"
78+
- name: manila
79+
keys:
80+
- client.manila
81+
required: "{{ kolla_ceph_manila_required | bool }}"
82+
- name: nova
83+
keys:
84+
- client.cinder
85+
required: "{{ kolla_ceph_nova_required | bool }}"
86+
87+
# Whether to generate Ceph configuration for Cinder volume.
88+
kolla_ceph_cinder_volume_required: "{{ kolla_enable_cinder | bool }}"
89+
90+
# Whether to generate Ceph configuration for Cinder backup.
91+
kolla_ceph_cinder_backup_required: "{{ kolla_enable_cinder_backup | default(false) | bool }}"
92+
93+
# Whether to generate Ceph configuration for Glance.
94+
kolla_ceph_glance_required: "{{ kolla_enable_glance | bool }}"
95+
96+
# Whether to generate Ceph configuration for Manila.
97+
kolla_ceph_manila_required: "{{ kolla_enable_manila | bool }}"
98+
99+
# Whether to generate Ceph configuration for Nova.
100+
kolla_ceph_nova_required: "{{ kolla_enable_nova | bool }}"

etc/kayobe/inventory/groups

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,18 @@ overcloud
9797
mgmt-switches
9898
ctl-switches
9999
hs-switches
100+
101+
###############################################################################
102+
# Ceph groups.
103+
104+
[ceph:children]
105+
mons
106+
mgrs
107+
osds
108+
rgws
109+
110+
# Empty groups to provide declaration of groups required for Cephadm.
111+
[mons]
112+
[mgrs]
113+
[osds]
114+
[rgws]

etc/kayobe/pulp.yml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ stackhpc_pulp_distribution_rpm_production:
308308
stackhpc_release_pulp_registry_url: "{{ stackhpc_release_pulp_url }}"
309309

310310
# List of all image names.
311-
stackhpc_pulp_images:
311+
stackhpc_pulp_images_kolla:
312312
- barbican-api
313313
- barbican-base
314314
- barbican-keystone-listener
@@ -429,33 +429,64 @@ stackhpc_pulp_images:
429429
- redis-sentinel
430430

431431
# Common parameters for container image repositories.
432-
stackhpc_pulp_repository_container_repos_common:
432+
stackhpc_pulp_repository_container_repos_kolla_common:
433433
url: "{{ stackhpc_release_pulp_registry_url }}"
434434
policy: on_demand
435435
remote_username: "{{ stackhpc_release_pulp_username }}"
436436
remote_password: "{{ stackhpc_release_pulp_password }}"
437437
state: present
438+
required: true
438439

439-
# List of container image repositories.
440-
stackhpc_pulp_repository_container_repos: >-
440+
# List of Kolla container image repositories.
441+
stackhpc_pulp_repository_container_repos_kolla: >-
441442
{%- set repos = [] -%}
442-
{%- for image in stackhpc_pulp_images -%}
443+
{%- for image in stackhpc_pulp_images_kolla -%}
443444
{%- set image_repo = kolla_docker_namespace ~ "/" ~ kolla_base_distro ~ "-" ~ kolla_install_type ~ "-" ~ image -%}
444445
{%- set repo = {"name": image_repo} -%}
445-
{%- set _ = repos.append(stackhpc_pulp_repository_container_repos_common | combine(repo)) -%}
446+
{%- set _ = repos.append(stackhpc_pulp_repository_container_repos_kolla_common | combine(repo)) -%}
446447
{%- endfor -%}
447448
{{ repos }}
448449
449-
# Common parameters for container image distributions.
450-
stackhpc_pulp_distribution_container_common:
450+
# Common parameters for Kolla container image distributions.
451+
stackhpc_pulp_distribution_container_kolla_common:
451452
state: present
453+
required: true
452454

453-
# List of container image distributions.
454-
stackhpc_pulp_distribution_container: >-
455+
# List of Kolla container image distributions.
456+
stackhpc_pulp_distribution_container_kolla: >-
455457
{%- set distributions = [] -%}
456-
{%- for image in stackhpc_pulp_images -%}
458+
{%- for image in stackhpc_pulp_images_kolla -%}
457459
{%- set image_repo = kolla_docker_namespace ~ "/" ~ kolla_base_distro ~ "-" ~ kolla_install_type ~ "-" ~ image -%}
458460
{%- set distribution = {"name": image_repo, "repository": image_repo, "base_path": image_repo} -%}
459-
{%- set _ = distributions.append(stackhpc_pulp_distribution_container_common | combine(distribution)) -%}
461+
{%- set _ = distributions.append(stackhpc_pulp_distribution_container_kolla_common | combine(distribution)) -%}
460462
{%- endfor -%}
461463
{{ distributions }}
464+
465+
# Whether to sync Ceph container images.
466+
stackhpc_sync_ceph_images: false
467+
468+
# List of Ceph container image repositories.
469+
stackhpc_pulp_repository_container_repos_ceph:
470+
- name: "ceph/ceph"
471+
url: "https://quay.io"
472+
policy: on_demand
473+
state: present
474+
required: "{{ stackhpc_sync_ceph_images | bool }}"
475+
476+
# List of Ceph container image distributions.
477+
stackhpc_pulp_distribution_container_ceph:
478+
- name: ceph
479+
repository: ceph/ceph
480+
base_path: ceph/ceph
481+
state: present
482+
required: "{{ stackhpc_sync_ceph_images | bool }}"
483+
484+
# List of container image repositories.
485+
stackhpc_pulp_repository_container_repos: >-
486+
{{ (stackhpc_pulp_repository_container_repos_kolla +
487+
stackhpc_pulp_repository_container_repos_ceph) | selectattr('required') }}
488+
489+
# List of container image distributions.
490+
stackhpc_pulp_distribution_container: >-
491+
{{ (stackhpc_pulp_distribution_container_kolla +
492+
stackhpc_pulp_distribution_container_ceph) | selectattr('required') }}

0 commit comments

Comments
 (0)