I have a problem with the ansible copy module.
We have a ansible-repository which I checked out on machine “A” and I have a second machine where I want to install jenkins, “B”. So I start ansible-playbook like this on machine “A”:
ansible-playbook -i integration jenkinsservers.yml --ask-pass -s
In my jenkins role I defined a task which should copy an private and a public key from machine “A” into the .ssh directory of the application-user on machine “B”:
-
name: create ssh directory for user ${app_name}
file: path=/home/${app_name}/.ssh owner=${app_name} group=${app_name} state=directory -
name: copy ${app_name} private key into place
file: src=id_rsa dest=/home/${app_name}/.ssh/id_rsa owner=${app_name} group=${app_name} mode=600 -
name: copy ${app_name} public key into place
file: src=id_rsa.pub dest=/home/${app_name}/.ssh/id_rsa.pub owner=${app_name} group=${app_name} mode=640
But when I run this, I get the following error:
TASK: [copy jenkins public key into place] ************************************
failed: [v00684.sbb.ch] => {“failed”: true, “item”: “”, “path”: “/home/jenkins/.ssh/id_rsa.pub”, “state”: “absent”}
msg: file (/home/jenkins/.ssh/id_rsa.pub) does not exist, use copy or template module to create
FATAL: all hosts have already failed – aborting
On the machine “B” I can see the directory, but no content.
PS: Ansible Version 1.3.3.
What I am doing wrong?