[ansible-project] Getting vars using AWS dynamic inventory plugin

2018-08-01 Thread Rob White
I want to set some static vars alongside my AWS inventory plugin config but 
I can't find any doc.  Maybe this isn't supported or maybe my syntax is 
incorrect.

plugin: aws_ec2
iam_role_arn: arn:aws:iam::1234567890:role/assumed-ansible
regions:
  - ap-southeast-1
hostnames:
  - ip-address
strict_permissions: False
strict: False
keyed_groups:
  - prefix: tag
key: tags

all:
  vars:
aws_account_name: myaccount

With a simple playbook to just output aws_account_name it always fails 
with...

'aws_account_name' is undefined

I've also tried the AWS group name like

aws_ec2:
  vars:
aws_account_name: myaccount

but that doesn't work either

-- 
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/c91d920d-757b-4c2c-8b9e-77b8f31215bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Working around lookup plugin limitation with environment variables

2017-04-11 Thread Rob White
The problem is it is the ansible-playbook that is actually going off to get 
the STS creds using sts_assume_role module so until i run the play, i don't 
have the creds.

I guess I could invoke a playbook from within another playbook :|


On Tuesday, 11 April 2017 23:00:01 UTC+10, Brian Coca wrote:
>
> set them in the environment before executing Ansible 
>
> AWS_SECURITY_TOKEN=xxx ansible-playbook  
> -- 
> Brian Coca 
>

-- 
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/35fcf400-35b0-4a93-8a02-4a6f082ca3a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Working around lookup plugin limitation with environment variables

2017-04-10 Thread Rob White
Indeed, hence why it doesn't work.

Is there any other way to pass an environment variable to a lookup plugin?

The only thing I've come up with is a not very elegant:

lookup('pipe', '(export AWS_ACCESS_KEY_ID=' + assumed_role.sts_creds.access_key 
+ ' && export AWS_SECRET_ACCESS_KEY=' + assumed_role.sts_creds.secret_key + ' 
&& export AWS_SECURITY_TOKEN=' + assumed_role.sts_creds.session_token + ' 
&& credstash -r ' + aws_region + ' -t ' + env + '-credstash get 
rds_instance_mysql-1_username)')

This then fails when I am not using STS.

On Tuesday, 11 April 2017 03:07:54 UTC+10, Brian Coca wrote:
>
> The environment keyword ONLY affects remote task execution (invoked 
> inside connection), not the 'local' environment which is what lookups 
> run under. 
>
> -- 
> Brian Coca 
>

-- 
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/dbcc7538-7668-4075-8b50-90d614998792%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Working around lookup plugin limitation with environment variables

2017-04-10 Thread Rob White
Hi all,

I'm looking for any suggestions on how to work around the following issue:

I am trying to use a lookup plugin but it is ignoring my environment 
variables.

The lookup plugin I am trying to use is credstash and the environment 
variables are being set because I am using AWS STS to assume a role.

It looks a little like this:

---
- name: Get STS token
  hosts: "{{ hosts }}"
  connection: local
  tasks:
- name: Assume role for passed account
  sts_assume_role:
region: "{{ aws_region }}"
role_arn: "arn:aws:iam::{{ aws_account_id }}:role/ansible-is_assumed"
role_session_name: ansible_assumed_role
  register: assumed_role
  when: use_sts

- name: Set environment with AWS creds when available
  set_fact:
my_environment:
  AWS_ACCESS_KEY_ID: "{{ assumed_role.sts_creds.access_key }}"
  AWS_SECRET_ACCESS_KEY: "{{ assumed_role.sts_creds.secret_key }}"
  AWS_SECURITY_TOKEN: "{{ assumed_role.sts_creds.session_token }}"
  when: assumed_role.skipped is not defined

- name: Set environment blank when no AWS creds
  set_fact:
my_environment: {}
  when: assumed_role.skipped is defined

- name: Deploy infrastructure role
  hosts: "{{ hosts }}"
  connection: local
  roles:
- "{{ role_to_deploy }}"
  environment: "{{ my_environment }}"



Now in the role_to_deploy i have lots of tasks that work brilliantly 
calling out to AWS using the STS credentials supplied as intended.

Unfortunately, any lookup plugins do not work properly because they do not 
use the environment variables I have set.  They end up calling out to AWS 
using the default credentials rather than being overridden by the STS creds.

I don't think this is a bug but it is never the less annoying.

I'm hoping maybe one of the core team can think of a way I can get the 
lookup plugin to 'see' my STS environment variables I have set.

-- 
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/f75bcf4c-1543-41f0-a259-427dbe8f6265%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Error running module out of 'library' with Ansible 2.2.0 from epel

2017-01-23 Thread Rob White
I have installed Ansible 2.2.0 from epel on an Amazon Linux image.

I have created a 'library' directory in /etc/ansible and added my own 
custom module.  Actually the module is iam_role.py that has already been 
merged to Ansible but not yet available until 2.3.

When running my playbook i get the following error when it gets to the 
iam_role task:

 
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File 
"/usr/lib/python2.6/site-packages/ansible/executor/task_executor.py", line 
119, in run
res = self._execute()
  File 
"/usr/lib/python2.6/site-packages/ansible/executor/task_executor.py", line 
490, in _execute
result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.6/site-packages/ansible/plugins/action/normal.py", 
line 33, in run
results = merge_hash(results, self._execute_module(tmp=tmp, 
task_vars=task_vars))
  File 
"/usr/lib/python2.6/site-packages/ansible/plugins/action/__init__.py", line 
565, in _execute_module
(module_style, shebang, module_data, module_path) = 
self._configure_module(module_name=module_name, module_args=module_args, 
task_vars=task_vars)
  File 
"/usr/lib/python2.6/site-packages/ansible/plugins/action/__init__.py", line 
153, in _configure_module
task_vars=task_vars, 
module_compression=self._play_context.module_compression)
  File 
"/usr/lib/python2.6/site-packages/ansible/executor/module_common.py", line 
772, in modify_module
(module_data, module_style, shebang) = 
_find_snippet_imports(module_name, module_data, module_path, module_args, 
task_vars, module_compression)
  File 
"/usr/lib/python2.6/site-packages/ansible/executor/module_common.py", line 
640, in _find_snippet_imports
recursive_finder(module_name, module_data, py_module_names, 
py_module_cache, zf)
  File 
"/usr/lib/python2.6/site-packages/ansible/executor/module_common.py", line 
441, in recursive_finder
tree = ast.parse(data)
  File "/usr/lib64/python2.6/ast.py", line 37, in parse
return compile(expr, filename, mode, PyCF_ONLY_AST)
  File "", line 16

   ^
SyntaxError: invalid syntax

fatal: [localhost]: FAILED! => {
"failed": true
}

MSG:

Unexpected failure during module execution.

I've noticed that my /usr/bin/ansible has a hash bang of 
/usr/bin/python2.6.  My python alternatives is pointing to 2.7.  I have 
tried changing to 2.6 to no avail.

I also think it's weird that in the stack trace above, everything is using 
/usr/lib right up until the end when ast.py is in /usr/lib64.  Maybe that's 
normal.

Any ideas on what the problem might be?

-- 
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/e162b0bf-a71a-42c2-bd08-b9608b784492%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible 2.0 parameter escaping problem

2016-01-20 Thread Rob White
After much base64 decoding of Powershell commands the following will work:

raw:

  C:\Temp\db_scripts\copy_db_file.ps1 "{{ system_db_default_location 
}}/master.mdf" "{{ system_db_master_mdf_location }}/master.mdf"

I removed the PowerShell call at the beginning, unquoted the script path 
and then removed the escaping slash \ before the quotation marks around the 
arguments.

Hopefully this will help somebody!



On Wednesday, 20 January 2016 17:39:45 UTC+11, Rob White wrote:
>
> I've starting seeing the following problem since I upgraded to Ansible v2.0
>
> Here's the task:
>
> raw:
>
>  PowerShell "C:\Temp\db_scripts\copy_db_file.ps1" \"{{ 
> system_db_default_location }}/master.mdf\" \"{{ 
> system_db_master_mdf_location }}/master.mdf\"
>
> It used to work fine in Ansible 1.9 but now I get a PowerShell error:
>
> "stderr": "The string is missing the terminator: \".\r\n+ 
> CategoryInfo  : ParserError: (:) [], ParentContainsErrorRecordEx 
> \r\n   ception\r\n+ FullyQualifiedErrorId : 
> TerminatorExpectedAtEndOfString\r\n \r\n"
>
>
>
> This is obviously something to do with the way Ansible has changed how it 
> handles escaped characters but I've tried a number of other different 
> options for escaping my task and i can't get it to work.
>
>
> I appreciate any suggestions.
>

-- 
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/ae01a30a-6bcd-4f5c-a739-21d31c3d27d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ec2 mudoles can't create ec2 instances

2016-01-20 Thread Rob White
Ansible gets its regions using the boto module regions call.  E.g. for ec2 
= http://boto.cloudhackers.com/en/latest/ref/ec2.html#boto.ec2.regions

Double check your boto version.

