Answers: <p>After struggling for a time I solved the problem by changing the image in the ci from Ubuntu to ansible-runner.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-12-22T01:04:12.023Z
Answers: 2020-12-22T01:04:12.023Z
Answers: Joao  Vitorino
Body: <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>
  
Comments: CC BY-SA 4.0
Comments: 2020-12-18T02:48:33.633Z
Comments: Try `command: which systemctl` and `command: hostname`
Comments: Vladimir Botka
Comments: CC BY-SA 4.0
Comments: 2020-12-18T13:21:29.067Z
Comments: Same error `{"changed": false, "cmd": "wich systemctl", "msg": "[Errno 2] No such file or directory", "rc": 2}`
Comments: Joao  Vitorino
Tags: <ansible><amazon-ec2><linux>
Title: Ansible No such file or directory error message for any executable in Amazon Linux AMI
UserDisplayName: Joao  Vitorino
ThreadText: # 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.
  
  
  ---
  
  