feat: adopt cephadm (#752)

diff --git a/.github/workflows/csi.yml b/.github/workflows/csi.yml
index 736763d..0f10664 100644
--- a/.github/workflows/csi.yml
+++ b/.github/workflows/csi.yml
@@ -38,7 +38,7 @@
 
 jobs:
   test:
-    runs-on: ubuntu-latest
+    runs-on: v3-standard-16
     strategy:
       fail-fast: false
       matrix:
diff --git a/galaxy.yml b/galaxy.yml
index f5c9eb0..0ddb50e 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -16,7 +16,7 @@
   community.mysql: 3.6.0
   kubernetes.core: 2.4.0
   openstack.cloud: 1.7.0
-  vexxhost.ceph: 2.1.0
+  vexxhost.ceph: 3.0.1
   vexxhost.kubernetes: 1.12.1
 tags:
   - application
diff --git a/molecule/aio/converge.yml b/molecule/aio/converge.yml
index 234aec8..7da0738 100644
--- a/molecule/aio/converge.yml
+++ b/molecule/aio/converge.yml
@@ -13,11 +13,7 @@
 # under the License.
 
 - name: Install Ceph
-  ansible.builtin.import_playbook: vexxhost.ceph.site
-  vars:
-    # TODO(mnaser): Drop this once we switch to vexxhost.ceph 3.0.0
-    ceph_version: 18.2.1
-    ceph_repository_version: 18.2.1
+  ansible.builtin.import_playbook: vexxhost.atmosphere.ceph
 
 - name: Install Kubernetes
   ansible.builtin.import_playbook: vexxhost.atmosphere.kubernetes
diff --git a/molecule/aio/molecule.yml b/molecule/aio/molecule.yml
index e88073a..720a343 100644
--- a/molecule/aio/molecule.yml
+++ b/molecule/aio/molecule.yml
@@ -29,6 +29,8 @@
       - computes
 provisioner:
   name: ansible
+  env:
+    DOCKER_TIMEOUT: 600
   config_options:
     defaults:
       callbacks_enabled: ansible.posix.profile_tasks
diff --git a/molecule/aio/prepare.yml b/molecule/aio/prepare.yml
index e621e60..342e0d8 100644
--- a/molecule/aio/prepare.yml
+++ b/molecule/aio/prepare.yml
@@ -12,6 +12,19 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+- name: Configure hostname
+  hosts: all
+  tasks:
+    - name: Configure short hostname
+      ansible.builtin.hostname:
+        name: "{{ inventory_hostname_short }}"
+
+    - name: Ensure hostname inside hosts file
+      ansible.builtin.lineinfile:
+        path: /etc/hosts
+        regexp: '^127\.0\.1\.1'
+        line: 127.0.1.1 {{ inventory_hostname }} {{ inventory_hostname_short }}
+
 - name: Create fake devices for Ceph
   ansible.builtin.import_playbook: vexxhost.ceph.create_fake_devices
 
diff --git a/molecule/shared/molecule.yml b/molecule/shared/molecule.yml
index fc4afdc..507a0b2 100644
--- a/molecule/shared/molecule.yml
+++ b/molecule/shared/molecule.yml
@@ -54,6 +54,8 @@
       - computes
 provisioner:
   name: ansible
+  env:
+    DOCKER_TIMEOUT: 600
   config_options:
     connection:
       pipelining: true
diff --git a/molecule/shared/prepare/ceph.yml b/molecule/shared/prepare/ceph.yml
index cd622d3..8cff449 100644
--- a/molecule/shared/prepare/ceph.yml
+++ b/molecule/shared/prepare/ceph.yml
@@ -13,7 +13,7 @@
 # under the License.
 
 - ansible.builtin.import_playbook: vexxhost.ceph.create_fake_devices
-- ansible.builtin.import_playbook: vexxhost.ceph.site
+- ansible.builtin.import_playbook: vexxhost.atmosphere.ceph
   vars:
     ceph_osd_devices:
       - "/dev/ceph-{{ inventory_hostname_short }}-osd0/data"
diff --git a/playbooks/ceph.yml b/playbooks/ceph.yml
new file mode 100644
index 0000000..ede7fbd
--- /dev/null
+++ b/playbooks/ceph.yml
@@ -0,0 +1,28 @@
+# Copyright (c) 2024 VEXXHOST, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+- hosts: "{{ target | default('all') }}"
+  become: true
+  roles:
+    - role: defaults
+  post_tasks:
+    - name: Set a fact with the "atmosphere_images" for other plays
+      ansible.builtin.set_fact:
+        atmosphere_images: "{{ atmosphere_images }}"
+      tags:
+        - always
+
+- import_playbook: vexxhost.ceph.site
+  vars:
+    containerd_pause_image: "{{ atmosphere_images['pause'] }}"
diff --git a/playbooks/csi.yml b/playbooks/csi.yml
index 27d9c29..a0590fe 100644
--- a/playbooks/csi.yml
+++ b/playbooks/csi.yml
@@ -19,3 +19,6 @@
     - role: csi
       tags:
         - csi
+  environment:
+    CEPH_CONTAINER_IMAGE: "{{ cephadm_image | default('quay.io/ceph/ceph:v' + (ceph_version | default('18.2.1'))) }}"
+    CEPH_CONTAINER_BINARY: docker
diff --git a/playbooks/kubernetes.yml b/playbooks/kubernetes.yml
index c4bea74..fca47d3 100644
--- a/playbooks/kubernetes.yml
+++ b/playbooks/kubernetes.yml
@@ -31,6 +31,22 @@
       tags:
         - always
 
+- hosts: "{{ target | default('all') }}"
+  become: true
+  gather_facts: false
+  tasks:
+    - name: Install PIP
+      ansible.builtin.package:
+        name: python3-pip
+
+    # (rico) there is dependency isuse with pyopenssl and cryptography before 22.1.0
+    # This make sure we have consist dependency between them.
+    - name: Upgrade pyopenssl in pip
+      ansible.builtin.pip:
+        name:
+          - pyopenssl>=22.1.0
+        extra_args: --upgrade
+
 - import_playbook: vexxhost.kubernetes.site
   vars:
     keepalived_image: "{{ atmosphere_images['keepalived'] }}"
diff --git a/playbooks/openstack.yml b/playbooks/openstack.yml
index be3cc7c..3d12749 100644
--- a/playbooks/openstack.yml
+++ b/playbooks/openstack.yml
@@ -59,6 +59,9 @@
     - role: placement
       tags:
         - placement
+  environment:
+    CEPH_CONTAINER_IMAGE: "{{ cephadm_image | default('quay.io/ceph/ceph:v' + (ceph_version | default('18.2.1'))) }}"
+    CEPH_CONTAINER_BINARY: docker
 
 - name: Configure operating system
   hosts: controllers:computes
diff --git a/playbooks/site.yml b/playbooks/site.yml
index 5d44097..d4639ae 100644
--- a/playbooks/site.yml
+++ b/playbooks/site.yml
@@ -12,7 +12,8 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
-- import_playbook: vexxhost.ceph.site
+- name: Install Ceph
+  import_playbook: vexxhost.atmosphere.ceph
 
 - name: Install Kubernetes
   import_playbook: vexxhost.atmosphere.kubernetes
diff --git a/roles/ceph_csi_rbd/tasks/main.yml b/roles/ceph_csi_rbd/tasks/main.yml
index 6db53e0..213aee7 100644
--- a/roles/ceph_csi_rbd/tasks/main.yml
+++ b/roles/ceph_csi_rbd/tasks/main.yml
@@ -15,7 +15,7 @@
 - name: Collect "ceph mon dump" output from a monitor
   delegate_to: "{{ groups[ceph_csi_rbd_mons_group][0] }}"
   run_once: true
-  ansible.builtin.command: ceph mon dump -f json
+  ansible.builtin.command: cephadm shell -- ceph mon dump -f json
   changed_when: false
   register: _ceph_mon_dump
 
diff --git a/roles/ceph_provisioners/tasks/main.yml b/roles/ceph_provisioners/tasks/main.yml
index e175a24..e62069b 100644
--- a/roles/ceph_provisioners/tasks/main.yml
+++ b/roles/ceph_provisioners/tasks/main.yml
@@ -15,7 +15,7 @@
 - name: Collect "ceph mon dump" output from a monitor
   delegate_to: "{{ groups[ceph_provisioners_ceph_mon_group][0] }}"
   run_once: true
-  ansible.builtin.command: ceph mon dump -f json
+  ansible.builtin.command: cephadm shell -- ceph mon dump -f json
   changed_when: false
   register: _ceph_mon_dump
 
diff --git a/roles/rook_ceph_cluster/tasks/main.yml b/roles/rook_ceph_cluster/tasks/main.yml
index 0c8232a..078bd38 100644
--- a/roles/rook_ceph_cluster/tasks/main.yml
+++ b/roles/rook_ceph_cluster/tasks/main.yml
@@ -12,10 +12,19 @@
 # License for the specific language governing permissions and limitations
 # under the License.
 
+# (rlin) This is because rgw will be managed by rook operator. We need to mute
+# CEPHADM_STRAY_DAEMON until we have all daemon managed by cephadm
+- name: Mute CEPHADM_STRAY_DAEMON warning
+  run_once: true
+  delegate_to: "{{ groups[rook_ceph_cluster_mon_group][0] }}"
+  ansible.builtin.command: cephadm shell -- ceph health mute CEPHADM_STRAY_DAEMON
+  failed_when: false
+  changed_when: false
+
 - name: Collect "ceph quorum_status" output from a monitor
   run_once: true
   delegate_to: "{{ groups[rook_ceph_cluster_mon_group][0] }}"
-  ansible.builtin.command: ceph quorum_status -f json
+  ansible.builtin.command: cephadm shell -- ceph quorum_status -f json
   changed_when: false
   register: _rook_ceph_cluster_quorum_status_data