Skip to content

Commit 555f302

Browse files
mrveissclaude
andcommitted
fix(ansible): fix code_source ownership before git reset to unblock pre-flight sync
Earlier sudo cp commands left provision-fleet-roles.yml owned by root:root in code_source, causing git reset --hard to fail with EPERM. Add a pre-flight chown (become: true) that runs before the git pull so force: yes can always overwrite any root-owned file regardless of how it got there. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 22c8ca2 commit 555f302

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

autobot-slm-backend/ansible/playbooks/provision-fleet-roles.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@
6060
changed_when: false
6161
tags: [always]
6262

63+
# Root-owned files in code_source (e.g. from earlier sudo cp) block
64+
# git reset --hard. Fix ownership before the pull so force: yes works.
65+
- name: "[PRE-FLIGHT] Fix code_source ownership so git reset can overwrite"
66+
ansible.builtin.file:
67+
path: "{{ git_repo_root }}"
68+
state: directory
69+
owner: "{{ ansible_user_id | default('autobot') }}"
70+
group: "{{ ansible_user_id | default('autobot') }}"
71+
recurse: true
72+
become: true
73+
failed_when: false
74+
changed_when: false
75+
tags: [always]
76+
6377
- name: "[PRE-FLIGHT] Sync latest code from GitHub (if reachable)"
6478
ansible.builtin.git:
6579
repo: "{{ github_repo }}"

0 commit comments

Comments
 (0)