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: return 0 when force=false and dest exists #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maertsen
Copy link

The parameter force=false makes the copy command fail when the destination exists. This should be a success instead.

Example task:

- name: copy authorized_keys                                                                                           
  copy:                                                                                                                
    src: /etc/dropbear/authorized_keys                                                                                 
    remote_src: true                                                                
    dest: /root/.ssh/authorized_keys                                                                                   
    force: false # only copy when missing 

Failure:

TASK [openwrt-openssh : copy authorized_keys] *************************************************************************
fatal: [test_host]: FAILED! => {"changed": false, "dest": "/root/.ssh/authorized_keys", "md5sum": "46be6e2ba65d15efb16b1118f537f353", "msg": "file already exists", "src": "/etc/dropbear/authorized_keys"}

Success (patched):

TASK [openwrt-openssh : copy authorized_keys] *************************************************************************
ok: [test_host]

The parameter force=false makes the copy command fail when the destination exists. This should be a success instead.

Example task:
```
- name: copy authorized_keys                                                                                           
  copy:                                                                                                                
    src: /etc/dropbear/authorized_keys                                                                                 
    remote_src: true                                                                
    dest: /root/.ssh/authorized_keys                                                                                   
    force: false # only copy when missing 
```

Failure:
```
TASK [openwrt-openssh : copy authorized_keys] *************************************************************************
fatal: [test_host]: FAILED! => {"changed": false, "dest": "/root/.ssh/authorized_keys", "md5sum": "46be6e2ba65d15efb16b1118f537f353", "msg": "file already exists", "src": "/etc/dropbear/authorized_keys"}
```

Success (patched):
```
TASK [openwrt-openssh : copy authorized_keys] *************************************************************************
ok: [test_host]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant