# error executing cmd usnig shell module in Python API | "Unexpected failure during module execution."

**URL:** <https://forum.ansible.com/t/error-executing-cmd-usnig-shell-module-in-python-api-unexpected-failure-during-module-execution/30537>\
**Category:** Ansible Developer\
**Tags:** kubernetes\
**Created:** [June 11, 2019, 8:55pm UTC](https://forum.ansible.com/t/error-executing-cmd-usnig-shell-module-in-python-api-unexpected-failure-during-module-execution/30537 "2019-06-11T20:55:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maged\_Motawea](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Maged\_Motawea](https://forum.ansible.com/u/Maged_Motawea)\
**Post date:** [June 11, 2019, 8:55pm UTC](https://forum.ansible.com/t/error-executing-cmd-usnig-shell-module-in-python-api-unexpected-failure-during-module-execution/30537/1 "2019-06-11T20:55:56Z")

</div>

Hello,  
I’m using Python API to deploy a Kubernetes cluster but I have an issue executing two commands using the shell module.  
this is the first task’s dictionary:

> {  
> ‘name’: ‘install flannel for pod network’,  
> ‘action’: {  
> ‘module’: ‘shell’,  
> ‘args’: ‘kubectl apply -f {{ flannel\_url }}’  
> },  
> ‘become’: ‘yes’,  
> ‘become\_user’: ‘kubeuser’  
> }

where ‘flannel\_url’: ‘[https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml](https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml)’

and the second task:

> {  
> ‘name’: ‘join\_cluster’,  
> ‘action’: {  
> ‘module’: ‘shell’,  
> ‘args’: ‘{{ join\_command }}’  
> },  
> ‘become’: ‘yes’  
> }

where ‘join\_command’: 'kubeadm join 10.10.10.10:6443 --token ng0q9f.6qc6w82civ7o0m4l --discovery-token-ca-cert-hash sha256:b6cd3a4509f61f95cc6b1ecaee5977d638d0cc7b319a863456ebb22266b9d1d9 ’

I always get the following error message:

> An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: expected string or bytes-like object fatal: [10.10.10.10]: FAILED! =\> {“msg”: “Unexpected failure during module execution.”, “stdout”: “”}

I’ve tried setting the logl evel to DEBUG but there was no other information on these tasks.
