<p>After struggling for a time I solved the problem by changing the image in the ci from Ubuntu to ansible-runner.</p>

CC BY-SA 4.0
2020-12-22T01:04:12.023Z
2020-12-22T01:04:12.023Z
Joao  Vitorino
<p>I'm trying to run this command in a Amazon Linux AMI instance</p>
<pre><code>  - name: Run docker
    shell: systemctl enable docker &amp;&amp; systemctl start docker 
</code></pre>
<p>And receiving this error message</p>
<pre><code>&quot;stderr&quot;: &quot;/bin/sh: systemctl: No such file or directory&quot;
</code></pre>
<p>I already tried with <code>command</code>, ansible systemd module and <code>/usr/bin/systemctl</code>.</p>

CC BY-SA 4.0
2020-12-18T02:48:33.633Z
Try `command: which systemctl` and `command: hostname`
Vladimir Botka
CC BY-SA 4.0
2020-12-18T13:21:29.067Z
Same error `{"changed": false, "cmd": "wich systemctl", "msg": "[Errno 2] No such file or directory", "rc": 2}`
Joao  Vitorino
<ansible><amazon-ec2><linux>
Ansible No such file or directory error message for any executable in Amazon Linux AMI
Joao  Vitorino
# Ansible No such file or directory error message for any executable in Amazon Linux AMI

(Asked by: username_0 on 2020-12-18)

I'm trying to run this command in a Amazon Linux AMI instance
  - name: Run docker
    shell: systemctl enable docker && systemctl start docker 

And receiving this error message
"stderr": "/bin/sh: systemctl: No such file or directory"

I already tried with command, ansible systemd module and /usr/bin/systemctl.

**Tags:** ansible, amazon-ec2, linux

> **Comments:**
> **username_1**: Try `command: which systemctl` and `command: hostname`  
> **username_0**: Same error `{"changed": false, "cmd": "wich systemctl", "msg": "[Errno 2] No such file or directory", "rc": 2}`  

---

## 1 answers

### Answer by username_0 on 2020-12-22. Score: 1 | Accepted answer

After struggling for a time I solved the problem by changing the image in the ci from Ubuntu to ansible-runner.


---

