# copy module with destination link count \> 1

**URL:** <https://forum.ansible.com/t/copy-module-with-destination-link-count-1/15694>\
**Category:** Ansible Project\
**Created:** [July 17, 2014, 4:00pm UTC](https://forum.ansible.com/t/copy-module-with-destination-link-count-1/15694 "2014-07-17T16:00:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dustin\_C\_Hatch](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Dustin\_C\_Hatch](https://forum.ansible.com/u/Dustin_C_Hatch)\
**Post date:** [July 17, 2014, 4:00pm UTC](https://forum.ansible.com/t/copy-module-with-destination-link-count-1/15694/1 "2014-07-17T16:00:37Z")

</div>

I ran into something interesting today. I am using the `copy` module  
to copy a file from the management station to the managed host, and  
then the `file` module to create a hard link to that same file  
somewhere else. This works okay, on the first run, but subsequent runs  
error out on the `copy` task.

Playbook snippet:

- name: ensure koji server ca certificate is available  
&nbsp;&nbsp;copy: src=kojica.crt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dest=/etc/kojid/serverca.crt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mode=0644  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;owner=root  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;group=root  
- name: ensure koji client ca certificate is available  
&nbsp;&nbsp;file: path=/etc/kojid/clientca.crt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src=/etc/kojid/serverca.crt  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mode=0644  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;owner=root  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;group=root  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state=hard

On the first run, the file gets copied, and the link gets created. On  
the second pass, this error is raised:

TASK: [koji-builder | ensure koji server ca certificate is available] \*\*\*\*\*\*\*\*\*  
failed: [redacted] =\> {"failed": true, "gid": 0, "group": "root",  
"md5sum": "redacted", "mode": "0644", "owner": "root", "path":  
"/etc/kojid/serverca.crt", "size": 2252, "src": "kojica.crt", "state":  
"hard", "uid": 0}  
msg: src file does not exist, use "force=yes" if you really want to  
create the link: /etc/kojid/kojica.crt

I think a clue is in `"state": "hard"`...where's that coming from? Why  
would copy be trying to create a link?

Thoughts?

Dustin C. Hatch  
[http://dustin.hatch.name/](http://dustin.hatch.name/)
