fix: fix use of become/become_user

If `become_user` is being defined on a task level, also `become` should
be set on that very task. As there aren't any other tasks, the `become`
on the top-level becomes obsolete.
This commit is contained in:
Christoph Schug 2024-03-03 17:54:55 +01:00
parent 7ceb755f35
commit 7983a7c85f

View File

@ -1,11 +1,9 @@
---
- name: Deploy traefik v2.5
hosts: "{{ my_hosts | d([]) }}"
become: true
tasks:
- name: Deploy traefik
become_user: "{{ lookup('env', 'USER') }}"
community.docker.docker_container:
name: traefik
image: "traefik:v2.5"
@ -16,3 +14,5 @@
- /var/run/docker.sock:/var/run/docker.sock
- /etc/traefik:/etc/traefik
restart_policy: unless-stopped
become: true
become_user: "{{ lookup('env', 'USER') }}"