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

copy not returning a diff when copying multiple files. #81673

Closed
1 task done
davidcsi opened this issue Sep 9, 2023 · 3 comments
Closed
1 task done

copy not returning a diff when copying multiple files. #81673

davidcsi opened this issue Sep 9, 2023 · 3 comments
Labels
affects_2.13 bug This issue/PR relates to a bug.

Comments

@davidcsi
Copy link

davidcsi commented Sep 9, 2023

Summary

I'm copying multiple files and copy is not returning a diff, if i do:

time ansible-playbook -i inventory/hosts.yml --check --diff -l i-... pb.yml --tags deploy_lua_scripts
with the copy:

- name: deploy lua scripts
  ansible.builtin.copy:
    src: scripts/file.lua
    dest: /scripts/file.lua
    owner: some
    group: some
  check_mode: yes
  tags:
    - update_lua_scripts

i get a proper diff:


PLAY [apply configuration to platform instances] *********************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [i-...]

TASK [host: include_tasks] **********************************************************************************************************
included: /tasks/pb.yml for i-...

TASK [host: deploy lua scripts] ******************************************************************************************
--- before: /scripts/file.lua
+++ after: /scripts/file.lua
@@ -74,6 +74,16 @@
     previous code

+    some more code
+
     -- some code

changed: [i-...]

PLAY RECAP ***********************************************************************************************************************************
i-...        : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

but if i do the same with
``

  • name: deploy lua scripts
    ansible.builtin.copy:
    src: scripts/
    dest: /scripts
    owner: some
    group: some
    check_mode: yes
    tags:
    • update_lua_scripts

i don't get a diff

PLAY [apply configuration to platform instances] *********************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [i-...]

TASK [host : include_tasks] **********************************************************************************************************
included: /tasks/pb.yml for i-...

TASK [host : deploy lua scripts] ******************************************************************************************
changed: [i-...]

PLAY RECAP ***********************************************************************************************************************************
i-... : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0


on the same exact host... why could this be happening?
It's worth noting there are subfolder and binaries on the subfolders, though there's no changes on any binaries.

it only works when there is ONE file to copy... is this by design?

I'm using 

ansible [core 2.13.6]



thanks!

### Issue Type

Bug Report

### Component Name

module

### Ansible Version

```console
% ansible --version
ansible [core 2.13.6]
  config file = /Users/david.villasmil/TextNow/repos/cpa/deploy/ansible/ansible.cfg
  configured module search path = ['/Users/david.villasmil/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/david.villasmil/Library/Python/3.10/lib/python/site-packages/ansible
  ansible collection location = /Users/david.villasmil/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/david.villasmil/Library/Python/3.10/bin/ansible
  python version = 3.10.12 (main, Jun 20 2023, 16:51:46) [Clang 14.0.0 (clang-1400.0.29.202)]
  jinja version = 3.1.2
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

OS / Environment

ios ventura 13

Steps to Reproduce

I'm copying multiple files and copy is not returning a diff, if i do:

time ansible-playbook -i inventory/hosts.yml --check --diff -l i-... pb.yml --tags deploy_lua_scripts
with the copy:

- name: deploy lua scripts
  ansible.builtin.copy:
    src: scripts/file.lua
    dest: /scripts/file.lua
    owner: some
    group: some
  check_mode: yes
  tags:
    - update_lua_scripts

i get a proper diff:


PLAY [apply configuration to platform instances] *********************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [i-...]

TASK [host: include_tasks] **********************************************************************************************************
included: /tasks/pb.yml for i-...

TASK [host: deploy lua scripts] ******************************************************************************************
--- before: /scripts/file.lua
+++ after: /scripts/file.lua
@@ -74,6 +74,16 @@
     previous code

+    some more code
+
     -- some code

changed: [i-...]

PLAY RECAP ***********************************************************************************************************************************
i-...        : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

but if i do the same with
``

  • name: deploy lua scripts
    ansible.builtin.copy:
    src: scripts/
    dest: /scripts
    owner: some
    group: some
    check_mode: yes
    tags:
    • update_lua_scripts

i don't get a diff

PLAY [apply configuration to platform instances] *********************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [i-...]

TASK [host : include_tasks] **********************************************************************************************************
included: /tasks/pb.yml for i-...

TASK [host : deploy lua scripts] ******************************************************************************************
changed: [i-...]

PLAY RECAP ***********************************************************************************************************************************
i-... : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0


on the same exact host... why could this be happening?
It's worth noting there are subfolder and binaries on the subfolders, though there's no changes on any binaries.

it only works when there is ONE file to copy... is this by design?

I'm using 

ansible [core 2.13.6]



thanks!

### Expected Results

i expect to get a diff for every file.

### Actual Results

```console
PLAY [apply configuration to platform instances] *********************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************
ok: [i-...]

TASK [host : include_tasks] **********************************************************************************************************
included: /tasks/pb.yml for i-...

TASK [host : deploy lua scripts] ******************************************************************************************
changed: [i-...]

PLAY RECAP ***********************************************************************************************************************************
i-...        : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. affects_2.13 labels Sep 9, 2023
@ansibot
Copy link
Contributor

ansibot commented Sep 9, 2023

Files identified in the description:

None

If these files are incorrect, please update the component name section of the description or use the component bot command.

@davidcsi
Copy link
Author

davidcsi commented Sep 9, 2023

i repro'd with a simple playbook:

---
- hosts:
    - myhosts
  become: yes
  tasks:
    - name: deploy lua scripts
      ansible.builtin.copy:
        src: roles/platform/files/scripts/
        dest: /scripts
        owner: user
        group: user

same thing happens, if i set the src to a specific file, i get a diff, otherwise nothing comes back

@s-hertel
Copy link
Contributor

Closing in favor of #81346.

@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Sep 12, 2023
@ansible ansible locked and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.13 bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants