badpacketsllc/ansible-aws_cli

Are profiles optional, or not?

Closed this issue · 2 comments

...
    - name: Set up aws-cli
      import_role:
        name: badpacketsllc.aws_cli
      vars:
        profile:
...

Results in:

fatal: [3.25.60.xxx]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'profiles' is undefined"}

In my case I want the AWS CLI tool installed, but I don't want to populate the credentials.

Hm, yes, that appears to be a bug.

The current version will almost do what you want (it will populate .~/aws/config and ~/.aws/credentials with empty files) with:

---
- hosts: all

  tasks:
    - name: Set up aws-cli
      import_role:
        name: badpacketsllc.aws_cli
      vars:
        profiles:
          -

This is quite ugly and makes profiles (note that it's always plural) a required variable, which README.md indicates it is not.

I think the best solution would be: to allow profiles to actually be empty and add a variable like state (present by default) to give the user the option to install or uninstall the package.

Sorry for being to late to respond! I've been away from GitHub for a bit and missed this notification.

@nigels-com: if you have time, please take a look at #16 and let me know what you think. The relevant fix is in this block of code. Installing using ansible-galaxy install git+https://github.com/badpacketsllc/ansible-aws_cli.git,fdf63d67564f26c93ee7b72ac784f74cb530063c and running your playbook might be the easiest way to test if you don't feel like pulling down the repository and running all the tests locally.