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 s3_bucket module but I get 'Couldn't connect to AWS:
> Invalid endpoint:' when trying to point to my ECS instance.
>
> Does anyone have any knowledge on using Ansible to manage EMC ECS?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/51eee42b-c82e-4a6d-9ef2-5545264a3d34%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCY5SozmNuD1e3t_eR77fq1%3DLkTCkx5RR%2BP_53jSbWna%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[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) Example 
below.

- name: Provision EC2 Bastion server instances
  ec2:
region: "{{ aws_region }}"
keypair: "{{ key_name }}"
group_id:  "{{ bastion_sg.group_id }}"
instance_type: "{{ instance_type }}"
image: "{{ ami_id }}"
exact_count: 1
count_tag: 
  Name: bastion
instance_tags:
  Name: bastion
assign_public_ip: True
wait: yes
#vpc_subnet_id: "{{ item.id }}"
vpc_subnet_id: "{{ vpc.results[0].subnets |parse_subnets_by_tag('Tier', 
'public', return_count=False)|first }}"
  register: bastion
- debug: var=bastion

- name: Add bastion instances to host group
  add_host: name={{ item }} groups=bastion
  with_items:
- "{{ bastion|parse_results(key='public_ip') }}"

- name: update ssh config
  blockinfile:
dest: /home/foo/.ssh/config
block: |
  Host 10.111.*
 StrictHostKeyChecking  no
 ProxyCommand   ssh -i ~/.ssh/my_key.pem foo@10.10.10.10 -W 
%h:%p
 User   ansible
 IdentityFile   ~/.ssh/ansible



