- name: Pull Portainer Agent image become: true community.docker.docker_image: name: portainer/agent tag: latest source: pull - name: Deploy Portainer Agent container become: true community.docker.docker_container: name: portainer_agent image: portainer/agent pull: false # we already pulled above state: started restart_policy: always ports: - "9001:9001" volumes: - /var/run/docker.sock:/var/run/docker.sock - /var/lib/docker/volumes:/var/lib/docker/volumes - /:/host timeout: 120 # wait up to 2m for it to come up