On Tuesday, 19 January 2016 00:26:17 UTC+11, lwq Adolph wrote:
>
> Hi, everyone:
>My base environment are below:
>
>- ubuntu 14.04 64bit 
>- ansible 1.9.4 
>- python 2.7.9 64bit 
>
> ​
>
> I am green hand to ansible.I study ansible documentation for ec2 
> module http://docs.ansible.com/ansible/ec2_module.html . I want to create 
> at least 100 ec2 instances on AWS. So I wrate a test yml file just for a 
> test,the content is bellow:
>
> ---
>   - name: deploy basic env
> hosts: 127.0.0.1
> connection: local
> gather_facts: False
>
> tasks:
>   - name: Provision a set of instances
> ec2:
>   aws_access_key: "xxx"
>   aws_secret_key: "xxx"
>   instance_type: t2.micro
>   image: ami-52d1183f
>   group: test
>   count_tag:
> Name: testenv
>   count: 3
>   wait: yes
>   vpc_subnet_id: subnet-2649d843
>   assign_public_ip: yes
>   region: cn-north-1
> register: ec2_test
>
>   - name: Add all instance public IPs to host group
> add_host: hostname={{ item.public_ip }} groups=ec2hosts
> with_items: ec2_test.instances
>
> ​
> I add 
>
> [localhost]
> 127.0.0.1
>
> ​
> to 
>  /etc/ansible/hosts
> ​  
>
> When I run
>
> adolph@geek:dcos_absible_prac$ ansible-playbook prac.yml 
>
> PLAY [deploy basic env] 
> *** 
>
> TASK: [Provision a set of instances] 
> ** 
> failed: [127.0.0.1] => {"failed": true}
> msg: Region cn-north-1 does not seem to be available for aws module boto.ec2. 
> If the region definitely exists, you may need to upgrade boto
>
> FATAL: all hosts have already failed -- aborting
>
> PLAY RECAP 
>  
>to retry, use: --limit @/home/adolph/prac.retry
>
> 127.0.0.1  : ok=0changed=0unreachable=0failed=1
>
> ​
> I am in China and 
> cn-noarth-1
> is supported by boto. So I don't know what is the problem.Can you help me ?
> ​ isis supported by boto
>
>
>
>
>
>

-- 
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/7e0fec36-3b6a-4e3f-8ac7-416923d17c3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.0 parameter escaping problem

2016-01-19 Thread Rob White
I've starting seeing the following problem since I upgraded to Ansible v2.0

Here's the task:

raw:

 PowerShell "C:\Temp\db_scripts\copy_db_file.ps1" \"{{ 
system_db_default_location }}/master.mdf\" \"{{ 
system_db_master_mdf_location }}/master.mdf\"

It used to work fine in Ansible 1.9 but now I get a PowerShell error:

"stderr": "The string is missing the terminator: \".\r\n+ CategoryInfo  
: ParserError: (:) [], ParentContainsErrorRecordEx \r\n   
ception\r\n+ FullyQualifiedErrorId : 
TerminatorExpectedAtEndOfString\r\n \r\n"



This is obviously something to do with the way Ansible has changed how it 
handles escaped characters but I've tried a number of other different 
options for escaping my task and i can't get it to work.


I appreciate any suggestions.

-- 
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/f4fe0a9a-9021-4dd3-a565-d5bb7f09a40f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to access the host index in a group? I.e. want number in the hosts group am i?

2015-11-05 Thread Rob White
Awesome Matt!

I knew it had to exist somewhere.

Thanks for sharing.

On Thursday, 5 November 2015 23:26:48 UTC+11, Matt Martz wrote:
>
> A few ways potentially:
>
> {{ play_hosts.index(inventory_hostname) }}
>
> If you want to know host index within a play
>
>
> Or:
>
> {{ groups.somegroup.index(inventory_hostname) }}
>
> For getting the index of a host within a group.
>
>
>
> On Wednesday, November 4, 2015, Rob White  > wrote:
>
>> Unfortunately not.  I'm not iterating over a list.  Ansible is just 
>> making it's way through a group of hosts so i need Ansible to tell me which 
>> host it is operating on.
>>
>>
>>
>> On Thursday, 5 November 2015 16:30:01 UTC+11, Mirko Friedenhagen wrote:
>>>
>>> Hello Rob, 
>>>
>>> maybe 
>>> http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-a-list-with-an-index
>>>  
>>> might help. 
>>>
>>> Regards 
>>> Mirko 
>>> Regards Mirko 
>>> -- 
>>> http://illegalstateexception.blogspot.com/ 
>>> https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen) 
>>> https://bitbucket.org/mfriedenhagen/ 
>>>
>>>
>>> On Thu, Nov 5, 2015 at 5:43 AM, Rob White  wrote: 
>>> > I'm sure this must've come up before but I couldn't find an answer. 
>>> > 
>>> > I have a list of hosts in a group.  I want to write an index number on 
>>> each 
>>> > of those hosts in a file.  E.g. the first host has a file that 
>>> contains 1, 
>>> > the second host has a file that contains 2 etc. 
>>> > 
>>> > Now I know I can access the hosts using the groups variable E.g. 
>>> > groups["mygroup"] but i can't find any reference to an index so the 
>>> host can 
>>> > find out which number it is. 
>>> > 
>>> > Example play 
>>> > 
>>> > ... 
>>> > 
>>> > - name: Add instance to new host group 
>>> > 
>>> >   add_host: 
>>> > 
>>> > name: "{{ item }}" 
>>> > 
>>> > group: zk 
>>> > 
>>> >   with_items: 
>>> > 
>>> > - server1 
>>> > 
>>> > - server2 
>>> > 
>>> > - server3 
>>> > 
>>> > 
>>> > - name: deploy to zk group 
>>> > 
>>> >   hosts: zk 
>>> > 
>>> >   tasks: 
>>> > 
>>> > - name: write a myid file based on the position in the group 
>>> > 
>>> >   copy: 
>>> > 
>>> > content: {{ some_magic_variable?? }} 
>>> > 
>>> > dest: /zookeeper-data/myid 
>>> > 
>>> > 
>>> > 
>>> > In the above server i would expect to end up with three servers each 
>>> with a 
>>> > myid file that contains 0, 1 or 2 
>>> > 
>>> > 
>>> > Anyone know if that magic variable exists? 
>>> > 
>>> > -- 
>>> > 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-proje...@googlegroups.com. 
>>> > To post to this group, send email to ansible...@googlegroups.com. 
>>> > To view this discussion on the web visit 
>>> > 
>>> https://groups.google.com/d/msgid/ansible-project/c3dec262-b1b5-414f-88ba-c326d4ccd93e%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/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/8d3dcada-60b2-4987-af45-8dda8f85da17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to access the host index in a group? I.e. want number in the hosts group am i?

2015-11-04 Thread Rob White
Unfortunately not.  I'm not iterating over a list.  Ansible is just making 
it's way through a group of hosts so i need Ansible to tell me which host 
it is operating on.



On Thursday, 5 November 2015 16:30:01 UTC+11, Mirko Friedenhagen wrote:
>
> Hello Rob, 
>
> maybe 
> http://docs.ansible.com/ansible/playbooks_loops.html#looping-over-a-list-with-an-index
>  
> might help. 
>
> Regards 
> Mirko 
> Regards Mirko 
> -- 
> http://illegalstateexception.blogspot.com/ 
> https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen) 
> https://bitbucket.org/mfriedenhagen/ 
>
>
> On Thu, Nov 5, 2015 at 5:43 AM, Rob White  > wrote: 
> > I'm sure this must've come up before but I couldn't find an answer. 
> > 
> > I have a list of hosts in a group.  I want to write an index number on 
> each 
> > of those hosts in a file.  E.g. the first host has a file that contains 
> 1, 
> > the second host has a file that contains 2 etc. 
> > 
> > Now I know I can access the hosts using the groups variable E.g. 
> > groups["mygroup"] but i can't find any reference to an index so the host 
> can 
> > find out which number it is. 
> > 
> > Example play 
> > 
> > ... 
> > 
> > - name: Add instance to new host group 
> > 
> >   add_host: 
> > 
> > name: "{{ item }}" 
> > 
> > group: zk 
> > 
> >   with_items: 
> > 
> > - server1 
> > 
> > - server2 
> > 
> > - server3 
> > 
> > 
> > - name: deploy to zk group 
> > 
> >   hosts: zk 
> > 
> >   tasks: 
> > 
> > - name: write a myid file based on the position in the group 
> > 
> >   copy: 
> > 
> > content: {{ some_magic_variable?? }} 
> > 
> > dest: /zookeeper-data/myid 
> > 
> > 
> > 
> > In the above server i would expect to end up with three servers each 
> with a 
> > myid file that contains 0, 1 or 2 
> > 
> > 
> > Anyone know if that magic variable exists? 
> > 
> > -- 
> > 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-proje...@googlegroups.com . 
> > To post to this group, send email to ansible...@googlegroups.com 
> . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/ansible-project/c3dec262-b1b5-414f-88ba-c326d4ccd93e%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/7b22d364-82e2-40ff-b3ac-81f2b296d03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is there a way to access the host index in a group? I.e. want number in the hosts group am i?

2015-11-04 Thread Rob White
I'm sure this must've come up before but I couldn't find an answer.

I have a list of hosts in a group.  I want to write an index number on each 
of those hosts in a file.  E.g. the first host has a file that contains 1, 
the second host has a file that contains 2 etc.

Now I know I can access the hosts using the groups variable E.g. 
groups["mygroup"] but i can't find any reference to an index so the host 
can find out which number it is.

Example play

...

- name: Add instance to new host group

  add_host:

