Fix become on localhost tasks and update inventory path comment

- Add become: false to Play 4 (report) to prevent sudo on Semaphore host
- Add become: false to all delegate_to: localhost tasks in Plays 2 & 3
- Update usage comment to reflect correct inventory path (inventory/hosts.yml)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sam 2026-03-01 00:44:21 -07:00
parent 2a507cec7d
commit 00c3288452

View File

@ -132,6 +132,7 @@
delay: 3
timeout: 30
delegate_to: localhost
become: false
when: agent_deployed is changed
@ -161,6 +162,7 @@
status_code: 200
register: existing_endpoints
delegate_to: localhost
become: false
run_once: false
- name: Determine if this host is already enrolled
@ -187,6 +189,7 @@
return_content: true
register: portainer_enroll
delegate_to: localhost
become: false
when: not already_enrolled
- name: Store enrollment result
@ -211,6 +214,7 @@
- name: Generate Docker host discovery report
hosts: localhost
gather_facts: false
become: false
vars:
report_path: "{{ playbook_dir }}/../semaphore/reports/docker_hosts_{{ ansible_date_time.date }}.txt"
tasks: