Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronize with src: .. behaves the same as src: . #558

Open
dalbertom opened this issue Aug 8, 2024 · 0 comments
Open

synchronize with src: .. behaves the same as src: . #558

dalbertom opened this issue Aug 8, 2024 · 0 comments
Labels
synchronize Issue and PR for synchronize module

Comments

@dalbertom
Copy link

dalbertom commented Aug 8, 2024

SUMMARY

Hi there, I have a repository that I want to copy over using synchronize but I keep the ansible playbook in a subdirectory, so I set src: .. and to my surprise only the ansible directory gets copied over instead of the entire repository. This behaves exactly the same as src: .. To workaround it, I can use src: ../.. but that's technically incorrect. Another workaround I found is src: "{{ playbook_dir }}/.."

ISSUE TYPE
  • Bug Report
COMPONENT NAME

synchronize

ANSIBLE VERSION
ansible [core 2.17.1]
  config file = /Users/user/src/repository/ansible/ansible.cfg
  configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/10.1.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.4 (main, Jun  6 2024, 18:26:44) [Clang 15.0.0 (clang-1500.3.9.4)] (/opt/homebrew/Cellar/ansible/10.1.0/libexec/bin/python)
  jinja version = 3.1.4
  libyaml = True

COLLECTION VERSION
Collection        Version
----------------- -------
community.general 9.1.0
ansible.posix 1.5.4
CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vi
OS / ENVIRONMENT

macOS Sonoma 14.6

STEPS TO REPRODUCE
touch missing.txt
mkdir ansible
touch ansible/playbook.yml
# ansible/playbook.yml
---
- hosts: localhost
  tasks:
    - name: This should have copied missing.txt
      synchronize:
        src: ..
        dest: "/tmp/destination"
cd ansible
ansible-playbook playbook.yml # only ansible directory is copied
EXPECTED RESULTS

With src: .. I would expect the parent directory to be copied over

ACTUAL RESULTS

both src: . and src: .. evaluate to the ansible directory

TASK [This should have copied missing.txt] *********************************************************************************************************************************************************************************************************
ok: [localhost] => {"changed": false, "cmd": "/opt/homebrew/bin/rsync --delay-updates -F --compress --archive --out-format='<<CHANGED>>%i %n%L' /Users/user/path/ansible /tmp/destination", "msg": "", "rc": 0, "stdout_lines": []}
@saito-hideki saito-hideki added the synchronize Issue and PR for synchronize module label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
synchronize Issue and PR for synchronize module
Projects
None yet
Development

No branches or pull requests

2 participants