Skip to content

Commit 79a5ef3

Browse files
authored
fix: prevent unnecessary changes to k3s config directory permissions (#25)
- Set k3s_config_dir to mode 0700 during initial creation in main.yml - Remove redundant permission setting in security.yml - Fixes idempotency issue where permissions were changed on every run Previously, the directory was created with 0755 in main.yml and then changed to 0700 in security.yml, causing the task to always report 'changed' status even when no actual changes were needed.
1 parent b68dd41 commit 79a5ef3

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

roles/k3s/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
ansible.builtin.file:
169169
path: "{{ k3s_config_dir }}"
170170
state: directory
171-
mode: "0755"
171+
mode: "0700"
172172
owner: root
173173
group: root
174174
become: true

roles/k3s/tasks/security.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,7 @@
170170

171171

172172
# General Security Hardening
173-
- name: Configure secure file permissions for K3s configuration directory
174-
ansible.builtin.file:
175-
path: "{{ k3s_config_dir }}"
176-
mode: "0700"
177-
owner: root
178-
group: root
179-
state: directory
180-
become: true
181-
when: k3s_config_dir is defined
173+
# K3s configuration directory permissions are set during directory creation in main.yml
182174

183175
# - name: Configure secure file permissions for K3s token file
184176
# ansible.builtin.file:

0 commit comments

Comments
 (0)