# help me - error: Filespec must match the canonical format: \[\[namespace/\]pod:\]file/path

**URL:** <https://forum.ansible.com/t/help-me-error-filespec-must-match-the-canonical-format-namespace-pod-file-path/30081>\
**Category:** Ansible Project\
**Tags:** kubernetes\
**Created:** [April 9, 2019, 2:42am UTC](https://forum.ansible.com/t/help-me-error-filespec-must-match-the-canonical-format-namespace-pod-file-path/30081 "2019-04-09T02:42:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Balaji1](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@Balaji1](https://forum.ansible.com/u/Balaji1)\
**Post date:** [April 9, 2019, 2:42am UTC](https://forum.ansible.com/t/help-me-error-filespec-must-match-the-canonical-format-namespace-pod-file-path/30081/1 "2019-04-09T02:42:27Z")

</div>

Hello All,

Need your help on below issue.

I am trying to run kubernetes command on a remote host using ansible.

This command works when directly run on a remote host.

======\> kubectl cp /etc/passwd bus-service/ssh-jumphost-6954f877bf-p5fmq:/etc/passwd\_test

But when using ansible

- name: Copy commands  
shell: “kubectl cp {{ item }} baas-service/{{ jumphost.stdout\_lines }}:{{ item }}”  
with\_items:
- { ‘/etc/master.passwd’ }
- { ‘/etc/passwd’ }
- { ‘/etc/group’ }

I get an error.

failed: [gngqnc014c] (item={u’/etc/master.passwd’: None}) =\> {  
“changed”: true,  
“cmd”: “kubectl cp {u’/etc/master.passwd’: None}bus-service/[u’ssh-jumphost-6954f877bf-p5fmq’, u’ssh-jumphost-6954f877bf-twg7j’, u’ssh-jumphost-6954f877bf-xrmhs’]:{u’/etc/master.passwd’: None}”,  
“delta”: “0:00:00.070410”,  
“end”: “2019-04-08 16:04:49.551694”,  
“invocation”: {  
“module\_args”: {  
“\_raw\_params”: “kubectl cp {u’/etc/master.passwd’: None}bus-service/[u’ssh-jumphost-6954f877bf-p5fmq’, u’ssh-jumphost-6954f877bf-twg7j’, u’ssh-jumphost-6954f877bf-xrmhs’]:{u’/etc/master.passwd’: None}”,  
“\_uses\_shell”: true,  
“argv”: null,  
“chdir”: null,  
“creates”: null,  
“executable”: null,  
“removes”: null,  
“stdin”: null,  
“warn”: true  
}  
},  
“item”: {  
“/etc/master.passwd”: null  
},  
“msg”: “non-zero return code”,  
“rc”: 1,  
“start”: “2019-04-08 16:04:49.481284”,  
“stderr”: “error: Filespec must match the canonical format: [[namespace/]pod:]file/path”,  
“stderr\_lines”: [  
“error: Filespec must match the canonical format: [[namespace/]pod:]file/path”  
],  
“stdout”: “”,  
“stdout\_lines”:   
}

Can anyone help me on this issue?

Thanks

---

<div class="post-metadata">

**Author:** ![vinod93pop](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@vinod93pop](https://forum.ansible.com/u/vinod93pop)\
**Post date:** [April 10, 2019, 5:31am UTC](https://forum.ansible.com/t/help-me-error-filespec-must-match-the-canonical-format-namespace-pod-file-path/30081/2 "2019-04-10T05:31:18Z")

</div>

> Hello All,
> 
> Need your help on below issue.
> 
> I am trying to run kubernetes command on a remote host using ansible.
> 
> This command works when directly run on a remote host.
> 
> ======\> kubectl cp /etc/passwd bus-service/ssh-jumphost-6954f877bf-p5fmq:/etc/passwd\_test
> 
> But when using ansible
> 
> - name: Copy commands  
> shell: “kubectl cp {{ item }} baas-service/{{ jumphost.stdout\_lines }}:{{ item }}”  
> with\_items:
> - { ‘/etc/master.passwd’ }
> - { ‘/etc/passwd’ }
> - { ‘/etc/group’ }
> 
> I get an error.
> 
> failed: [gngqnc014c] (item={u’/etc/master.passwd’: None}) =\> {  
> “changed”: true,

Here you have to take a look , it’s not seems sane which you directly rub in command line.  
You have to use

kubectl cp {{ item }} baas-service/{{ jumphost.stdout\_lines }}:{{ item }}\_test”
