From: Ullli Date: Tue, 28 Apr 2026 06:59:11 +0000 (+0200) Subject: Ansible-User getrennt als root anlegen X-Git-Url: https://freie-schul-it.de/gitweb/fsit_smgt.git/commitdiff_plain/92826cf8801861aad81ee40e43ee768f461b8ab7?hp=84184ad94c339f478caa5973d129470bcc57a237 Ansible-User getrennt als root anlegen --- diff --git a/tasks/add-ansible-user.yml b/tasks/add-ansible-user.yml new file mode 100644 index 0000000..09024dd --- /dev/null +++ b/tasks/add-ansible-user.yml @@ -0,0 +1,18 @@ +--- +- name: Add ansible user to server + ansible.builtin.user: + name: ansible + shell: /bin/bash +- name: Allow "ansible"-user to have passwordless sudo + ansible.builtin.copy: + src: sudo_ansible + dest: /etc/sudoers.d/ansible + owner: root + group: root + mode: "0440" +- name: Add installbox-ansible-user _public_ ssh-key to the servers authorized_keys file + ansible.posix.authorized_key: + user: ansible + state: present + manage_dir: true + key: "{{ lookup('file', '/home/ansible/.ssh/id_ed25519.pub') }}"