Fix: Ansible error with "KeyError: 'fileCopyRequest"


Recently I have worked with a customer who ran into an issue with executing an Ansible playbook on a Morpheus instance via the Morpheus Agent Command Bus. I have created this post to document the fix in the hope that it can help future users who may run into this error.

The full error received when executing the Ansible playbook is:

<span class="ansi-red-fg">  File "/var/opt/morpheus/morpheus-local/workspace/ansible-int-33/plugins-57b953a9-027e-4eea-a148-291945831b4d/", line 195, in put_file</span>
<span class="ansi-red-fg">    request_id = response_data['fileCopyRequest']['uniqueId']</span>
<span class="ansi-red-fg">KeyError: 'fileCopyRequest'</span>
<span class="ansi-red-fg">fatal: [testvm.localdomain]: FAILED! =&gt; </span>
<span class="ansi-red-fg">  msg: Unexpected failure during module execution.</span>
<span class="ansi-red-fg">  stdout: ''</span>

The fix is to ensure that there is sufficient disk space within /var/opt/morpheus/morpheus-ui and that /var/opt/morpheus/morpheus-ui/deploy_uploads has the deployments directory with the correct permissions. The permissions should look like this:

[root@chrisappliance ctaylor]# ls -lta /var/opt/morpheus/morpheus-ui/deploy_uploads
total 0
drwxr-x--x. 13 morpheus-app morpheus-local 191 May 15 14:43 ..
drwxr-x---   3 morpheus-app morpheus-app    32 Mar 16 18:00 deployments
drwxr-x---.  3 morpheus-app morpheus-app    25 Apr 17  2020 .

This space is used for temporary file copy executions that Ansible uses to operate via the command bus.

A morpheus-ctl reconfigure should create the deployments folder if it does not exist already.

I hope this helps!



Will the reconfigure also fix permissions for the deployments directory?