<p>I am trying to get <a href="https://github.com/ansible/awx-operator" rel="nofollow noreferrer">https://github.com/ansible/awx-operator</a> to import inventories from my git repo and my inventory contains vault secrets so when I attempt to &quot;sync&quot; my AWX ansible inventory with my git repo the job fails with:</p>
<pre><code>ERROR! Attempting to decrypt but no vault secrets found
</code></pre>
<p>There is a workaround for this I am trying to implement.
The workaround is to execute these commands on the &quot;AWX&quot; nodes:</p>
<pre><code>echo &quot;XXXXXXXXX&quot; &gt; /tmp/vault_password
chmod 777 /tmp/vault_password
</code></pre>
<p>and then set extra vars to:</p>
<pre><code>---
ANSIBLE_VAULT_PASSWORD_FILE: /tmp/vault_password
</code></pre>
<p>awx-operator is an kubernetes deployment so I figured I could edit the pod definitions in the deployment to implement the above workaround, with <code>kubectl edit deployment -n awx awx-demo</code>.</p>
<p>I change this ...</p>
<pre><code>262       initContainers:
263       - command:
264         - /bin/sh
265         - -c
266         - |
267           hostname=$MY_POD_NAME
268           receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
269           receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/receptor.crt verify=yes
</code></pre>
<p>... to this ...</p>
<pre><code>262       initContainers:
263       - command:
264         - /bin/sh
265         - -c
266         - |
267           echo &quot;XXXXXXXXX&quot; &gt; /tmp/vault_password
268           chmod 777 /tmp/vault_password
269           hostname=$MY_POD_NAME
270           receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
271           receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls
</code></pre>
<p>But a pod is dying and the deployment reverts back to what I had before I edited it.
I cannot figure out how to see what is the cause of the CrashLoop.</p>
<p>Update:</p>
<p>I managed to grab the error by running <code>kubectl describe awx-demo</code> at just the right moment.  And I see:</p>
<pre><code>Init Containers:
  init:
    Container ID:  containerd://075110d13705a335850818ca49ba33eec94f4a1db06dfd9ff5b224ee8fd15480
    Image:         quay.io/ansible/awx-ee:latest
    Image ID:      quay.io/ansible/awx-ee@sha256:546c728608e57cb0903e10f4a530e6ff1cd8d94ee9e9bcb7db64f96ede6d0180
    Port:          &lt;none&gt;
    Host Port:     &lt;none&gt;
    Command:
      /bin/echo &quot;XXXXXXX&quot; &gt; /tmp/vault_password
      /bin/chmod 777 /tmp/vault_password
      /bin/sh
      -c
      hostname=$MY_POD_NAME
      receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
      receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/receptor.crt verify=yes

    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       StartError
      Message:      failed to create containerd task: failed to 
create shim task: OCI runtime create failed: runc create failed: 
unable to start container process: exec: &quot;/bin/echo \&quot;XXXXXXXX\&quot; &gt; 
/tmp/vault_password&quot;: stat /bin/echo &quot;XXXXXXXX&quot; &gt; 
/tmp/vault_password: no such file or directory: unknown

</code></pre>

Red Cricket
<p>As there could be only one process as an entry point, you can have only one command(Eg: <code>bash</code>). Try breaking your command with command and args and pass all the commands as commands as args to bash.</p>
<pre><code>- command: [&quot;/bin/bash&quot;,&quot;-c&quot;] 
  args: [&quot;/bin/echo 'XXXXXXX' &gt; /tmp/vault_password &amp;&amp; /bin/chmod 777 /tmp/vault_password&quot;]
</code></pre>
