ansibles3cmd

How do I configure s3cmd from Ansible?


I have a playbook which clones a repo and executes a Python script, which uses s3cmd and os.popen() to run an s3cmd command.

However, it says s3cmd: command not found, even though I have installed s3cmd. Maybe it is because I have not configured them.

Error: "stderr": "sh: s3cmd: command not found",

So, how do I configure s3cmd inside the dynamically created EC2 instances.

[I already have an environment set for the AWS keys. Is there any way I can use them for this too?]


Solution

  • Try fully specifying the path to s3cmd (e.g., /usr/bin/s3cmd) everywhere.

    https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html the environment settings can be used on the playbook/play/task level.