Update file main.yml

This commit is contained in:
Administrator 2026-03-24 12:39:42 +05:00
parent 3ef24a4233
commit c140824a61

View File

@ -117,18 +117,20 @@
when: ansible_connection != "local" when: ansible_connection != "local"
become: yes become: yes
- name: Ensure SSH directory exists # ========== SSH Keys ==========
- name: Ensure SSH directory exists for root
file: file:
path: /root/.ssh path: /root/.ssh
state: directory state: directory
mode: '0700' mode: '0700'
become: yes become: yes
- name: Add authorized key for root - name: Add authorized keys for root (exclusive)
authorized_key: authorized_key:
user: root user: root
state: present state: present
key: "{{ item }}" key: "{{ item }}"
exclusive: yes
loop: "{{ ssh_public_keys }}" loop: "{{ ssh_public_keys }}"
become: yes become: yes