]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
cephadm: set ssh configs at bootstrap step
authorSeena Fallah <seenafallah@gmail.com>
Sat, 9 Oct 2021 22:52:08 +0000 (02:22 +0330)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 15 Oct 2021 13:13:18 +0000 (15:13 +0200)
Add support ssh_user and ssh_config to cephadm bootstrap plugin

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit ae6be71b081b379e19035d6abc05475ed8a00e5d)

infrastructure-playbooks/cephadm.yml
library/cephadm_bootstrap.py

index 75c39373a0ef9a746a2d66201c09454cf08d195c..64542b4a57bb7289a69af9d26028b727194b5413 100644 (file)
         dashboard_password: "{{ dashboard_admin_password if dashboard_enabled | bool else omit }}"
         monitoring: false
         firewalld: "{{ configure_firewall }}"
+        ssh_user: "{{ cephadm_ssh_user | default('root') }}"
+        ssh_config: "{{ cephadm_ssh_config | default(omit) }}"
 
     - name: set default container image in ceph configuration
       command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} config set global container_image {{ ceph_docker_registry }}/{{ ceph_docker_image }}:{{ ceph_docker_image_tag }}"
         user: "{{ cephadm_ssh_user | default('root') }}"
         key: '{{ cephadm_pubpkey.stdout }}'
 
-    - name: set cephadm ssh user to {{ cephadm_ssh_user | default('root') }}
-      command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} cephadm set-user {{ cephadm_ssh_user | default('root') }}"
-      changed_when: false
-      run_once: true
-      delegate_to: "{{ groups[mon_group_name][0] }}"
-
     - name: run cephadm prepare-host
       command: cephadm prepare-host
       changed_when: false
index b9bb9c1ab946f3bf9c0fa1d6363cf4753dc0eef6..260c7ede3caee016d041c966172b753d3e992cb0 100644 (file)
@@ -77,6 +77,14 @@ options:
             - Manage firewall rules with firewalld.
         required: false
         default: true
+    ssh_user:
+        description:
+            - SSH user used for cephadm ssh to the hosts
+        required: false
+    ssh_config:
+        description:
+            - SSH config file path for cephadm ssh client
+        required: false
 author:
     - Dimitri Savineau <dsavinea@redhat.com>
 '''
@@ -135,6 +143,8 @@ def main():
             dashboard_password=dict(type='str', required=False, no_log=True),
             monitoring=dict(type='bool', required=False, default=True),
             firewalld=dict(type='bool', required=False, default=True),
+            ssh_user=dict(type='str', required=False),
+            ssh_config=dict(type='str', required=False),
         ),
         supports_check_mode=True,
     )
@@ -149,6 +159,8 @@ def main():
     dashboard_password = module.params.get('dashboard_password')
     monitoring = module.params.get('monitoring')
     firewalld = module.params.get('firewalld')
+    ssh_user = module.params.get('ssh_user')
+    ssh_config = module.params.get('ssh_config')
 
     startd = datetime.datetime.now()
 
@@ -182,6 +194,12 @@ def main():
     if not firewalld:
         cmd.append('--skip-firewalld')
 
+    if ssh_user:
+        cmd.extend(['--ssh-user', ssh_user])
+
+    if ssh_config:
+        cmd.extend(['--ssh-config', ssh_config])
+
     if module.check_mode:
         exit_module(
             module=module,