name: "{{ item }}"

group: zk

  with_items:

- server1

- server2

- server3


- name: deploy to zk group

  hosts: zk

  tasks:

- name: write a myid file based on the position in the group

  copy: 

content: {{ some_magic_variable?? }}

dest: /zookeeper-data/myid



In the above server i would expect to end up with three servers each with a 
myid file that contains 0, 1 or 2


Anyone know if that magic variable exists?

-- 
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/c3dec262-b1b5-414f-88ba-c326d4ccd93e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ec2_facts and Windows

2015-09-22 Thread Rob White
When running against windows hosts, Ansible will only find modules that have a 
.ps1 prefix. ec2_facts is a Linux only module. 

I'm actually working on aa windows version at the moment and will hopefully 
submit a PR in the next week or so. 

-- 
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/af74b00d-cedb-4246-96ca-d38906c4800f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: ec2_facts and Windows

2015-09-22 Thread Rob White
When running against windows hosts, Ansible will only find modules that have a 
.ps1 prefix. ec2_facts is a Linux only module. 

I'm actually working on aa windows version at the moment and will hopefully 
submit a PR in the next week or so. 

-- 
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/aedd0df9-e2cf-48c1-82b4-257b195ffba9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Creating new list from values in list of dicts

2015-09-13 Thread Rob White
So I wrote my own filter for this...

def idfromlistofdicts(l):
result = []
for item in l:
result.append(item['id'])


return result


class FilterModule(object):
def filters(self):
return {
'idfromlistofdicts': idfromlistofdicts,
}


Not sure if something like this already exists though.


On Monday, 14 September 2015 11:19:48 UTC+10, Rob White wrote:
>
> Hi all,
>
> I am using the ec2_vpc_subnet_facts module to get back a list of subnet 
> dicts.  I want to get the id from each of these dicts and add it to a new 
> list so i end up with just a list of subnet ids.  I thought this might be 
> possible with existing jinja filters but i'm not sure where to start so any 
> pointers would be appreciated.
>
> Example:
>
> 'subnets': [{u'availability_zone': u'ap-southeast-2a', u'tags': {u'Type': 
> u'public', u'Zone': u'a', u'Env': u'support', u'Name': 
> u'support-public-a'}, u'default_for_az': u'false', u'state': u'available', 
> u'vpc_id': u'vpc-11223344', u'cidr_block': u'10.66.128.0/25', 
> u'available_ip_address_count': 113, u'id': u'subnet-11223344', 
> u'map_public_ip_on_launch': u'false'}, {u'availability_zone': 
> u'ap-southeast-2b', u'tags': {u'Type': u'public', u'Zone': u'b', u'Env': 
> u'support', u'Name': u'support-public-b'}, u'default_for_az': u'false', 
> u'state': u'available', u'vpc_id': u'vpc-11223344', u'cidr_block': u'
> 10.66.129.0/25', u'available_ip_address_count': 118, u'id': 
> u'subnet-55667788', u'map_public_ip_on_launch': u'false'}]
>
>
> I want to get each subnet.id in to a list so i end up with...
>
> my_list: [subnet-11223344, subnet-55667788]
>
> 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/45836828-17fa-4274-b31d-8d5b59f3c510%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Creating new list from values in list of dicts

2015-09-13 Thread Rob White
Hi all,

I am using the ec2_vpc_subnet_facts module to get back a list of subnet 
dicts.  I want to get the id from each of these dicts and add it to a new 
list so i end up with just a list of subnet ids.  I thought this might be 
possible with existing jinja filters but i'm not sure where to start so any 
pointers would be appreciated.

Example:

'subnets': [{u'availability_zone': u'ap-southeast-2a', u'tags': {u'Type': 
u'public', u'Zone': u'a', u'Env': u'support', u'Name': 
u'support-public-a'}, u'default_for_az': u'false', u'state': u'available', 
u'vpc_id': u'vpc-11223344', u'cidr_block': u'10.66.128.0/25', 
u'available_ip_address_count': 113, u'id': u'subnet-11223344', 
u'map_public_ip_on_launch': u'false'}, {u'availability_zone': 
u'ap-southeast-2b', u'tags': {u'Type': u'public', u'Zone': u'b', u'Env': 
u'support', u'Name': u'support-public-b'}, u'default_for_az': u'false', 
u'state': u'available', u'vpc_id': u'vpc-11223344', u'cidr_block': 
u'10.66.129.0/25', u'available_ip_address_count': 118, u'id': 
u'subnet-55667788', u'map_public_ip_on_launch': u'false'}]


I want to get each subnet.id in to a list so i end up with...

my_list: [subnet-11223344, subnet-55667788]

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/a91b598c-d608-41d5-9f49-6aa1d1f84000%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Variables inside variables?

2015-09-11 Thread Rob White
If there is no moustache stacking does that mean variables inside variables 
is impossible?

I.e.

environments:
  prod:
vpc_id: 12345
  stg:
vpc_id: 67890
env: prod

debug: msg={{ 'environments.' + env + '.vpc_id' }}

This just gives me a string of 'environments.prod.vpc_id' but what I want 
is '12345'





On Wednesday, 5 August 2015 03:10:46 UTC+10, Brian Coca wrote:
>
> same rule no nesting of moustaches: 
>
>  when: "{{ hostvars[groups['app-a1'][partition]]['target_app_build'] 
> != hostvars[groups['app-'][partition]]['actual_app_build']}}" 
>
>
>
>
> -- 
> Brian Coca 
>

-- 
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/863a2cd8-8550-4e90-bc82-c4c4b76409e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Using when: x in y if y is a list of dicts

2015-08-18 Thread Rob White
Hi guys,

I wonder if anyone knows if it's possible do use the 'in' clause with a 
list of dicts.

I have a list that looks like this:

[{u'state': None, u'id': u'i-233b31yy'}, {u'state': None, u'id': 
u'i-2a2281xx'}]

I want to add_host if an id is not in the list, something like:

vars:
  mylist:
- {u'state': None, u'id': u'i-233b31yy'}
- {u'state': None, u'id': u'i-2a2281xx'}
tasks:
  local_action:
module: add_host
name: "{{ ansible_ec2_local_ipv4 }}"
group: not_in_elb
  when: ansible_ec2_instance_id not in mylist

The above fails because the list items are dicts.  How can I just look at 
the id value of each dict in the list?

-- 
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/49ce10fc-2b25-4187-97e3-6c25b5b509a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: uri_module - json post

2015-06-22 Thread Rob White
Escape your double quotes

body="{\"path\": \"silence/{{ item }}\",\"content\": {\"reason\": 
\"Automatic Scale Down\"},\"expire\": 28800}"

On Tuesday, 23 June 2015 06:45:41 UTC+10, Erick Barros wrote:
>
> Hi guys,
>
> this is the first time I ever use the "uri_module" and I'm facing a 
> problem that I just can't solve.. here it is
>
> - name: Sending Stash to Sensu - {{ item }}
>   uri:
> url=http://10.0.0.8:4567/stashes
> method=POST
> body_format=json
> body="{"path": "silence/{{ item }}","content": {"reason": 
> "Automatic Scale Down"},"expire": 28800}"
> HEADER_Content-Type="application/json;charset=utf-8"
> status_code=200
>   with_items:
> - c3_imagens_name
>   tags:
> - stash
>
> When I try to execute this piece of code I got the following error:
>
> ERROR: Syntax Error while loading YAML script, ec2_rotate_imagens.yml
> Note: The error may actually appear before this position: line 76, column 
> 22
>
> body_format=json
> body="{"path": "silence/{{ item }}","content": {"reason": 
> "Automatic Scale Down"},"expire": 28800}"
>  ^
> We could be wrong, but this one looks like it might be an issue with
> missing quotes.  Always quote template expression brackets when they
> start a value. For instance:
>
> with_items:
>   - {{ foo }}
>
> Should be written as:
>
> with_items:
>   - "{{ foo }}"
>
> I'm trying to POST something like this (using curl):
>
> /usr/bin/curl -XPOST 'http://10.0.0.8:4567/stashes' -d '{
>"path": "silence/ip-10-0-4-217",
>"content": {
>"reason": "Automatic Scale Down"
>},
>"expire": 28800
> }'
>
>
> Could you please guys give me some help?
>
> 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/652cd914-f243-4007-998c-fbef23f831c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Status report: ansible-modules-extras pull requests

2015-06-08 Thread Rob White
Thanks for your work, Greg.  Happy to see progress in this area :)

