aboutsummaryrefslogtreecommitdiff
path: root/roles/cephadm
diff options
context:
space:
mode:
authorMichal Nasiadka <mnasiadka@gmail.com>2022-04-06 17:16:27 +0200
committerRadosław Piliszek <radoslaw.piliszek@gmail.com>2022-06-20 09:49:55 +0000
commitc922d458df43e4d633c79be8eb04c98a4ddb3e69 (patch)
treed04e33ba646e6d58e277460645cc3ef18471eb7d /roles/cephadm
parentbf30ed621be18a2a9de538167c255c23f2921df7 (diff)
downloadkolla-ansible-c922d458df43e4d633c79be8eb04c98a4ddb3e69.tar.gz
kolla-ansible-c922d458df43e4d633c79be8eb04c98a4ddb3e69.zip
CI: cephadm: Add osds/pools/users in one run
Change-Id: If9b40079d42cdabfd14d27603357dd0aa027a49b
Diffstat (limited to 'roles/cephadm')
-rw-r--r--roles/cephadm/tasks/main.yml44
-rw-r--r--roles/cephadm/templates/commands.sh.j223
2 files changed, 30 insertions, 37 deletions
diff --git a/roles/cephadm/tasks/main.yml b/roles/cephadm/tasks/main.yml
index e2d02615f..d4559382e 100644
--- a/roles/cephadm/tasks/main.yml
+++ b/roles/cephadm/tasks/main.yml
@@ -65,43 +65,18 @@
dest: "/var/run/ceph/{{ ceph_fsid }}/cluster.yml"
become: True
-- name: Check Ceph Orchestrator state
- command:
- cmd: >
- cephadm shell --
- ceph orch status --detail
- become: True
-
-- name: Apply cluster spec
- command:
- cmd: >
- cephadm shell --
- ceph orch apply -i /var/run/ceph/cluster.yml
+- name: Template out command spec
+ template:
+ src: templates/commands.sh.j2
+ dest: "/var/run/ceph/{{ ceph_fsid }}/commands.sh"
become: True
-- name: Add osds
+- name: Run commands
command:
cmd: >
cephadm shell --
- ceph orch daemon add osd {{ item }}
+ bash /var/run/ceph/commands.sh
become: True
- loop: "{{ cephadm_ceph_osd_devices }}"
-
-- name: Create and initialise pools for OpenStack services
- command:
- cmd: >
- cephadm shell --
- ceph osd pool create {{ item }}
- with_items: "{{ cephadm_ceph_pools }}"
- become: true
-
-- name: Create users for OpenStack services
- command:
- cmd: >
- cephadm shell --
- ceph auth get-or-create {{ item }}
- become: true
- with_items: "{{ cephadm_ceph_users }}"
# TODO(mnasiadka): Fix merge_configs to support tabs
- name: Generate ceph.conf without tabs
@@ -112,10 +87,5 @@
mon_host = {% for host in groups['all'] %} {{ hostvars[host]['ansible_'+api_interface_name].ipv4.address }} {% if not loop.last %},{% endif %} {% endfor %}
copy:
content: "{{ ceph_conf_fixed }}"
- dest: /etc/ceph/ceph.conf
- become: True
-
-- name: Check ceph health
- command:
- cmd: cephadm shell -- ceph health detail
+ dest: "/etc/ceph/ceph.conf.fixed"
become: True
diff --git a/roles/cephadm/templates/commands.sh.j2 b/roles/cephadm/templates/commands.sh.j2
new file mode 100644
index 000000000..dfdf79ec1
--- /dev/null
+++ b/roles/cephadm/templates/commands.sh.j2
@@ -0,0 +1,23 @@
+# Status
+ceph orch status --detail
+
+# Apply cluster spec
+ceph orch apply -i /var/run/ceph/cluster.yml
+
+# OSDs
+{% for osd in cephadm_ceph_osd_devices %}
+ceph orch daemon add osd {{ osd }}
+{% endfor %}
+
+# Pools
+{% for pool in cephadm_ceph_pools %}
+ceph osd pool create {{ pool }}
+{% endfor %}
+
+# Users
+{% for user in cephadm_ceph_users %}
+ceph auth get-or-create {{ user }}
+{% endfor %}
+
+# Health
+ceph health detail