Skip to content

Commit 92a30f0

Browse files
committed
Split cephadm_commands into pre and post
Split `cephadm_commands` into `cephadm_commands_pre` and `cephadm_commands_post` commands. This allows the user to run commands that must be executed before the rest of the post-deployment configuration, as well as commands that rely on resources created by the post-deployment config.
1 parent 37d5671 commit 92a30f0

File tree

8 files changed

+48
-12
lines changed

8 files changed

+48
-12
lines changed

doc/source/configuration/cephadm.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,26 @@ for Cinder, Cinder backup, Glance, and Nova in Kolla Ansible.
242242
Ceph Commands
243243
~~~~~~~~~~~~~
244244

245-
It is possible to run an arbitrary list of commands against the cluster after deployment
246-
by setting the ``cephadm_commands`` variable. ``cephadm_commands`` should be a list of commands
247-
to pass to ``cephadm shell -- ceph``. For example:
245+
It is possible to run an arbitrary list of commands against the cluster after
246+
deployment by setting the ``cephadm_commands_pre`` and ``cephadm_commands_post``
247+
variables. Each should be a list of commands to pass to ``cephadm shell --
248+
ceph``. For example:
248249

249250
.. code:: yaml
250251
251252
# A list of commands to pass to cephadm shell -- ceph. See stackhpc.cephadm.commands
252253
# for format.
253-
cephadm_commands:
254+
cephadm_commands_pre:
254255
# Configure Prometheus exporter to listen on a specific interface. The default
255256
# is to listen on all interfaces.
256257
- "config set mgr mgr/prometheus/server_addr 10.0.0.1"
257258
259+
Both variables have the same format, however commands in the
260+
``cephadm_commands_pre`` list are executed before the rest of the Ceph
261+
post-deployment configuration is applied. Commands in the
262+
``cephadm_commands_post`` list are executed after the rest of the Ceph
263+
post-deployment configuration is applied.
264+
258265
Deployment
259266
==========
260267

doc/source/contributor/environments/ci-multinode.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ And re-run ``kayobe overcloud service deploy`` if you are working on an existing
7070
deployment.
7171

7272
To test it, you will need two virtual machines. Cirros does not support the Ceph
73-
kernel client, so you will need to use a different image. Any regular Linux
73+
kernel client, so you will need to use a different image. Any regular Linux
7474
distribution should work. As an example, we will use Ubuntu 20.04.
7575

7676
Download the image locally:
@@ -124,7 +124,7 @@ Associate the floating IPs to the instances:
124124
Then SSH into each instance and install the Ceph client:
125125

126126
.. code-block:: bash
127-
127+
128128
sudo apt update
129129
sudo apt install -y ceph-common
130130

etc/kayobe/ansible/cephadm-commands.yml renamed to etc/kayobe/ansible/cephadm-commands-post.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
- name: Ensure additional Ceph commands are run
2+
- name: Ensure additional Ceph commands are run after post-deployment configuration
33
gather_facts: false
44
hosts: mons
55
become: true
@@ -9,3 +9,5 @@
99
tasks:
1010
- import_role:
1111
name: stackhpc.cephadm.commands
12+
vars:
13+
cephadm_commands: "{{ cephadm_commands_post }}"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
- name: Ensure additional Ceph commands are run before post-deployment configuration
3+
gather_facts: false
4+
hosts: mons
5+
become: true
6+
tags:
7+
- cephadm
8+
- cephadm-commands
9+
tasks:
10+
- import_role:
11+
name: stackhpc.cephadm.commands
12+
vars:
13+
cephadm_commands: "{{ cephadm_commands_pre }}"

etc/kayobe/ansible/cephadm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
# Deploy Ceph via Cephadm. Create EC profiles, CRUSH rules, pools and keys.
33
- import_playbook: cephadm-deploy.yml
4+
- import_playbook: cephadm-commands-pre.yml
45
- import_playbook: cephadm-ec-profiles.yml
56
- import_playbook: cephadm-crush-rules.yml
67
- import_playbook: cephadm-pools.yml
78
- import_playbook: cephadm-keys.yml
8-
- import_playbook: cephadm-commands.yml
9+
- import_playbook: cephadm-commands-post.yml

etc/kayobe/cephadm.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,12 @@ cephadm_cluster_network: "{{ storage_mgmt_net_name | net_cidr }}"
6060
# List of Cephx keys. See stackhpc.cephadm.keys role for format.
6161
#cephadm_keys:
6262

63-
# A list of commands to pass to cephadm shell -- ceph. See stackhpc.cephadm.commands
64-
# for format.
65-
#cephadm_commands:
63+
# A list of commands to pass to cephadm shell -- ceph. See
64+
# stackhpc.cephadm.commands for format. Pre commands run before the rest of the
65+
# post-deployment configuration, post commands run after the rest of the
66+
# post-deployment configuration.
67+
#cephadm_commands_pre:
68+
#cephadm_commands_post:
6669

6770
###############################################################################
6871
# Kolla Ceph auto-configuration.

etc/kayobe/environments/ci-multinode/cephadm.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ cephadm_keys:
6969
state: "{{ 'present' if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else 'absent' }}"
7070

7171
# List of Cephadm commands to run. See stackhpc.cephadm.commands role for format.
72-
cephadm_commands: "{{ cephadm_commands_manila_cephfs_native if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else [] }}"
72+
cephadm_commands_pre: []
73+
74+
cephadm_commands_post: "{{ cephadm_commands_manila_cephfs_native if (kolla_enable_manila | bool and kolla_enable_manila_backend_cephfs_native | bool) else [] }}"
7375
cephadm_commands_manila_cephfs_native:
7476
- "fs new manila-cephfs cephfs_metadata cephfs_data"
7577
- "orch apply mds manila-cephfs"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
Split `cephadm_commands` into `cephadm_commands_pre` and
5+
`cephadm_commands_post` commands. This allows the user to run commands that
6+
must be run before the rest of the post-deployment configuration, as well
7+
as commands that rely on resources created by the post-deployment config.
8+

0 commit comments

Comments
 (0)