[ansible-project] Re: Getting aws account id

2016-05-17 Thread Allen Sanabria
You can use a Ansible Filter Plugin. I have a repo with all of my filter plugins. Line 8 has the function you need. def get_account_id(region): client = boto3.client('iam', region_name=region) try: account_id = client.list_users()['Users'][0]['Arn'].split(':')[4] return

Re: [ansible-project] API 2.0

2016-05-09 Thread Allen Sanabria
Noam, I have a repo where I am using the api to run my playbooks. You can look at this one as an example.. test_kinesis_stream.py On Saturday, May 7, 2016 at 7:54:31 AM UTC-7, Noam Greenberg

Re: [ansible-project] API 2.0

2016-05-09 Thread Allen Sanabria
I have a repo where I include tests for one of my modules that uses the 2.0 API. This is not documentation, but you can use it as an example. https://github.com/linuxdynasty/ld-ansible-modules/blob/master/test/cloud/amazon/test_kinesis_stream.py On Saturday, May 7, 2016 at 7:54:31 AM UTC-7, Noam

[ansible-project] Re: EC2 slow cloud-init, Ansible SSH connection fails due to race condition (wait_for is not good enough)

2016-05-09 Thread Allen Sanabria
This is what I do, to make sure that SSH comes up, but also wait until the user has been created on my instance. - set_fact: ec2_ip: "{{ ec2_name | get_instance(aws_region, state='running') }}" - name: Wait for SSH to come up on instance wait_for: host: "{{ ec2_ip }}" port: 22

Re: [ansible-project] Module for describing availability zones?

2016-08-01 Thread Allen Sanabria
You can write a module or a simple filter that will give you the availability zones in a region. https://github.com/linuxdynasty/ld-ansible-filters/blob/master/filter_plugins/aws.py#L202 So you can do something like this *zones: "{{ aws_region | zones() }}"* ​ On Mon, Aug 1, 2016 at 8:52 AM,

Re: [ansible-project] Re: Module for describing availability zones?

2016-08-02 Thread Allen Sanabria
A filter as I showed you above would be simpler, than a module imo. On Tue, Aug 2, 2016 at 7:47 AM, wrote: > Thanks Allen! > > I was trying to avoid creating anything custom, but it looks like a custom > module needs to be made. > > > Thank you so much. > > On

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend. For instance in tasks you can say.. ```yaml - include_vars: RedHat6.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6" - include_vars: RedHat7.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7" ``` On Thu, Sep

Re: [ansible-project] How to set a variable in vars/main.yml conditionally?

2016-09-01 Thread Allen Sanabria
include_vars is your friend. For instance in tasks/main.yml you can say.. - include_vars: RedHat6.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "6" - include_vars: RedHat7.yml when: ansible_os_family == "RedHat" and ansible_lsb.major_release == "7" On Thursday,

[ansible-project] Re: group_vars behavior changed in 2.1?

2016-08-22 Thread Allen Sanabria
I ran into this issue as well. I decided to write an action plugin called include_vars_dir. This will sort the files in alphabetical order and include them. This also works in a role as well. I am in the process of writing a test suite, before making the PR. If you are interested in checking

Re: [ansible-project] Facing Problem while creating Kinesis event source mapping for Lambda

2016-10-26 Thread Allen Sanabria
My apologies, you meant a completely different module. Disregard my last comment. On Wed, Oct 26, 2016 at 9:34 AM, Allen Sanabria <asanab...@linuxdynasty.org> wrote: > Can you show the entire module as you are using it please? This is an > example on how I am using it. > > ​

Re: [ansible-project] Facing Problem while creating Kinesis event source mapping for Lambda

2016-10-26 Thread Allen Sanabria
Can you show the entire module as you are using it please? This is an example on how I am using it. ​ On Tue, Oct 25, 2016 at 9:21 PM, Bharath Kumar wrote: > Hello, > > Can any one help with the following error ? > > "msg": "Module alias error: internal error: required

[ansible-project] Re: group_vars and ansible's patterns - suggestions please!

2016-10-26 Thread Allen Sanabria
I use to use group_vars/. Instead I use vars/ now. Since include_vars plugin now supports directories and you can limit the depth of the include. Here is an example on how I manage vars/ today https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks On Wednesday, October 26, 2016

[ansible-project] Re: Dynamic Inventory to private VPC instances

2016-12-21 Thread Allen Sanabria
If you are dynamically building new VPC's and you want your ssh config file to be updated dynamically. I would have a role that deploys the bastion host in the new VPC and right before the role exits, it should update your ~/.ssh/config file. (Not sure if this is what you are looking for)

Re: [ansible-project] s3_ modules for DELL EMC ECS

2018-09-18 Thread Allen Sanabria
Have you tried passing the *s3_url*: On Tue, Sep 18, 2018 at 9:51 AM, Martyn Kempster wrote: > Is it possible to use any of the s3_ and ecs_ modules for EMC ECS? ECS > uses the standard s3 API and has the same parameters such as AWS Secret > Keys and Access Keys. > > I've tried using the