]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
rgw: fix multi instances scaleout
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 1 Jul 2020 08:47:45 +0000 (10:47 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 20 Jul 2020 19:23:27 +0000 (21:23 +0200)
When rgw and osd are collocated, the current workflow prevents from
scaling out the radosgw_num_instances parameter when rerunning the
playbook.

The environment file used in the rgw systemd template is rendered when
executing the `ceph-rgw` role but during a new run of the playbook (in
order to scale out rgw instances), handlers are triggered from `ceph-osd`
role which is run before `ceph-rgw`, therefore it tries to start the new
rgw daemon whereas its corresponding environment file hasn't been
rendered yet and fails like following:

```
ceph-radosgw@rgw.ceph4osd3.rgw1.service failed to run 'start-pre' task: No such file or directory
```

This commit moves the tasks generating this file in `ceph-config` role
so it is generated early.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1851906
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 7dd68b9ac1086e3c15cfad3812f1c141eadd80c0)

infrastructure-playbooks/switch-from-non-containerized-to-containerized-ceph-daemons.yml
roles/ceph-config/tasks/main.yml
roles/ceph-config/tasks/rgw_systemd_environment_file.yml [new file with mode: 0644]
roles/ceph-rgw/tasks/common.yml
roles/ceph-rgw/tasks/start_docker_rgw.yml

index 4e638a80f33c988f70d04495773b4e573b116dbb..1de18a51b1d0c9a95b90a85d078f303a2cc14371 100644 (file)
     - import_role:
         name: ceph-facts
 
+    - import_role:
+        name: ceph-config
+        tasks_from: rgw_systemd_environment_file.yml
+
     # NOTE: changed from file module to raw find command for performance reasons
     # The file module has to run checks on current ownership of all directories and files. This is unnecessary
     # as in this case we know we want all owned by ceph user
index 9b37f0e4591eee836757d807724371003df2368e..98ac4813d37b2ff61e2b3e85689ea560037ddae2 100644 (file)
@@ -3,6 +3,10 @@
   include_tasks: create_ceph_initial_dirs.yml
   when: containerized_deployment | bool
 
+- name: include_tasks rgw_systemd_environment_file.yml
+  include_tasks: rgw_systemd_environment_file.yml
+  when: inventory_hostname in groups.get(rgw_group_name, [])
+
 - name: config file operations related to OSDs
   when:
     - inventory_hostname in groups.get(osd_group_name, [])
diff --git a/roles/ceph-config/tasks/rgw_systemd_environment_file.yml b/roles/ceph-config/tasks/rgw_systemd_environment_file.yml
new file mode 100644 (file)
index 0000000..21a7785
--- /dev/null
@@ -0,0 +1,23 @@
+---
+- name: create rados gateway instance directories
+  file:
+    path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
+    state: directory
+    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
+    mode: "{{ ceph_directories_mode | default('0755') }}"
+  with_items: "{{ rgw_instances }}"
+
+- name: generate environment file
+  copy:
+    dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}.{{ item.instance_name }}/EnvironmentFile"
+    owner: "root"
+    group: "root"
+    mode: "0644"
+    content: |
+      INST_NAME={{ item.instance_name }}
+      INST_PORT={{ item.radosgw_frontend_port }}
+  with_items: "{{ rgw_instances }}"
+  when:
+    - containerized_deployment | bool
+    - rgw_instances is defined
\ No newline at end of file
index a33e0ab96d5aa055e49857e00b3c663fc28ba846..fa40a158939ed0512cbb0d60f7fdd755be5c40a3 100644 (file)
@@ -8,16 +8,6 @@
     mode: "{{ ceph_directories_mode | default('0755') }}"
   with_items: "{{ rbd_client_admin_socket_path }}"
 
-- name: create rados gateway instance directories
-  file:
-    path: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}.{{ item.instance_name }}"
-    state: directory
-    owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
-    mode: "{{ ceph_directories_mode | default('0755') }}"
-  with_items: "{{ rgw_instances }}"
-  when: rgw_instances is defined
-
 - name: get keys from monitors
   command: "{{ container_exec_cmd }} ceph --cluster {{ cluster }} auth get {{ item.name }}"
   register: _rgw_keys
index 7cb3702144df6d39605e2be91012eb2f226797d3..d0d96314ee6b3e7567ba9382015752d7efe6b723 100644 (file)
@@ -1,15 +1,4 @@
 ---
-- name: generate environment file
-  copy:
-    dest: "/var/lib/ceph/radosgw/{{ cluster }}-rgw.{{ ansible_hostname }}.{{ item.instance_name }}/EnvironmentFile"
-    owner: "root"
-    group: "root"
-    mode: "0644"
-    content: |
-      INST_NAME={{ item.instance_name }}
-      INST_PORT={{ item.radosgw_frontend_port }}
-  with_items: "{{ rgw_instances }}"
-
 - name: include_task systemd.yml
   include_tasks: systemd.yml