On Tuesday, December 20, 2016 at 3:35:55 PM UTC-8, colin byrne wrote:
>
> I asked this a while back and I did not find a good solution back then... 
> Hopefully something has changed!
>
> I am running Ansible outside of multiple VPCs, and have a set of configs 
> in my ~/.ssh/config that get picked up when using a static inventory file. 
>
> Is there a way to utilize that config when using a dynamic inventory file, 
> or specify proxy commands elsewhere, to enable connections though a bastion 
> to each of those VPC's?
>
> Thanks for any help!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e31357b9-7373-42d5-876b-bc25a65df1c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[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 at 1:39:21 PM UTC-7, Dan Rough wrote:
>
> Hi,
>
> I'd like to know how others are dealing with keeping their group_vars 
> files granular. Ours have become a little unwieldily and we're considering 
> approaches to breaking them apart.
>
> When we provision a server, we assign it to a number of groups. Among 
> those groups, each server is added to at least three groups. Firstly, we 
> add it to a group which defines its role, for example app_server. Another 
> group represents the location of the DC that the server is in, which might 
> be LON, for example. Thirdly, we also add it to a group which denotes 
> whether it is a production server or a test server, prod, for example. That 
> allows us to use ansible's patterns when we're configuring the server to do 
> something like this: - hosts: "prod::_server" or - hosts: 
> "prod::_server".
>
> We have a variables which need to be defined based on these three 
> variables, Environment, Region and Role. Our current thinking is to create 
> a group_vars file for each of the possible combinations, 
> prod_LON_app_server, for example. The affect of this decision will mean 
> that we're going to see an explosion in the number of groups a server is 
> added to, and the number of group_vars files we maintain.
>
> Before we take this route, can anyone tell me if we're missing a trick? Is 
> there a technique that we're missing?
>
> Thanks!
>
> Dan.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3b610f47-2e53-4196-8710-024fe7e3f01b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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.
>
> ​
>
> On Tue, Oct 25, 2016 at 9:21 PM, Bharath Kumar <bharath...@gmail.com>
> wrote:
>
>> Hello,
>>
>> Can any one help with the following error ?
>>
>> "msg": "Module alias error: internal error: required and default are
>> mutually exclusive for event_source"
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ansible-project+unsubscr...@googlegroups.com.
>> To post to this group, send email to ansible-project@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/ansible-project/58b40fbd-679d-4348-9ad4-2250407e6aa0%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/58b40fbd-679d-4348-9ad4-2250407e6aa0%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCYPnuSk-u3Y3ZZR%3DL2KxA98OBuZWPYB-QiTRW%3DCZg5xHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 and default are
> mutually exclusive for event_source"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/58b40fbd-679d-4348-9ad4-2250407e6aa0%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCYubAQZC%3DfVHN-3ytZB-8ZT7qTWvW4Mm7Vn4seG0u6Y4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 1, 2016 at 10:54 AM, ZillaYT  wrote:

> Having a lot of -name/when task blocks is just ugly infrastructure. I have
> to think of a better way. There's GOT to be a better way.
>
>
> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote:
>>
>> On 01. sep. 2016 18:02, ZillaYT wrote:
>> > I'm writing a role to configure syslog, and of course the service is
>> > different between Linux instances. How do I do this in var/main.yml?
>>
>> The directory must be vars not var.
>>
>>
>> > # pseudo-code in vars/main.yml
>> > if Redhat7.x
>> >   syslog_service: rsyslog
>> > else if RedHat6.x
>> >   syslog_service: syslog
>> > end
>>
>> It's not possible, vars/main.yml can only contain variable definitions,
>> not logic.
>>
>>
>> > So then I can just do this in tasks/main.yml
>> >
>> > - name: Ensure syslog is running
>> >   service: name="{{ syslog_service }}" state=running enabled=yes
>>
>> You must split it in two tasks.
>> ansible_os_family and ansible_lsb.major_release values is probably wrong
>> so you need to find the correct ones.
>>
>> - name: Ensure syslog is running on Redhat 6.x
>>service: name=syslog state=running enabled=yes
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>> "6"
>>
>> - name: Ensure syslog is running on Redhat 7.x
>>service: name=rsyslog state=running enabled=yes
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release ==
>> "7"
>>
>> --
>> Kai Stian Olstad
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/5b1c97fc-2e65-4c7d-a32c-911f1ddeedca%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCYnardwwVGVB%3DEzOQNJErJv-mNdV%2BRWoKFpbm%2BmR%3Dx6Ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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, September 1, 2016 at 10:54:25 AM UTC-7, ZillaYT wrote:
>
> Having a lot of -name/when task blocks is just ugly infrastructure. I have 
> to think of a better way. There's GOT to be a better way.
>
> On Thursday, September 1, 2016 at 1:45:02 PM UTC-4, Kai Stian Olstad wrote:
>>
>> On 01. sep. 2016 18:02, ZillaYT wrote: 
>> > I'm writing a role to configure syslog, and of course the service is 
>> > different between Linux instances. How do I do this in var/main.yml? 
>>
>> The directory must be vars not var. 
>>
>>
>> > # pseudo-code in vars/main.yml 
>> > if Redhat7.x 
>> >   syslog_service: rsyslog 
>> > else if RedHat6.x 
>> >   syslog_service: syslog 
>> > end 
>>
>> It's not possible, vars/main.yml can only contain variable definitions, 
>> not logic. 
>>
>>
>> > So then I can just do this in tasks/main.yml 
>> > 
>> > - name: Ensure syslog is running 
>> >   service: name="{{ syslog_service }}" state=running enabled=yes 
>>
>> You must split it in two tasks. 
>> ansible_os_family and ansible_lsb.major_release values is probably wrong 
>> so you need to find the correct ones. 
>>
>> - name: Ensure syslog is running on Redhat 6.x 
>>service: name=syslog state=running enabled=yes 
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>> "6" 
>>
>> - name: Ensure syslog is running on Redhat 7.x 
>>service: name=rsyslog state=running enabled=yes 
>>when: ansible_os_family == "RedHat" and ansible_lsb.major_release == 
>> "7" 
>>
>> -- 
>> Kai Stian Olstad 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e03d4afd-fbf1-4a66-af09-e01083bb451e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[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 the code before the PR is made 
https://github.com/linuxdynasty/ld-ansible-plugins/blob/master/action_plugins/include_vars_dir.py

I know some of this functionality is possible with using fileglob and 
include_vars. I needed something that I can control the depth of the 
directory as well.

- name: include all yml files in group_vars/all and all nested directories
  include_vars_dir:
dir: 'group_vars/all'

- name: include all yml files in group_vars/services
  include_vars_dir:
dir: 'group_vars/services'
depth: 1

- name: include only bastion.yml files
  include_vars_dir:
dir: 'vars'
files_matching: 'bastion.yml'

- name: include only all yml files exception bastion.yml
  include_vars_dir:
dir: 'vars'
ignore_files: 'bastion.yml'



 that instead of using include_vars with fileglob. 

On Thursday, August 18, 2016 at 9:41:27 AM UTC-7, Vincent Jørgensen wrote:
>
> Hi all, I have an ansible project with a groups_vars directory, with a 
> subdirectory called all beneath it, like so:
> /project/group_vars/all/ami.yml
> /project/group_vars/all/dns.yml
> /project/group_vars/all/key.yml
>
> Previously, I didn't have to specify in my playbook the path to each 
> variable file (amis dns and keys change often enough that it's handy to 
> keep them separate). But since moving to 2.1.1.0, ansible can't find the 
> files under all, so I've had to resort to this:
> - hosts:  localhost
>   ...
>   vars_files:
> - "{{ base_dir }}/group_vars/all/dns.yml"
> - "{{ base_dir }}/group_vars/all/ami.yml"
> - "{{ base_dir }}/group_vars/all/key.yml"
>   tasks:
>   - ...
>
>
> Did this feature go away?  It isn't the end of the world, but I liked that 
> feature, that all could be directory or a file. Thanks. \V
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ce223a5e-8d1d-4354-ba78-06440f5259e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 Monday, August 1, 2016 at 11:58:49 AM UTC-4, tom.m...@atlanticbt.com
> wrote:
>>
>> I'm not sure if I'm overlooking this or not, but is there a module from
>> Ansible that will describe the availability zones in my AWS region?
>>
>> I typically use us-east-1 as my default region, which has 5 available
>> availability zones (A,B, C, D, E), out of which I can only use 4.  I never
>> know which ones are available to me when I stand up my VPC and create my
>> subnets.
>>
>> So my desire is to simply describe availability zones with an ansible
>> module, and NOT pass the aws cli ec2 describe-availability-zones through
>> with a `command` in my role.
>>
>> Thank you.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/be8a49de-c36c-4f17-8025-e168db23b433%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCbUc3JgJOL%2Br2zpyz1uZt%3Dm%2BKjw0Lu7vKT7TOQEWMVW-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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,  wrote:

> I'm not sure if I'm overlooking this or not, but is there a module from
> Ansible that will describe the availability zones in my AWS region?
>
> I typically use us-east-1 as my default region, which has 5 available
> availability zones (A,B, C, D, E), out of which I can only use 4.  I never
> know which ones are available to me when I stand up my VPC and create my
> subnets.
>
> So my desire is to simply describe availability zones with an ansible
> module, and NOT pass the aws cli ec2 describe-availability-zones through
> with a `command` in my role.
>
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/03da1b58-e9bd-40ea-959f-1c58bc5d635a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAH2deCa2fhFYSeRK55DvJ2gy3WJDNAMHj0k3ODPTFYvCa4dPpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[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 account_id
except Exception:
raise errors.AnsibleFilterError(
"Failed to retrieve account id"
)



https://github.com/linuxdynasty/ld-ansible-filters/blob/master/filter_plugins/aws.py#L8

On Tuesday, May 17, 2016 at 8:16:26 PM UTC-7, Erick Barros wrote:
>
> Hi guys,
>
> does anyone have a good option to get the my aws account id using Ansible ?
>
> Thanks !
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e5d91ca1-80bf-4652-aecd-8ea0feb77d9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[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
delay: 15
timeout: 320
state: started

- name: Wait until the ansible user can log into the host.
  local_action: command ssh -oStrictHostKeyChecking=no ansible@{{ ec2_ip }} exit
  register: ssh_output
  until: ssh_output.rc == 0
  retries: 20
  delay: 10




On Monday, May 9, 2016 at 1:05:11 PM UTC-7, Jared Bristow wrote:
>
> I am having this same issue.  Did you ever figure out a solution?
>
> I have 3 different images I'm testing against: CentOS6, CentOS7, Sles12. 
> The strange thing is that I only seem to have a problem on CentOS7.  
>
> On Monday, January 25, 2016 at 2:07:14 PM UTC-7, James Cuzella wrote:
>>
>> Hello,
>>
>> I believe I've found an interesting race condition during EC2 instance 
>> creation due to a slow-running cloud-init process.  The issue is that 
>> cloud-init appears to create the initial login user & installs the public 
>> SSH key onto a newly started EC2 instance, then restarts sshd.  It takes a 
>> while to do this, and creates a race condition where Ansible cannot connect 
>> to the host and fails the playbook run.  In my playbook, I'm using the ec2 
>> module, followed by add_host, and then wait_for to wait for the SSH port to 
>> be open.  I have also experimented with using a simple "shell: echo 
>> host_is_up" command with a retry / do-until loop.  However this also fails 
>> because Ansible wants the initial SSH connection to be successful, which it 
>> will not in this case.  So Ansible does not retry :-(
>>
>> It appears that due to the user not existing until ~3 minutes after it is 
>> booted and sshd is listening on port 22, Ansible cannot connect as the 
>> initial login user for the CentOS AMI ("centos").  So the SSH port open 
>> check is not good enough to detect and wait for the port to be open AND the 
>> login user to exist.  The simple echo shell command with retry do/until 
>> loop also does not work, because the very first SSH connection Ansible 
>> tries to make to run the module fails also.
>>
>> For some detailed debug info, and a playbook to reproduce the issue, 
>> please see this Gist:  
>> https://gist.github.com/trinitronx/afd894c89384d413597b
>>
>> My question is:   Has anyone run into a similar issue with EC2 instances 
>> being slow to become available causing Ansible to fail to connect, and also 
>> found a solution to this?
>>
>> I realize that a sleep task is one possible solution (and I may be forced 
>> to reach for that sledgehammer), but it doesn't feel like the absolute best 
>> solution because we really want to wait for both cloud-init to be finished 
>> creating "centos" user on the instance AND SSH to be up.  So really, the 
>> only other way I can think of is to somehow tell SSH to retry connecting as 
>> centos until it succeeds or a surpasses a very long timeout.  Is this 
>> possible?  Are there better ways of handling this?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/99e8d84a-7856-436a-bb31-10807317f47f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 Greenberg wrote:
>
> thanks 
> this doc is nice ( but poorly ) as i expect for some good doc this is why 
> i ask 
> if you will look let say "boto3" doc you have all the function and output 
> etc ... 
> i ask if ansible have something like this ?  
>
> and if not i try to just run playbook from my pythonk script and wonder if 
> there and how-to ? 
>
> Thanks 
>
> On Saturday, May 7, 2016 at 5:39:27 PM UTC+3, Matt Martz wrote:
>>
>> http://docs.ansible.com/ansible/developing_api.html
>>
>> On Saturday, May 7, 2016, Noam Greenberg  wrote:
>>
>>> Hi all 
>>>
>>> i wander if any one have a link or book about the Ansible 2.0 API 
>>> (python ) 
>>> function , param etc ... something   
>>> i try to run a playbook from python and i dont find any doc that explain 
>>> how to or witch function to use 
>>>
>>> Thanks In advance 
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible-project+unsubscr...@googlegroups.com.
>>> To post to this group, send email to ansible-project@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/9300d762-b41c-494b-b242-a9654785d46d%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> Matt Martz
>> @sivel
>> sivel.net
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a93fa9b2-e3f0-406e-9318-ce54fc5c56c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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 wrote:
>
> thanks 
> this doc is nice ( but poorly ) as i expect for some good doc this is why 
> i ask 
> if you will look let say "boto3" doc you have all the function and output 
> etc ... 
> i ask if ansible have something like this ?  
>
> and if not i try to just run playbook from my pythonk script and wonder if 
> there and how-to ? 
>
> Thanks 
>
> On Saturday, May 7, 2016 at 5:39:27 PM UTC+3, Matt Martz wrote:
>>
>> http://docs.ansible.com/ansible/developing_api.html
>>
>> On Saturday, May 7, 2016, Noam Greenberg  wrote:
>>
>>> Hi all 
>>>
>>> i wander if any one have a link or book about the Ansible 2.0 API 
>>> (python ) 
>>> function , param etc ... something   
>>> i try to run a playbook from python and i dont find any doc that explain 
>>> how to or witch function to use 
>>>
>>> Thanks In advance 
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to ansible-project+unsubscr...@googlegroups.com.
>>> To post to this group, send email to ansible-project@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/9300d762-b41c-494b-b242-a9654785d46d%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> Matt Martz
>> @sivel
>> sivel.net
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/de25b0f4-052e-449e-ab6f-c4109a4f73b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.