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

9 views
Skip to first unread message

Maged Motawea

unread,
Jun 11, 2019, 4:55:56 PM6/11/19
to Ansible Development
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'

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.
Reply all
Reply to author
Forward
0 new messages