/bin/sh: aws: command not found on AWX

457 views
Skip to first unread message

MySQL tute's

unread,
May 27, 2021, 8:14:06 AM5/27/21
to AWX Project
Hi Team,

i have a playbook that copy s3 files from one bucket t o another bucket. the playbook is working fine from command promt. 

but not from awx, its showing "/bin/sh: aws: command not found"

below is my code.
  tasks:
    - name: V3.8 - Copy files from Ohio Dev to Oregon Dev
      shell: aws s3 cp s3://{{ ohio_source_bucket }} s3://{{ oregon_dest_bucket }} --recursive --acl bucket-owner-full-control

could you please help me wit this.

Patrick Dreher

unread,
May 27, 2021, 8:37:00 AM5/27/21
to AWX Project
Hi,

well, the issue is exactly what is displayed.
Wherever your AWX is running - it doesn't have the aws cli installed.
I assume your playbook successfully runs on localhost or some other host where aws cli is installed.
If your AWX is running in a container it won't have the aws cli.

One way to do this would be to have a host somewhere with aws cli installed that your playbook uses to execute the command.

MySQL tute's

unread,
May 27, 2021, 9:30:48 AM5/27/21
to AWX Project

HI,

So, can i install the aws cli on awx container, if yes, which container should i use to install the aws cli.

awx_task or awx_web.

Patrick Dreher

unread,
May 27, 2021, 9:36:33 AM5/27/21
to AWX Project
awx_task
wouldn't recommend doing it the way you laid it out.

MySQL tute's

unread,
May 27, 2021, 9:46:13 AM5/27/21
to AWX Project

Hi Patrick,

really thank you so much for helping me.

i have a host that installed with aws cli. and ip is lets say 1.2.1.2(example)

but in playbook in the host section how can i provide that IP.

could you please help. on which file we should add that ip and provide alias name to it ?

MySQL tute's

unread,
May 27, 2021, 12:06:34 PM5/27/21
to AWX Project
Hi,

could you please help me on this.

Patrick Dreher

unread,
May 28, 2021, 7:24:30 AM5/28/21
to AWX Project
Hi,

you can just create a simple inventory.

[aws]
hostname ansible_host=1.2.1.2


If you have this in the repository that you sync with AWX you can simply add the inventory file as a inventory source. (create inventory > add inventory source)

Then you run your play on the 'aws' host group.

hope this helps.
Reply all
Reply to author
Forward
0 new messages