Reputation: 193
I was using the follwoing command to import the inventory from aws and it worked well:
ansible-inventory -i /etc/ansible/inventory/ec2.py --list -y > $some_dic
now, I want to use specific aws credentials so I modified the command as follwoing:
/etc/ansible/inventory/ec2.py --list --profile my-profile
which works fine.
However, when I put it all togeather it doesn't work
ansible-inventory -i /etc/ansible/inventory/ec2.py --list --profile my-profile -y > $some_dic
error:
ansible-inventory: error: unrecognized arguments: --profile
any ideas on this issue?
Upvotes: 0
Views: 241
Reputation: 3037
ansible-inventory
command tries to parse all the options including --profile
which it doesn't have.
/etc/ansible/inventory/ec2.py --list --profile my-profile
executes ec2.py
with --profile
option but when the same ec2.py
is passed to ansible-inventory
using -i
option that file itself becomes a parameter for ansible-inventory
command.
Though, haven't tried myself, you can try setting AWS_PROFILE
and then execute the command similar to what described here.
Also have a look at the documentation for available options of ansible-inventory.
Upvotes: 1