I'm not able to fix this problem. Not with Google, not with AI.
I got a folder / git structure that I have my playbooks folder on the first level. My docker folder contains folders named after my docker services with compose.yml
files inside.
I have the following playbook and I'm trying to execute it in Semaphore (Ansible UI).
The problem is that this relative path I want to point to (docker folder) is not found.
It will always end in this error:
failed: [azure] (item={'changed': False, 'stat': {'exists': False}, 'invocation': {'module_args': {'path': '/opt/stacks/watchtower', 'follow': False, 'get_checksum': True, 'get_mime': True, 'get_attributes': True, 'checksum_algorithm': 'sha1'}}, 'failed': False, 'item': '/tmp/semaphore/repository_1_14/playbooks/../docker/watchtower',
The playbook:
---
# This Ansible playbook is designed to copy Docker Compose files to specified hosts.
- name: Copy Docker Compose Files
hosts: all
become: true
tasks:
- name: Ensure /opt/stacks directory exists
file:
path: /opt/stacks
state: directory
mode: '0755'
- name: Copy Docker Compose directories to vps hosts
copy:
src: "{{ playbook_dir }}/../docker/{{ item }}"
dest: "/opt/stacks/"
remote_src: yes
with_items:
- watchtower
- dockerproxy
- portainer-agent
when: "'vps' in group_names"
- name: Copy Docker Compose directories to vps hosts
copy:
src: "{{ item.item }}"
dest: "/opt/stacks/"
remote_src: yes
with_items: "{{ stack_dirs.results }}"
when: item.stat.exists == false and "'vps' in group_names"
- name: Copy uptime-kuma directory to oracle
copy:
src: "{{ playbook_dir }}/../docker/uptime-kuma"
dest: "/opt/stacks/"
remote_src: yes
when: inventory_hostname == 'oracle'
I'm not able to fix this problem. Not with Google, not with AI.
I got a folder / git structure that I have my playbooks folder on the first level. My docker folder contains folders named after my docker services with compose.yml
files inside.
I have the following playbook and I'm trying to execute it in Semaphore (Ansible UI).
The problem is that this relative path I want to point to (docker folder) is not found.
It will always end in this error:
failed: [azure] (item={'changed': False, 'stat': {'exists': False}, 'invocation': {'module_args': {'path': '/opt/stacks/watchtower', 'follow': False, 'get_checksum': True, 'get_mime': True, 'get_attributes': True, 'checksum_algorithm': 'sha1'}}, 'failed': False, 'item': '/tmp/semaphore/repository_1_14/playbooks/../docker/watchtower',
The playbook:
---
# This Ansible playbook is designed to copy Docker Compose files to specified hosts.
- name: Copy Docker Compose Files
hosts: all
become: true
tasks:
- name: Ensure /opt/stacks directory exists
file:
path: /opt/stacks
state: directory
mode: '0755'
- name: Copy Docker Compose directories to vps hosts
copy:
src: "{{ playbook_dir }}/../docker/{{ item }}"
dest: "/opt/stacks/"
remote_src: yes
with_items:
- watchtower
- dockerproxy
- portainer-agent
when: "'vps' in group_names"
- name: Copy Docker Compose directories to vps hosts
copy:
src: "{{ item.item }}"
dest: "/opt/stacks/"
remote_src: yes
with_items: "{{ stack_dirs.results }}"
when: item.stat.exists == false and "'vps' in group_names"
- name: Copy uptime-kuma directory to oracle
copy:
src: "{{ playbook_dir }}/../docker/uptime-kuma"
dest: "/opt/stacks/"
remote_src: yes
when: inventory_hostname == 'oracle'
Your src: "{{ playbook_dir }}/../docker/{{ item }}"
does not create a real path.
/tmp/semaphore/repository_1_14/playbooks/../docker/watchtower
does not exist and it does not equate the /tmp/semaphore/repository_1_14/docker/watchtower
you need.
Try src: "docker/{{ item }}"
.
../docker/{{ item }}
, would it work? – U880D Commented Jan 23 at 14:41Source ../docker/watchtower not found
– CptDayDreamer Commented Jan 23 at 22:48