diff --git a/salt/libvirt/ssh/files/config b/salt/libvirt/ssh/files/config index 25af86b73..360d5c182 100644 --- a/salt/libvirt/ssh/files/config +++ b/salt/libvirt/ssh/files/config @@ -1,2 +1,2 @@ Host * - IdentityFile /home/soqemussh/.ssh/id_ed25519 + IdentityFile /etc/ssh/auth_keys/soqemussh/id_ed25519 diff --git a/salt/libvirt/ssh/users.sls b/salt/libvirt/ssh/users.sls index a893b9a7d..f0e30caec 100644 --- a/salt/libvirt/ssh/users.sls +++ b/salt/libvirt/ssh/users.sls @@ -5,44 +5,10 @@ {% from 'vars/globals.map.jinja' import GLOBALS %} -# used for qemu+ssh connection between manager and hypervisors -create_soqemussh_user: - user.present: - - name: soqemussh - - shell: /bin/bash - - home: /home/soqemussh -{% if not GLOBALS.is_manager %} - - groups: - - wheel - - qemu - - libvirt -{% endif %} + {% if GLOBALS.is_manager %} -create_local_libvirt_ssh_key_dir: - file.directory: - - name: /opt/so/saltstack/local/salt/libvirt/ssh/keys - - user: socore - - group: socore - - mode: 755 - - makedirs: True - -# generate the key pair and put the pub key in salt local files roots -generate_ssh_key_soqemussh: - cmd.run: - - name: ssh-keygen -q -N '' -t ed25519 -f /home/soqemussh/.ssh/id_ed25519 - - runas: soqemussh - - unless: test -f /home/soqemussh/.ssh/id_ed25519 - - require: - - user: create_soqemussh_user - -soqemussh_ssh_key_to_local: - cmd.run: - - name: cp /home/soqemussh/.ssh/id_ed25519.pub /opt/so/saltstack/local/salt/libvirt/ssh/keys - - onchanges: - - cmd: generate_ssh_key_soqemussh - qemu_ssh_client_config: file.managed: - name: /root/.ssh/config @@ -50,6 +16,17 @@ qemu_ssh_client_config: {% else %} +# used for qemu+ssh connection between manager and hypervisors +create_soqemussh_user: + user.present: + - name: soqemussh + - shell: /bin/bash + - home: /home/soqemussh + - groups: + - wheel + - qemu + - libvirt + soqemussh_pub_key: ssh_auth.present: - user: soqemussh