On Tuesday, 2 June 2015 00:47:18 UTC+10, Greg DeKoenigsberg wrote:
>
> Hi all. Wanted to give a quick update on our initiatives around 
> improving the PR pipeline for ansible-modules-extras. 
>
> To review: we recently decided on two major policy changes. (1) All 
> PRs to existing modules are merged with +1 from the module owner 
> (which implies that module owners can make changes without further 
> approval; please, module owners, be careful with this power.)  (2) All 
> new modules require two +1s from existing module maintainers to be 
> included. 
>
> To support this policy change, we went through and added the Github 
> IDs of all module owners as metadata within each module file. I spent 
> the last week learning the Github API well enough to scrape this data 
> well enough to give myself some rudimentary tools to help speed up 
> merges (I'll be checking some of this stuff in soon). 
>
> Over the past day, I've done a comprehensive review of all open PRs 
> against existing modules.  Where auto-merge was not possible, I asked 
> submitters to rebase; where auto-merge was possible, I asked reviewers 
> to give +1 if review indicates the PR is good.  We've already closed a 
> number of outstanding PRs this way, so to both committers and 
> reviewers, a big thank you. Your work is much appreciated. 
>
> Which brings us to the stickier subject: new modules. The backlog is, 
> uh, large; we have almost 100 PRs for new modules awaiting evaluation 
> for inclusion into Extras -- which is 2/3rd of our current open PRs 
> against Extras. 
>
> It's time to solicit reviews for new modules aggressively. To do this, 
> we'll need a couple of things first: 
>
> 1. A list of reviewers. By policy, a new module needs +1 from two 
> different reviewers (note that any Ansible employee gets two votes, 
> prerogative of upstream).   Current reviewers are "module owners", so 
> I'll put together a list of those people in a file called 
> REVIEWERS.md.  I am aware that this is a bit of a blunt object 
> approach, but it's a starting point.  We can always remove/add 
> reviewers as we see fit, based on sensible new criteria. 
>
> 2. Criteria for inclusion. We want to take care to be opinionated 
> about the right things, so we'll put together some review guidelines 
> that any reviewer can follow.  We don't want to judge on content; we 
> want to judge on the ability to make an Ansible module that works as 
> expected (idempotent, testable, adheres to style guidelines, etc.) 
>
> Getting the first thing done should be quick; getting the second done 
> might take a while, so that will be our next focus.  I will work with 
> the team to nail down these guidelines as quickly as we can, so that 
> we can start delegating more responsibility to our community asap. 
>
> Thanks to everyone for your support and patience as we continue our 
> work to hack down our backlog and grow our contributor base. 
>
> --g 
>
> -- 
> Greg DeKoenigsberg 
> Ansible Community Guy 
>
> Find out why SD Times named Ansible 
> their #1 Company to Watch in 2015: 
> http://sdtimes.com/companies-watch-2015/ 
>

-- 
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/b8e409db-0064-416a-8d69-48d3c46432d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

2015-05-05 Thread Rob White
The module does support region. You should be able to specify it without
issue.

Can you get the subnet_id from the ec2_fact module?
On 27 Apr 2015 16:56, "Tzach Livyatan"  wrote:

>
>
> On Sunday, April 26, 2015 at 6:05:13 PM UTC+3, Rob White wrote:
>>
>> I assume you have referenced eni.interface.id because you've seen the
>> example? Note the code above that which contains a register statement. This
>> allows you to reference output from that command. See
>> http://docs.ansible.com/playbooks_variables.html for more on that.
>>
>> Once you've used that register command you can reference all the values
>> of the ENI creation.
>>
>> If you're still having issues, post your playbook as it stands and any
>> errors you're getting.
>>
> I had two issues, solve one:
> - region parameter was missing, I set AWS_REGION to solve it.
> Would it be nicer to have an explicit parameter for it, like ec2_tag have?
> - subnet_id was missing, and I cant find an elegant way to get. For me
> having the instance subnet as a default will solve this problem.
>
>
>
>
>
>
>>
>>
>>
>> On Thursday, April 23, 2015 at 5:14:35 AM UTC+3, Rob White wrote:
>>>
>>> The latest commit has added support for delete_on_termination and
>>> source_destination_check.  Please test and let me know how it goes.
>>>
>> Can you please give a full example of attaching an interface and setting
>> the delete_on_termination?
>> Not sure how to extract the eni.interface.id for the second.
>>
>> Should I use it as part of a local_action, like I do for ec2_tag?
>>
>> Sorry for the naive questions, I'm relativity new to Ansible.
>>
>>
>>
>>>
>>> If you'd like to leave any comments regarding the module, there's a PR
>>> here https://github.com/ansible/ansible-modules-extras/pull/410
>>>
>>> Rob White
>>> Email: robwh...@gmail.com
>>> Mobile (Australia): +61 410 700 733
>>> Mobile (UK): +44 7527 895 226
>>> Skype: robwhite83
>>>
>>> On 22 April 2015 at 17:46, Tzach Livyatan 
>>> wrote:
>>>
>>>>
>>>>
>>>> On Tuesday, April 21, 2015 at 3:25:31 PM UTC+3, Rob White wrote:
>>>>>
>>>>> Unfortunately you wouldn't be able to create the interface with this
>>>>> attribute. Boto doesn't support it. You'd have to create the interface and
>>>>> then immediately modify it.
>>>>>
>>>>> Would this be acceptable?
>>>>>
>>>> Yes, this is what I'm doing now.
>>>>
>>>>
>>>>
>>>>> On 21 Apr 2015 19:23, "Tzach Livyatan" 
>>>>> wrote:
>>>>>
>>>>>> Hi Rob
>>>>>> Thanks for module!
>>>>>> I was just looking for something like this.
>>>>>>
>>>>>> One thing I'm missing is the ability to set the deleteOnTermination
>>>>>> attribute to True.
>>>>>> Something like
>>>>>> connection.modify_network_interface_attribute(network_interface.id,'
>>>>>> deleteOnTermination',True, attachment_id=network_interface.attachment
>>>>>> .id)
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wednesday, April 15, 2015 at 10:52:19 AM UTC+3, Rob White wrote:
>>>>>>>
>>>>>>> Hi guys,
>>>>>>>
>>>>>>> Recently had this requirement myself.
>>>>>>>
>>>>>>> I've written a module here
>>>>>>> https://github.com/wimnat/ansible-modules-extras/blob/feature/ec2_eni/cloud/amazon/ec2_eni.py
>>>>>>>
>>>>>>> I'd appreciate testing / feedback and if all good I'll submit a PR
>>>>>>> to ansible-modules-extras
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> On Tuesday, 6 January 2015 09:37:10 UTC+11, Igor Cicimov wrote:
>>>>>>>>
>>>>>>>> +1 for this request. Have you seen this module though:
>>>>>>>> https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
>>>>>>>> haven't tried it my self but maybe it can help.
>>>>>>>>
>>>>>>>> On Saturday, January 3, 2015 11:29:13 AM UTC+11, J

Re: [ansible-project] Re: create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

2015-04-26 Thread Rob White
I assume you have referenced eni.interface.id because you've seen the
example? Note the code above that which contains a register statement. This
allows you to reference output from that command. See
http://docs.ansible.com/playbooks_variables.html for more on that.

Once you've used that register command you can reference all the values of
the ENI creation.

If you're still having issues, post your playbook as it stands and any
errors you're getting.



On Thursday, April 23, 2015 at 5:14:35 AM UTC+3, Rob White wrote:
>
> The latest commit has added support for delete_on_termination and
> source_destination_check.  Please test and let me know how it goes.
>
Can you please give a full example of attaching an interface and setting
the delete_on_termination?
Not sure how to extract the eni.interface.id for the second.

Should I use it as part of a local_action, like I do for ec2_tag?

Sorry for the naive questions, I'm relativity new to Ansible.



>
> If you'd like to leave any comments regarding the module, there's a PR
> here https://github.com/ansible/ansible-modules-extras/pull/410
>
> Rob White
> Email: robwh...@gmail.com
> Mobile (Australia): +61 410 700 733
> Mobile (UK): +44 7527 895 226
> Skype: robwhite83
>
> On 22 April 2015 at 17:46, Tzach Livyatan 
> wrote:
>
>>
>>
>> On Tuesday, April 21, 2015 at 3:25:31 PM UTC+3, Rob White wrote:
>>>
>>> Unfortunately you wouldn't be able to create the interface with this
>>> attribute. Boto doesn't support it. You'd have to create the interface and
>>> then immediately modify it.
>>>
>>> Would this be acceptable?
>>>
>> Yes, this is what I'm doing now.
>>
>>
>>
>>> On 21 Apr 2015 19:23, "Tzach Livyatan" 
>>> wrote:
>>>
>>>> Hi Rob
>>>> Thanks for module!
>>>> I was just looking for something like this.
>>>>
>>>> One thing I'm missing is the ability to set the deleteOnTermination
>>>> attribute to True.
>>>> Something like
>>>> connection.modify_network_interface_attribute(network_interface.id,'
>>>> deleteOnTermination',True, attachment_id=network_interface.attachment.
>>>> id)
>>>>
>>>>
>>>>
>>>> On Wednesday, April 15, 2015 at 10:52:19 AM UTC+3, Rob White wrote:
>>>>>
>>>>> Hi guys,
>>>>>
>>>>> Recently had this requirement myself.
>>>>>
>>>>> I've written a module here
>>>>> https://github.com/wimnat/ansible-modules-extras/blob/feature/ec2_eni/cloud/amazon/ec2_eni.py
>>>>>
>>>>> I'd appreciate testing / feedback and if all good I'll submit a PR to
>>>>> ansible-modules-extras
>>>>>
>>>>> Thanks,
>>>>>
>>>>> On Tuesday, 6 January 2015 09:37:10 UTC+11, Igor Cicimov wrote:
>>>>>>
>>>>>> +1 for this request. Have you seen this module though:
>>>>>> https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
>>>>>> haven't tried it my self but maybe it can help.
>>>>>>
>>>>>> On Saturday, January 3, 2015 11:29:13 AM UTC+11, Jeff wrote:
>>>>>>>
>>>>>>> Someone asked for this
>>>>>>> <https://github.com/ansible/ansible/issues/7895> a while back
>>>>>>> before the modules were reorganized, but I've seen no mention since, so 
>>>>>>> I'm
>>>>>>> guess it's still not possible to create (or manipulate) an Elastic
>>>>>>> Network Interface (eni)
>>>>>>> <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html> on
>>>>>>> an EC2 instance yet.   That being the case, since this is supported by 
>>>>>>> boto
>>>>>>> (create_network_interface
>>>>>>> <http://boto.readthedocs.org/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.create_network_interface>),
>>>>>>> is it possible for me to make my own calls via boto somehow?  I'm not 
>>>>>>> very
>>>>>>> deep into Ansible so perhaps this is a nonsensical question.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google

Re: [ansible-project] Re: create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

2015-04-22 Thread Rob White
The latest commit has added support for delete_on_termination and
source_destination_check.  Please test and let me know how it goes.

If you'd like to leave any comments regarding the module, there's a PR here
https://github.com/ansible/ansible-modules-extras/pull/410

Rob White
Email: robwhit...@gmail.com
Mobile (Australia): +61 410 700 733
Mobile (UK): +44 7527 895 226
Skype: robwhite83

On 22 April 2015 at 17:46, Tzach Livyatan 
wrote:

>
>
> On Tuesday, April 21, 2015 at 3:25:31 PM UTC+3, Rob White wrote:
>>
>> Unfortunately you wouldn't be able to create the interface with this
>> attribute. Boto doesn't support it. You'd have to create the interface and
>> then immediately modify it.
>>
>> Would this be acceptable?
>>
> Yes, this is what I'm doing now.
>
>
>
>> On 21 Apr 2015 19:23, "Tzach Livyatan" 
>> wrote:
>>
>>> Hi Rob
>>> Thanks for module!
>>> I was just looking for something like this.
>>>
>>> One thing I'm missing is the ability to set the deleteOnTermination
>>> attribute to True.
>>> Something like
>>> connection.modify_network_interface_attribute(network_interface.id,'
>>> deleteOnTermination',True, attachment_id=network_interface.attachment.id
>>> )
>>>
>>>
>>>
>>> On Wednesday, April 15, 2015 at 10:52:19 AM UTC+3, Rob White wrote:
>>>>
>>>> Hi guys,
>>>>
>>>> Recently had this requirement myself.
>>>>
>>>> I've written a module here
>>>> https://github.com/wimnat/ansible-modules-extras/blob/feature/ec2_eni/cloud/amazon/ec2_eni.py
>>>>
>>>> I'd appreciate testing / feedback and if all good I'll submit a PR to
>>>> ansible-modules-extras
>>>>
>>>> Thanks,
>>>>
>>>> On Tuesday, 6 January 2015 09:37:10 UTC+11, Igor Cicimov wrote:
>>>>>
>>>>> +1 for this request. Have you seen this module though:
>>>>> https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
>>>>> haven't tried it my self but maybe it can help.
>>>>>
>>>>> On Saturday, January 3, 2015 11:29:13 AM UTC+11, Jeff wrote:
>>>>>>
>>>>>> Someone asked for this
>>>>>> <https://github.com/ansible/ansible/issues/7895> a while back before
>>>>>> the modules were reorganized, but I've seen no mention since, so I'm 
>>>>>> guess
>>>>>> it's still not possible to create (or manipulate) an Elastic Network
>>>>>> Interface (eni)
>>>>>> <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html> on
>>>>>> an EC2 instance yet.   That being the case, since this is supported by 
>>>>>> boto
>>>>>> (create_network_interface
>>>>>> <http://boto.readthedocs.org/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.create_network_interface>),
>>>>>> is it possible for me to make my own calls via boto somehow?  I'm not 
>>>>>> very
>>>>>> deep into Ansible so perhaps this is a nonsensical question.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Ansible Project" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/ansible-project/-mFNN63kLrE/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/11088c05-9f70-40fe-90c7-a7384bb18314%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/11088c05-9f70-40fe-90c7-a7384bb18314%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/-mFNN63kLrE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/4edb9bcf-b592-40ff-8894-f05f0b51be4b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4edb9bcf-b592-40ff-8894-f05f0b51be4b%40googlegroups.com?utm_medium=email&utm_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/CA%2Bwe3KRG0VDCySMmTZyODRvPiOvcXGkQqcPqm7qbq9d9W8Qvtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

2015-04-21 Thread Rob White
Unfortunately you wouldn't be able to create the interface with this
attribute. Boto doesn't support it. You'd have to create the interface and
then immediately modify it.

Would this be acceptable?
On 21 Apr 2015 19:23, "Tzach Livyatan"  wrote:

> Hi Rob
> Thanks for module!
> I was just looking for something like this.
>
> One thing I'm missing is the ability to set the deleteOnTermination
> attribute to True.
> Something like
> connection.modify_network_interface_attribute(network_interface.id,'
> deleteOnTermination',True, attachment_id=network_interface.attachment.id)
>
>
>
> On Wednesday, April 15, 2015 at 10:52:19 AM UTC+3, Rob White wrote:
>>
>> Hi guys,
>>
>> Recently had this requirement myself.
>>
>> I've written a module here
>> https://github.com/wimnat/ansible-modules-extras/blob/feature/ec2_eni/cloud/amazon/ec2_eni.py
>>
>> I'd appreciate testing / feedback and if all good I'll submit a PR to
>> ansible-modules-extras
>>
>> Thanks,
>>
>> On Tuesday, 6 January 2015 09:37:10 UTC+11, Igor Cicimov wrote:
>>>
>>> +1 for this request. Have you seen this module though:
>>> https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
>>> haven't tried it my self but maybe it can help.
>>>
>>> On Saturday, January 3, 2015 11:29:13 AM UTC+11, Jeff wrote:
>>>>
>>>> Someone asked for this <https://github.com/ansible/ansible/issues/7895>
>>>> a while back before the modules were reorganized, but I've seen no mention
>>>> since, so I'm guess it's still not possible to create (or manipulate) an 
>>>> Elastic
>>>> Network Interface (eni)
>>>> <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html> on
>>>> an EC2 instance yet.   That being the case, since this is supported by boto
>>>> (create_network_interface
>>>> <http://boto.readthedocs.org/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.create_network_interface>),
>>>> is it possible for me to make my own calls via boto somehow?  I'm not very
>>>> deep into Ansible so perhaps this is a nonsensical question.
>>>>
>>>> Thanks
>>>>
>>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/-mFNN63kLrE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/11088c05-9f70-40fe-90c7-a7384bb18314%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/11088c05-9f70-40fe-90c7-a7384bb18314%40googlegroups.com?utm_medium=email&utm_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/CA%2Bwe3KSyeT35PgQB%3DPt7_4Xzcb1neTazq91ysp9z3nKt43DEAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: create network interface (ENI) on EC2 instance? possible to use "raw" boto commands?

2015-04-15 Thread Rob White
Hi guys,

Recently had this requirement myself.

I've written a module 
here 
https://github.com/wimnat/ansible-modules-extras/blob/feature/ec2_eni/cloud/amazon/ec2_eni.py

I'd appreciate testing / feedback and if all good I'll submit a PR to 
ansible-modules-extras

Thanks,

On Tuesday, 6 January 2015 09:37:10 UTC+11, Igor Cicimov wrote:
>
> +1 for this request. Have you seen this module though: 
> https://github.com/cybosol/ansible/blob/master/library/cloud/ec2_eni
> haven't tried it my self but maybe it can help.
>
> On Saturday, January 3, 2015 11:29:13 AM UTC+11, Jeff wrote:
>>
>> Someone asked for this  
>> a while back before the modules were reorganized, but I've seen no mention 
>> since, so I'm guess it's still not possible to create (or manipulate) an 
>> Elastic 
>> Network Interface (eni) 
>>  on 
>> an EC2 instance yet.   That being the case, since this is supported by boto 
>> (create_network_interface 
>> ),
>>  
>> is it possible for me to make my own calls via boto somehow?  I'm not very 
>> deep into Ansible so perhaps this is a nonsensical question.
>>
>> 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/52c097c4-60a1-4ccb-87c2-e1f73aa3a2fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Passing a list on the command line

2015-03-29 Thread Rob White
Hmmm, this doesn't seem to work for the roles parameter.

I tried the following command:

ansible-playbook test.yml -i inventories/local -e 
'{"roles_to_deploy":["role1","role2"]}'

The test.yml playbook just had:

tasks:
- name: Debug
  debug: msg="{{ item }}"
  with_items:
"{{ roles_to_deploy }}"

All good.

I then tried the same command with my original playbook which has:

roles:
"{{ roles_to_deploy }}"

I get an error "ERROR: value of 'roles:' must be a list"




On Friday, 27 March 2015 23:48:28 UTC+11, James Cammarata wrote:
>
> Hi Rob, this is possible, you just need to format the extra variables as 
> JSON, as documented here: 
> http://docs.ansible.com/playbooks_variables.html#passing-variables-on-the-command-line
>
> James Cammarata
> Director, Ansible Core Engineering
> github: jimi-c
>
> On Thu, Mar 26, 2015 at 8:37 PM, Rob White  > wrote:
>
>> Is it possible to pass a list as an extra-vars variable on the command 
>> line?
>>
>> I have tried various syntax but it doesn't work.
>>
>> E.g.
>>
>> ansible-playbook my_playbook.yml -i local --extra-vars 
>> roles_to_deploy=role1,role2
>> ansible-playbook my_playbook.yml -i local --extra-vars 
>> roles_to_deploy=[role1,role2]
>> ansible-playbook my_playbook.yml -i local --extra-vars 
>> roles_to_deploy=['role1','role2']
>>
>>
>>  -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/a1c3c3ee-f51e-42c1-99bf-677ef6eaa8e5%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/a1c3c3ee-f51e-42c1-99bf-677ef6eaa8e5%40googlegroups.com?utm_medium=email&utm_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/1f360bb2-fd52-4a23-b96a-ebe3c51047bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Passing a list on the command line

2015-03-26 Thread Rob White
Is it possible to pass a list as an extra-vars variable on the command line?

I have tried various syntax but it doesn't work.

E.g.

ansible-playbook my_playbook.yml -i local --extra-vars 
roles_to_deploy=role1,role2
ansible-playbook my_playbook.yml -i local --extra-vars 
roles_to_deploy=[role1,role2]
ansible-playbook my_playbook.yml -i local --extra-vars 
roles_to_deploy=['role1','role2']


-- 
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/a1c3c3ee-f51e-42c1-99bf-677ef6eaa8e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: win_chocolatey not a legal parameter

2015-03-24 Thread Rob White
Jason, can you post your playbook?
On 23 Jan 2015 17:52, "Jason C"  wrote:

> Hi Rob,
>
> I am definitely using winrm to connect.
>
> I forgot to mention I am trying using Vagrant to provision my playbook.
> Regardless, calling ansible_playbook throught the bash shell (with
> arguments) yields the same result.
>
> What is your setup?
>
> By the way many thanks for your assistance.
>
> Jason
>
> On Friday, 23 January 2015 17:02:30 UTC+11, Rob White wrote:
>>
>> How are you defining your hosts?
>>
>> You need to make sure the method is WinRM.  As Chris mentioned earlier in
>> this thread, ansible will only recognize PowerShell modules when using
>> winrm type.
>>
>> On Friday, 23 January 2015 13:41:57 UTC+11, Jason C wrote:
>>>
>>> Hi Rob,
>>>
>>> I have cloned ansible-modules-extras to a separate directory.  Under
>>> that directory ../modules/ansible-modules-extras/windows/ there is  a
>>> file named __init__.py.
>>>
>>> Similar to the issues you were experiencing i can run an ansible command
>>> using the win_chocolatey module but when running a playbook I consistently
>>> get the error "
>>>
>>> win_chocolatey is not a legal parameter in an Ansible task or handler"
>>>
>>> I am unsure of where to go from here. Any advice is appreciated.
>>>
>>> Jason
>>>
>>> On Friday, 23 January 2015 10:16:29 UTC+11, Rob White wrote:
>>>>
>>>> If you look in your module directory (my machine it
>>>> is /usr/lib/python2.7/site-packages/ansible/modules/extras/windows/)
>>>> do you see a __init__.py file?
>>>>
>>>> On Thursday, 22 January 2015 21:29:53 UTC+11, Jason C wrote:
>>>>>
>>>>> Hi Rob,
>>>>>
>>>>> What was your final solution? I am using the "devel" branch of
>>>>> the ansible-modules-extras and are still experiencing the same issue as 
>>>>> you
>>>>> originally posted.
>>>>>
>>>>> On Thursday, 18 December 2014 13:42:13 UTC+11, Rob White wrote:
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> I saw the file was already added to the devel branch.  I downloaded
>>>>>> that branch and chocolatey module can now be called from playbook.
>>>>>>
>>>>>>
>>>>>> On Wednesday, 17 December 2014 22:11:16 UTC+11, Netanel Maman wrote:
>>>>>>>
>>>>>>> solution:
>>>>>>>
>>>>>>> create this file: ansible/lib/ansible/modules/extras/windows/
>>>>>>> __init__.py
>>>>>>> make clean
>>>>>>> make install
>>>>>>>
>>>>>>> --
>>>>>>> behind the scenes:
>>>>>>> setuptools don't copy win_chocolatey.py to install directory
>>>>>>> without __init__.py file.
>>>>>>> ansible detect plugin by .py extension, so win_chocolatey not
>>>>>>> detected..
>>>>>>>
>>>>>>> On Monday, December 8, 2014 7:47:30 AM UTC+2, Rob White wrote:
>>>>>>>>
>>>>>>>> I'm having trouble with win_chocolatey module in a playbook.
>>>>>>>>
>>>>>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>>>>>>>
>>>>>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm
>>>>>>>>> -u administrator -k -a 'package=notepadplusplus'
>>>>>>>>> SSH password:
>>>>>>>>> 1.2.3.4 | success >> {
>>>>>>>>> "changed": true,
>>>>>>>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe
>>>>>>>>> install notepadplusplus -source https://chocolatey.org/api/v2/";,
>>>>>>>>> "chocolatey_success": "true"
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> So then I added to a playbook as per the documentation but I get
>>>>>>>> the following error:
>>>>>>>>
>>>>>>>> ansible-playbook hosts_windows.yml -i inventories/windows
>>>>>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task
>>>>>>>>> or handler
>>>>>>>>
>>>>>>>>
>>>>>>>> Why would ansible see the module, but ansible-playbook fail?
>>>>>>>>
>>>>>>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/mUAVtS3n-cw/unsubscribe.
> To unsubscribe from this group and all its topics, 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/33648857-fa1e-42c2-be16-283b52bf9dd6%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/33648857-fa1e-42c2-be16-283b52bf9dd6%40googlegroups.com?utm_medium=email&utm_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/CA%2Bwe3KRi2-fTZXtr2O1y_9vVJKZ9j2Lc%2BJEs-kud0Gg4C5c2Lw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_chocolatey not a legal parameter

2015-01-22 Thread Rob White
How are you defining your hosts?

You need to make sure the method is WinRM.  As Chris mentioned earlier in 
this thread, ansible will only recognize PowerShell modules when using 
winrm type.

On Friday, 23 January 2015 13:41:57 UTC+11, Jason C wrote:
>
> Hi Rob,
>
> I have cloned ansible-modules-extras to a separate directory.  Under that 
> directory ../modules/ansible-modules-extras/windows/ there is  a file named 
> __init__.py.
>
> Similar to the issues you were experiencing i can run an ansible command 
> using the win_chocolatey module but when running a playbook I consistently 
> get the error " 
>
> win_chocolatey is not a legal parameter in an Ansible task or handler"
>
> I am unsure of where to go from here. Any advice is appreciated.
>
> Jason
>
> On Friday, 23 January 2015 10:16:29 UTC+11, Rob White wrote:
>>
>> If you look in your module directory (my machine it 
>> is /usr/lib/python2.7/site-packages/ansible/modules/extras/windows/) do you 
>> see a __init__.py file?
>>
>> On Thursday, 22 January 2015 21:29:53 UTC+11, Jason C wrote:
>>>
>>> Hi Rob,
>>>
>>> What was your final solution? I am using the "devel" branch of 
>>> the ansible-modules-extras and are still experiencing the same issue as you 
>>> originally posted.
>>>
>>> On Thursday, 18 December 2014 13:42:13 UTC+11, Rob White wrote:
>>>>
>>>> Thanks!
>>>>
>>>> I saw the file was already added to the devel branch.  I downloaded 
>>>> that branch and chocolatey module can now be called from playbook.
>>>>
>>>>
>>>> On Wednesday, 17 December 2014 22:11:16 UTC+11, Netanel Maman wrote:
>>>>>
>>>>> solution: 
>>>>>
>>>>> create this file: ansible/lib/ansible/modules/extras/windows/
>>>>> __init__.py
>>>>> make clean
>>>>> make install
>>>>>
>>>>> --
>>>>> behind the scenes:
>>>>> setuptools don't copy win_chocolatey.py to install directory without 
>>>>> __init__.py 
>>>>> file.
>>>>> ansible detect plugin by .py extension, so win_chocolatey not 
>>>>> detected..
>>>>>
>>>>> On Monday, December 8, 2014 7:47:30 AM UTC+2, Rob White wrote:
>>>>>>
>>>>>> I'm having trouble with win_chocolatey module in a playbook.
>>>>>>
>>>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>>>>>
>>>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
>>>>>>> administrator -k -a 'package=notepadplusplus'
>>>>>>> SSH password: 
>>>>>>> 1.2.3.4 | success >> {
>>>>>>> "changed": true, 
>>>>>>> "chocolatey command": 
>>>>>>> "C:\\ProgramData\\chocolatey\\bin\\choco.exe install notepadplusplus 
>>>>>>> -source https://chocolatey.org/api/v2/";, 
>>>>>>> "chocolatey_success": "true"
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> So then I added to a playbook as per the documentation but I get the 
>>>>>> following error:
>>>>>>
>>>>>> ansible-playbook hosts_windows.yml -i inventories/windows
>>>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
>>>>>>> handler 
>>>>>>
>>>>>>
>>>>>> Why would ansible see the module, but ansible-playbook fail? 
>>>>>>
>>>>>

-- 
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/8d32bc2e-69dc-4522-bf6c-867b08f85ae6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_chocolatey not a legal parameter

2015-01-22 Thread Rob White
If you look in your module directory (my machine it 
is /usr/lib/python2.7/site-packages/ansible/modules/extras/windows/) do you 
see a __init__.py file?

On Thursday, 22 January 2015 21:29:53 UTC+11, Jason C wrote:
>
> Hi Rob,
>
> What was your final solution? I am using the "devel" branch of 
> the ansible-modules-extras and are still experiencing the same issue as you 
> originally posted.
>
> On Thursday, 18 December 2014 13:42:13 UTC+11, Rob White wrote:
>>
>> Thanks!
>>
>> I saw the file was already added to the devel branch.  I downloaded that 
>> branch and chocolatey module can now be called from playbook.
>>
>>
>> On Wednesday, 17 December 2014 22:11:16 UTC+11, Netanel Maman wrote:
>>>
>>> solution: 
>>>
>>> create this file: ansible/lib/ansible/modules/extras/windows/__init__.py
>>> make clean
>>> make install
>>>
>>> --
>>> behind the scenes:
>>> setuptools don't copy win_chocolatey.py to install directory without 
>>> __init__.py 
>>> file.
>>> ansible detect plugin by .py extension, so win_chocolatey not detected..
>>>
>>> On Monday, December 8, 2014 7:47:30 AM UTC+2, Rob White wrote:
>>>>
>>>> I'm having trouble with win_chocolatey module in a playbook.
>>>>
>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>>>
>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
>>>>> administrator -k -a 'package=notepadplusplus'
>>>>> SSH password: 
>>>>> 1.2.3.4 | success >> {
>>>>> "changed": true, 
>>>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe 
>>>>> install notepadplusplus -source https://chocolatey.org/api/v2/";, 
>>>>> "chocolatey_success": "true"
>>>>
>>>> }
>>>>
>>>>
>>>> So then I added to a playbook as per the documentation but I get the 
>>>> following error:
>>>>
>>>> ansible-playbook hosts_windows.yml -i inventories/windows
>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
>>>>> handler 
>>>>
>>>>
>>>> Why would ansible see the module, but ansible-playbook fail? 
>>>>
>>>

-- 
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/f2d3331e-9259-4e67-aeca-852d251ce769%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to use ec2 modules user_data field?

2014-12-17 Thread Rob White
Hi Chris,

What's your approach for logging in to your Win boxes using WinRM after 
this step?

Ansible docs direct you to configure a vars file with ansible_ssh_pass set 
however every ec2 instance is going to have a different password.  I've 
created a module for using boto to get the ec2 password but i dont know how 
to chain this through to then use it for a following play which would 
configure my windows instances.


On Sunday, 26 October 2014 06:33:32 UTC+11, Chris Church wrote:
>
> The file lookup plugin is your friend.
>
> I'm using the following task for launching Windows instances and 
> configuring PowerShell remoting:
>
> - ec2:
> aws_access_key: '{{ aws_access_key }}'
> aws_secret_key: '{{ aws_secret_key }}'
> region: '{{ win_ec2_region }}'
> instance_type: '{{ win_ec2_instance_type }}'
> instance_tags:
> Name: '{{win_ec2_name_prefix}}-{{item.name}}'
> group: '{{ win_ec2_security_group }}'
> key_name: '{{ win_ec2_key_name }}'
> image: '{{ item.id }}'
> user_data: "{{ lookup('file', 'win_ec2_user_data') }}"
> exact_count: 1
> count_tag:
> Name: '{{win_ec2_name_prefix}}-{{item.name}}'
> wait: yes
>   with_items: win_ec2_images
>   register: win_ec2
>
>
> My win_ec2_user_data file contains:
>
> 
> iex ((new-object net.webclient).DownloadString('
> https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1'
> ))
> 
>  
>
>
>
> On Fri, Oct 24, 2014 at 8:00 PM, Michael DeHaan  > wrote:
>
>> I don't believe YAML takes Python-like docstrings.
>>
>> So you would need to start with a single or double quote and escape any 
>> internal quotes as need be.
>>
>> The "file" lookup plugin may also be helpful. 
>>
>> On Fri, Oct 24, 2014 at 12:06 PM, Erick Barros > > wrote:
>>
>>> I got the following error:
>>>
>>> ERROR: Syntax Error while loading YAML script, /etc/ansible/playbooks/
>>> search/roles/aws/tasks/main.yml
>>> Note: The error may actually appear before this position: line 13, 
>>> column 17
>>>
>>>
>>>state: running
>>>user_data: """#!/bin/bash
>>> ^
>>> This one looks easy to fix.  It seems that there is a value started
>>> with a quote, and the YAML parser is expecting to see the line ended
>>> with the same kind of quote.  For instance:
>>>
>>>
>>> when: "ok" in result.stdout
>>>
>>>
>>> Could be written as:
>>>
>>>
>>>when: '"ok" in result.stdout'
>>>
>>>
>>> or equivalently:
>>>
>>>
>>>when: "'ok' in result.stdout"
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Saturday, August 16, 2014 12:04:59 PM UTC-3, Michael DeHaan wrote:

 (a)  can you please show the line from your playbook where you are 
 using the user data variable?

 (b)  with the above, how are you determining the way it fails?  I.e. 
 what does failure look like?


 On Fri, Aug 15, 2014 at 5:36 PM, Jonathan Nakatsui  
 wrote:

> From the ansible docs the ec2 module (http://docs.ansible.com/ec2_
> module.html) mentions a user_data field. However, there is no example 
> showing the use of user_data.
>
> I've tried a variety of things to pass through to the user field to no 
> avail including
>
> user_data: file.txt
>
> user_data: "{{ lookup('file', file.txt') }}"
>
> user_data: """#!/bin/bash
>   apt-get update
>   apt-get install htop"""
>
> And variations thereof. My googlefu has failed me so far to find any 
> results for how to solve this issue.
>
> Thanks if you have any input.
>
> -- 
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/64b86c47-036a-471f-8a64-
> 9cbd38c04f5c%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-proje...@googlegroups.com .
>>> To post to this group, send email to ansible...@googlegroups.com 
>>> .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/a1c6540e-6ece-49b8-84f8-83802cb97ebb%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more op

[ansible-project] Re: win_chocolatey not a legal parameter

2014-12-17 Thread Rob White
Thanks!

I saw the file was already added to the devel branch.  I downloaded that 
branch and chocolatey module can now be called from playbook.


On Wednesday, 17 December 2014 22:11:16 UTC+11, Netanel Maman wrote:
>
> solution: 
>
> create this file: ansible/lib/ansible/modules/extras/windows/__init__.py
> make clean
> make install
>
> --
> behind the scenes:
> setuptools don't copy win_chocolatey.py to install directory without 
> __init__.py 
> file.
> ansible detect plugin by .py extension, so win_chocolatey not detected..
>
> On Monday, December 8, 2014 7:47:30 AM UTC+2, Rob White wrote:
>>
>> I'm having trouble with win_chocolatey module in a playbook.
>>
>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>
>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
>>> administrator -k -a 'package=notepadplusplus'
>>> SSH password: 
>>> 1.2.3.4 | success >> {
>>> "changed": true, 
>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe 
>>> install notepadplusplus -source https://chocolatey.org/api/v2/";, 
>>> "chocolatey_success": "true"
>>
>> }
>>
>>
>> So then I added to a playbook as per the documentation but I get the 
>> following error:
>>
>> ansible-playbook hosts_windows.yml -i inventories/windows
>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
>>> handler 
>>
>>
>> Why would ansible see the module, but ansible-playbook fail? 
>>
>

-- 
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/f6fb7b1d-fb0f-4827-9b51-bac64d4c69ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] win_chocolatey not a legal parameter

2014-12-15 Thread Rob White
Thanks for the suggestion Ashley.

I have previously tried that structure but i still get the same error
complaining about win_chocolatey not being a legal parameter.

Rob White
Email: robwhit...@gmail.com
Mobile (Australia): +61 410 700 733
Mobile (UK): +44 7527 895 226
Skype: robwhite83

On 16 December 2014 at 17:40, Ashley Yuan  wrote:
>
> Hi Rob,
>
> Maybe you could try this structure in your playbook file:
>
> ---
>> - hosts: windows
>>   tasks:
>>   - name: install
>> win_chocolatey:
>>   package: notepadplusplus
>>   state: present
>> # Install git
>>   - win_chocolatey:
>>   package: git
>
>
> Hope that helps.
>
>
> On Tue, Dec 16, 2014 at 2:03 PM, Rob White  wrote:
>>
>> Nope, doesn't work.
>>
>> My file structure is:
>>
>> windows_playbook.yml
>> group_vars/windows
>> inventory/win
>>
>> My playbook:
>> ---
>> - name: Configure instance
>>   hosts: windows
>>   gather_facts: true
>>   tasks:
>> - name: Install common packages from chocolatey
>>   win_chocolatey: package=notepadplusplus state=present
>>
>>
>>
>> group_vars/windows has:
>>
>> ansible_ssh_user: administrator
>> ansible_ssh_pass: hidden
>> ansible_ssh_port: 5986
>> ansible_connection: winrm
>>
>> inventory/win is simply:
>>
>> [windows]
>> 1.2.3.4
>>
>> Output is always:
>>
>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or
>> handler
>>
>> I've tried specifying variables at the command line.  I.e.
>>
>> ansible-playbook hosts_windows.yml -i inventories/windows -u
>> administrator -k -c winrm
>>
>> It asks for the password then fails with the same error.
>>
>> Again, this command works fine:
>>
>> ansible -v windows -i inventories/windows -m win_chocolatey -c winrm -u
>> administrator -k -a 'package=notepadplusplus'
>>
>>
>> Any further suggestions welcome :)
>>
>>
>> On Tuesday, 9 December 2014 16:14:18 UTC+11, Chris Church wrote:
>>>
>>> Trying using ansible-playbook with -c winrm, or add
>>> ansible_connection=winrm to your inventory for Windows hosts.
>>>
>>> Ansible will only find PowerShell modules when using the winrm
>>> connection.
>>>
>>>
>>> On Mon, Dec 8, 2014 at 9:40 PM, Rob White  wrote:
>>>
>>>> # Install common packages
>>>> - name: Install common packages from chocolatey
>>>>   win_chocolatey:
>>>> package: notepadplusplus
>>>> state: present
>>>> showlog: true
>>>>
>>>> On Tuesday, 9 December 2014 11:26:17 UTC+11, Chris Church wrote:
>>>>>
>>>>> Could you paste the task from your playbook that's causing the error?
>>>>>
>>>>>
>>>>> On Mon, Dec 8, 2014 at 12:47 AM, Rob White  wrote:
>>>>>
>>>>>> I'm having trouble with win_chocolatey module in a playbook.
>>>>>>
>>>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>>>>>
>>>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u
>>>>>>> administrator -k -a 'package=notepadplusplus'
>>>>>>> SSH password:
>>>>>>> 1.2.3.4 | success >> {
>>>>>>> "changed": true,
>>>>>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe
>>>>>>> install notepadplusplus -source https://chocolatey.org/api/v2/";,
>>>>>>> "chocolatey_success": "true"
>>>>>>
>>>>>> }
>>>>>>
>>>>>>
>>>>>> So then I added to a playbook as per the documentation but I get the
>>>>>> following error:
>>>>>>
>>>>>> ansible-playbook hosts_windows.yml -i inventories/windows
>>>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or
>>>>>>> handler
>>>>>>
>>>>>>
>>>>>> Why would ansible see the module, but ansible-playbook fail?
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Ansible Project" group.

Re: [ansible-project] win_chocolatey not a legal parameter

2014-12-15 Thread Rob White
Nope, doesn't work.

My file structure is:

windows_playbook.yml
group_vars/windows
inventory/win

My playbook:
---
- name: Configure instance
  hosts: windows
  gather_facts: true
  tasks:
- name: Install common packages from chocolatey
  win_chocolatey: package=notepadplusplus state=present



group_vars/windows has:

ansible_ssh_user: administrator
ansible_ssh_pass: hidden
ansible_ssh_port: 5986
ansible_connection: winrm

inventory/win is simply:

[windows]
1.2.3.4

Output is always:

ERROR: win_chocolatey is not a legal parameter in an Ansible task or handler

I've tried specifying variables at the command line.  I.e.

ansible-playbook hosts_windows.yml -i inventories/windows -u administrator 
-k -c winrm

It asks for the password then fails with the same error.

Again, this command works fine:

ansible -v windows -i inventories/windows -m win_chocolatey -c winrm -u 
administrator -k -a 'package=notepadplusplus'


Any further suggestions welcome :)


On Tuesday, 9 December 2014 16:14:18 UTC+11, Chris Church wrote:
>
> Trying using ansible-playbook with -c winrm, or add 
> ansible_connection=winrm to your inventory for Windows hosts.
>
> Ansible will only find PowerShell modules when using the winrm connection.
>
>
> On Mon, Dec 8, 2014 at 9:40 PM, Rob White  > wrote:
>
>> # Install common packages
>> - name: Install common packages from chocolatey
>>   win_chocolatey:
>> package: notepadplusplus
>> state: present
>> showlog: true
>>
>> On Tuesday, 9 December 2014 11:26:17 UTC+11, Chris Church wrote:
>>>
>>> Could you paste the task from your playbook that's causing the error?
>>>
>>>
>>> On Mon, Dec 8, 2014 at 12:47 AM, Rob White  wrote:
>>>
>>>> I'm having trouble with win_chocolatey module in a playbook.
>>>>
>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>>>
>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
>>>>> administrator -k -a 'package=notepadplusplus'
>>>>> SSH password: 
>>>>> 1.2.3.4 | success >> {
>>>>> "changed": true, 
>>>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe 
>>>>> install notepadplusplus -source https://chocolatey.org/api/v2/";, 
>>>>> "chocolatey_success": "true"
>>>>
>>>> }
>>>>
>>>>
>>>> So then I added to a playbook as per the documentation but I get the 
>>>> following error:
>>>>
>>>> ansible-playbook hosts_windows.yml -i inventories/windows
>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
>>>>> handler 
>>>>
>>>>
>>>> Why would ansible see the module, but ansible-playbook fail? 
>>>>
>>>> -- 
>>>> 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-proje...@googlegroups.com.
>>>> To post to this group, send email to ansible...@googlegroups.com.
>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>> msgid/ansible-project/ca1815cc-565f-4bd7-8492-
>>>> 897dc382b66a%40googlegroups.com 
>>>> <https://groups.google.com/d/msgid/ansible-project/ca1815cc-565f-4bd7-8492-897dc382b66a%40googlegroups.com?utm_medium=email&utm_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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/fff1cfe4-3eb1-4e16-ab07-f688e6c6d17f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/fff1cfe4-3eb1-4e16-ab07-f688e6c6d17f%40googlegroups.com?utm_medium=email&utm_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/ef7bf334-855e-4e85-ba2a-641c0c47b609%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Loops in loops for VPC creation

2014-12-08 Thread Rob White
I am trying to create a play that defines by VPC infrastructure.  I have a 
number of environments that are all set up in the same way but with 
different subnets.  I'm trying to loop over a dict for each environment and 
then within that loop, loop to create by cidr subnets.  However, it fails 
with an error "unsupported parameter for module: with_sequence".

I'm using the ipaddr custom filter.

I'm not sure quite how I would access my with_sequence item even if this 
did work.  Would it be item[1]?

My play is below...

---
- name: VPC infrastructure
  hosts: local
  connection: local
  gather_facts: false
  vars:
environments:
  prod:
vpc_cidr_block: 10.0.0.0/21
availability_zones: 2
  android:
vpc_cidr_block: 10.0.8.0/21
availability_zones: 2
  tasks:
- name: Create VPC
  local_action:
module: ec2_vpc
state: present
region: "{{ aws_region }}"
cidr_block: "{{ item.value.vpc_cidr_block }}"
subnets:
  - cidr: "{{ item.value.vpc_cidr_block | ipsubnet(24, 0) }}"
with_sequence: count={{ item.value.availability_zones }}
resource_tags: { "env": "{{ item.key }}" }
wait: yes
  with_dict: environments
  register: vpc


Any pointers appreciated.

-- 
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/270b38c1-1cff-42c5-aa3f-7eadfc82f1db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] win_chocolatey not a legal parameter

2014-12-08 Thread Rob White
# Install common packages
- name: Install common packages from chocolatey
  win_chocolatey:
package: notepadplusplus
state: present
showlog: true

On Tuesday, 9 December 2014 11:26:17 UTC+11, Chris Church wrote:
>
> Could you paste the task from your playbook that's causing the error?
>
>
> On Mon, Dec 8, 2014 at 12:47 AM, Rob White  > wrote:
>
>> I'm having trouble with win_chocolatey module in a playbook.
>>
>> I upgraded from 1.7 to 1.9 and then ran the following successfully:
>>
>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
>>> administrator -k -a 'package=notepadplusplus'
>>> SSH password: 
>>> 1.2.3.4 | success >> {
>>> "changed": true, 
>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe 
>>> install notepadplusplus -source https://chocolatey.org/api/v2/";, 
>>> "chocolatey_success": "true"
>>
>> }
>>
>>
>> So then I added to a playbook as per the documentation but I get the 
>> following error:
>>
>> ansible-playbook hosts_windows.yml -i inventories/windows
>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
>>> handler 
>>
>>
>> Why would ansible see the module, but ansible-playbook fail? 
>>
>> -- 
>> 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-proje...@googlegroups.com .
>> To post to this group, send email to ansible...@googlegroups.com 
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/ca1815cc-565f-4bd7-8492-897dc382b66a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/ca1815cc-565f-4bd7-8492-897dc382b66a%40googlegroups.com?utm_medium=email&utm_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/fff1cfe4-3eb1-4e16-ab07-f688e6c6d17f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] win_chocolatey not a legal parameter

2014-12-08 Thread Rob White
I'm having trouble with win_chocolatey module in a playbook.

I upgraded from 1.7 to 1.9 and then ran the following successfully:

ansible windows -i inventories/windows -m win_chocolatey -c winrm -u 
> administrator -k -a 'package=notepadplusplus'
> SSH password: 
> 1.2.3.4 | success >> {
> "changed": true, 
> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe 
> install notepadplusplus -source https://chocolatey.org/api/v2/";, 
> "chocolatey_success": "true"

}


So then I added to a playbook as per the documentation but I get the 
following error:

ansible-playbook hosts_windows.yml -i inventories/windows
> ERROR: win_chocolatey is not a legal parameter in an Ansible task or 
> handler 


Why would ansible see the module, but ansible-playbook fail? 

-- 
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/ca1815cc-565f-4bd7-8492-897dc382b66a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.