Re: [ansible-project] Copy module can not run in coreos

2016-05-09 Thread tao zhang
I modify executor/module_common.py. change

p = subprocess.Popen([%(interpreter)s, module], env=os.environ, shell=False, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subp
rocess.PIPE)


to

p = subprocess.Popen([%(interpreter)s, module], env=os.environ, shell=True, 
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subp
rocess.PIPE)


I am not sure wether it is a bug of ansible 2.1.0. But it works for me.

在 2016年5月6日星期五 UTC+8下午11:37:08,tkuratomi写道:
>
> I'm not seeing that issue, no.  Might be something about how you have your 
> remote system setup.  Here's what I tested:
>
> Terminal1:
> $ docker run -it --name test_coreos ianbytchek/coreos-ansible-toolbox 
> /bin/sh
>
> Terminal2:
> $ ansible -i 'test_coreos,' '*' -c docker -m copy -a 'src=/etc/passwd 
> dest=/tmp/'
> clever_brown | SUCCESS => {
> "changed": true, 
> "checksum": "6b98197c1742baf15158e3964ade0f867903b578", 
> "dest": "/tmp/passwd", 
> "gid": 0, 
> "group": "root", 
> "md5sum": "0286278a2fd3f46b9101e8cbd4400c8b", 
> "mode": "0644", 
> "owner": "root", 
> "size": 5111, 
> "src": 
> "/root/.ansible/tmp/ansible-tmp-1462548844.23-248426584823267/source", 
> "state": "file", 
> "uid": 0
> }
> $ docker exec -it test_coreos '/bin/ls' '/tmp/'
> passwd
> $ ansible --version [stable-2.1]  (08:35:39)
> ansible 2.2.0 (devel 0a5831e654) last updated 2016/05/06 08:13:57 (GMT 
> -700)
>   lib/ansible/modules/core: (devel 1f5cf669dd) last updated 2016/05/06 
> 08:13:32 (GMT -700)
>   lib/ansible/modules/extras: (devel d1b16cd007) last updated 2016/05/06 
> 08:13:42 (GMT -700)
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = Default w/o overrides
>
>
> -Toshio
>
> On Wed, May 4, 2016 at 7:14 PM, tao zhang  > wrote:
>
>> Hi guys,
>>
>> Has anyone meet the below issue?
>>
>> Copy module can not run in coreos. I got the below error message:
>> /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 
>> /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 
>> /etc/localtime is not a symlink, not updating container timezone. 
>> Traceback (most recent call last): 
>>   File 
>> \"/home/core/.ansible/tmp/ansible-tmp-1462413293.33-173671562381843/file\", 
>> line 114, in  
>> exitcode = invoke_module(module, zipped_mod, ZIPLOADER_PARAMS) 
>>   File 
>> \"/home/core/.ansible/tmp/ansible-tmp-1462413293.33-173671562381843/file\", 
>> line 28, in invoke_module 
>> p = subprocess.Popen(['/opt/bin/python', module], env=os.environ, 
>> shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
>> stdin=subprocess.PIPE) 
>>   File \"/usr/lib/python2.7/subprocess.py\", line 710, in __init__ 
>> errread, errwrite) 
>>   File \"/usr/lib/python2.7/subprocess.py\", line 1335, in _execute_child 
>> raise child_exception 
>> OSError: [Errno 2] No such file or directory 
>>
>> But synchronize, raw modules works fine. 
>>
>> -- 
>> 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/f1a40bf6-a7f9-4897-baa2-927bf89f75cf%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/4e04cbc9-4da1-4340-9774-5baf45ff1b0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Build automation using ESXi, Ansible, Pysphere

2016-05-09 Thread Jason Hiatt
Instructions are finally up, sorry it took so long, ran into some bugs while I 
was Dockerizing the app. Please try it out and let me know what problems you 
come across. 


> On May 5, 2016, at 21:44, Dibyendu Paul  wrote:
> 
> Hi Jason
> Is there any instructions available yet?
> 
>> On Friday, 29 April 2016 18:12:20 UTC+5:30, Jason Hiatt wrote:
>> Yes, I am going to update code and write up some instructions this weekend.  
>> I have a big project at work I need to finish up before I can get to that 
>> though.
>> 
>> If you want to make multiple VMs I would write a script that calls the 
>> createVM.php web service.
>> 
>> All you would  have to do is call curl, for example.  curl 
>> "http://test.example.com/ws/createVM.php?vmname=${VMName}=${IPAddress}=2...;
>> 
>> Thanks,
>> Jason
>> 
>> 
>> 
>> 
>>> On Thu, Apr 28, 2016 at 1:44 AM, Dibyendu Paul  
>>> wrote:
>>> Also The current Web UI allows to create one  VM at a time. Is It possible 
>>> to create Multiple VMs at a time?
>>> 
>>>  
>>> 
 On Wednesday, 27 April 2016 04:19:26 UTC+5:30, Jason Hiatt wrote:
 
 Yes, you could specify the installation server in your custom ISO.
 I think the correct option to use is "inst.repo="
 
 We just use the installation source from the DVD.
 
 Thanks,
 Jason
 
 
> On Sun, Apr 24, 2016 at 11:32 PM, Dibyendu Paul  
> wrote:
> Hi Jason
> This is excellent!
> In this setup is it possible to pick the RHEL OS from the Installation 
> server? where the iso could be kept or local repository could be created?
> 
> Regards
> Dibyendu Paul
> 
>> On Monday, 25 April 2016 08:37:30 UTC+5:30, Jason Hiatt wrote:
>> We have a web UI that lets our admins input IP, VM name, number of CPUs, 
>> RAM and other attributes.
>> You can see a stripped down version of it here -> 
>> https://github.com/OneMainF/vmware-rhel-server-builder/blob/master/build/src/www/createVM.html
>> 
>> The web UI calls this web service when all inputs are entered -> 
>> https://github.com/OneMainF/vmware-rhel-server-builder/blob/master/build/src/www/ws/createvm.php
>> 
>> The web service adds the server to a database and creates an Ansible 
>> play and runs it.  The playbook creates the VM and collects the VM's MAC 
>> address and updates the DB.
>> 
>> Once the VM starts up the dynamic Kickstart file is called and the VM is 
>> built.
>> https://github.com/OneMainF/vmware-rhel-server-builder/blob/master/build/src/www/kickstart/ks.php
>> 
>> 
>> I'm getting closer to Dockeizing the application, hopefully I can get it 
>> done this week.
>> 
>>> On Thu, Apr 21, 2016 at 11:24 PM, Dibyendu Paul  
>>> wrote:
>>> Hi
>>> How the kick start will pick individual ips of the vms. Where those ips 
>>> to be defined?
>>> The kick start will not have the up conf? How do you make it 
>>> generalized?
>>> 
>>> --
>>> 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/Holm0CFBbLo/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/621f9dca-6d54-4e51-82ad-761be5a374bd%40googlegroups.com.
>>> 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/Holm0CFBbLo/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/43674172-ecab-4a82-9450-11be01e5833b%40googlegroups.com.
> 
> 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/Holm0CFBbLo/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 
>>> 

[ansible-project] Re: Register command output with_items

2016-05-09 Thread Srividhya Mohan
Hi John

Do you mind sharing your playbook with me? So that I can take a look at the 
code.

Thanks
Sri

On Sunday, May 1, 2016 at 4:57:22 AM UTC-4, John Buxton wrote:
>
> Sri,
> It would help if the your output matched the playbook you are running.
> Your problem task isn't even in your test playbook!
>  
>
>> TASK: [debug msg="{{ 
>> echo_output.results|map(attribute='stdout_lines')|list}}"] ***
>> ok: [127.0.0.1] => {
>> "msg": "[Undefined, Undefined]"
>> }
>>
>
> Anyway, this works for me on stable-2.0.0.1 on centos 7.
> I get the output below, which is probably what you are expecting:
>
> ok: [t1] => {
> "msg": [
> [
> "hi"
> ], 
> [
> "hello"
> ]
> ]
> }
>
>

-- 
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/8c8ab6f0-f797-4d9c-98e1-c8668eba7614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Help test WinRM updates for NTLM, kerb delegation

2016-05-09 Thread Matt Davis
 

A new pywinrm release that supports NTLM, kerberos delegation, and much 
improved performance is just around the corner! Version 0.2.0 is at release 
candidate, and a test build has been published to testpypi. Just waiting 
for any final testing/review from Alexey before the final publish of the 
release build to PyPI. 


Feel like giving it a whirl?


pip install pywinrm[kerberos]==0.2rc3 -i https://testpypi.python.org/pypi 
--extra-index-url https://pypi.python.org/pypi


will get you the RC3 test build from testpypi (along with the released 
dependencies from the real pypi), and the optional kerberos dependencies. 
If you don't want kerberos, just get rid of the [kerberos] extras part in 
the pkgspec above.


This pywinrm build has been tested with Ansible 1.9.5, 2.0.2 and 2.1RC1.


Once you have it installed, ansible_winrm_transport=ntlm in your inventory 
for Windows hosts (sorry, this one only works for Ansible 2.0+) lets you 
use domain users with both domain\username and usern...@domain.com syntax. 
When using ansible_winrm_transport=kerberos, kerberos delegation support 
can be enabled just by adding ansible_winrm_kerberos_delegation=yes. 


We've added a few new niceties around arg parsing in Ansible 2.1, like 
warnings if you pass inventory args that your installed version of pywinrm 
doesn't understand (and not requiring things like username when not 
required) but otherwise, most of the goodies in here should work on older 
versions of Ansible too.


This release of pywinrm has switched the HTTP(S) client from urllib2 to 
requests, allowing us to take advantage of persistent connections, which 
give another significant performance boost to Windows on Ansible 
(especially over HTTPS, as we don't have to repeat the TLS handshake for 
each WinRM request). In my testing, local VMs experienced about a 20% speed 
boost on small tasks, while remote VMs (eg, AWS instances) got more like a 
50% speed boost to small tasks (due to the higher latency cost during 
connection setup). File transfer performance (eg, win_copy) should also be 
noticeably improved again with this release, though I haven't benchmarked 
it.


Feel free to file issues at https://github.com/diyan/pywinrm/issues.


Enjoy!


Matt Davis

Principal Software Engineer (Ansible Core Windows)

Red Hat

-- 
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/d3826326-8289-4683-9ee4-6b92e6c4c297%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Dependency to a role used in distinct hosts

2016-05-09 Thread Paulo Sudério
Hi all,

If I've understood correctly, role dependencies are to run in the same 
hosts. At least this seems to be the design. But I have many cases where 
dependencies are to roles that will run in other groups of hosts.

Ex.: roles to a group dbservers and roles to a group appservers - many of 
the roles of the appservers have the roles applied in the dbservers as 
dependencies.

What I would like is to define a dependency in a role that runs in a host / 
group, but this dependency must run in another host / group.

A simple reorganization of the playbook does not seem enough. Right now the 
best I was able to do is the reordering of dependencies in the playbooks, 
but this does not scale. The dependencies are too many and too entangled. 
Think hundreds microservices being deployed with database dependencies in 
many different hosts / groups, some with the same dependencies and some 
dependencies linked to more than one service.

Are there some best practices / planned feature to accomplish this?

Thanks,

Paulo Suderio

-- 
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/5676e80f-2600-42ff-86ff-7e3c4721eadc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Tim Griffin
Johannes... I appreciate you sharing your snippet of code. That should save
me some time!

Tim


On Mon, May 9, 2016 at 3:22 PM, Johannes Kastl  wrote:

> On 09.05.16 17:29 Tim Griffin wrote:
> > Ah, okay. Good point, Johannes.
> >
> > And, on RHEL, turning of the GPG check wouldn't be a good plan anyways!
>
> On CentOS-machines I use this snippet to install the epel-release
> package and import the rpm-key:
>
> - name: CentOS - install epel-release
>   yum: name=epel-release state=latest
>   when: ansible_os_family == "RedHat"
>
> - name: CentOS - install epel-release Key
>   rpm_key: key="/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{
> ansible_distribution_major_version }}" state=present
>   when: ansible_os_family == "RedHat"
>
> Johannes
>
> --
> 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/dHuToEsVqOc/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/5730E393.7050908%40ojkastl.de
> .
> 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/CAAnEMzQKidXKe%3D4aW_9zJdx6zU1KFWJ%2BNE%2B41CmY7ZRFPALz0Q%40mail.gmail.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.


[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 Jared Bristow
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/c2ae9bdd-fe57-492c-a756-7137dc9310ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Johannes Kastl
On 09.05.16 17:29 Tim Griffin wrote:
> Ah, okay. Good point, Johannes.
> 
> And, on RHEL, turning of the GPG check wouldn't be a good plan anyways!

On CentOS-machines I use this snippet to install the epel-release
package and import the rpm-key:

- name: CentOS - install epel-release
  yum: name=epel-release state=latest
  when: ansible_os_family == "RedHat"

- name: CentOS - install epel-release Key
  rpm_key: key="/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{
ansible_distribution_major_version }}" state=present
  when: ansible_os_family == "RedHat"

Johannes

-- 
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/5730E393.7050908%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Ansible test frameworks ?

2016-05-09 Thread Matt Martz
You could still use an ansible playbook, but utilize a different callback
plugin, to output the data in the method you can use.  There is a `json`
stdout callback plugin, that can return results of the playbook in JSON
format.

On Sat, May 7, 2016 at 12:57 PM, Michael Bright 
wrote:

>
>
> I want to do some testing across multiple hosts (of an OpenStack platform)
> and I'd really like to base this on Ansible to take advantage of the
> inventory management.
>
> However, I really don't want the standard ansible-playbook output, even in
> check mode, I'd like something where I can craft the output.
>
> I'd like to avoid reinventing the wheel, just like I'd like to avoid
> making bad implementation choices but I'm surprised not to find an existing
> framework as it seems such a good use case for Ansible.
>
> So not having found anything it strikes me that I could
> - use the Ansible API ... seems to be a no no as there seem to be no
> guarantees of stability across releases
> - write a python wrapper which invokes ansible via the command-line and
> parses the output ... not very nice
>
> I'm sure I've missed something obvious.
> Any pointers?
>
> Thanks,
> Mike.
>
>
>
> --
> 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/eb45b27e-4eb4-4791-9a95-ad8e500104de%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/CAD8N0v8dRCsfppPvZ8X%2Byk2WEQH-DYtG%3D2vWx4RH_FqYZ7vGYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Tim Griffin
Ah, okay. Good point, Johannes.

And, on RHEL, turning of the GPG check wouldn't be a good plan anyways!

Tim


On Mon, May 9, 2016 at 11:24 AM, Johannes Kastl  wrote:

> On 08.05.16 21:37 Kacper Patro wrote:
> > Hi Tim,
> >
> > I had similar issue with VirtualBox repo. In my case, removing line
> > *repo_gpgcheck=1* from repo file (i.e. el-passenger.repo) helped.
>
>
> DONT! You lose all security provided by gpg signatures of the
> packages. (Sorry for the yelling... ;-))
>
> I would rather add the rpm-key with the corresponding module, the link
> is in your output:
>
> https://packagecloud.io/gpg.key
>
> Johannes
>
> --
> 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/dHuToEsVqOc/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/5730ABA6.1010706%40ojkastl.de
> .
> 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/CAAnEMzQ6gG%2BKEsmXuxvtcWoG0yJi8bquE-NHRkgt7JO0-uAfyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Johannes Kastl
On 08.05.16 21:37 Kacper Patro wrote:
> Hi Tim,
> 
> I had similar issue with VirtualBox repo. In my case, removing line 
> *repo_gpgcheck=1* from repo file (i.e. el-passenger.repo) helped.


DONT! You lose all security provided by gpg signatures of the
packages. (Sorry for the yelling... ;-))

I would rather add the rpm-key with the corresponding module, the link
is in your output:

https://packagecloud.io/gpg.key

Johannes

-- 
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/5730ABA6.1010706%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Tim Griffin
Thanks, Kacper.

I'll give that a shot!
Tim


On Sun, May 8, 2016 at 3:37 PM, Kacper Patro  wrote:

> Hi Tim,
>
> I had similar issue with VirtualBox repo. In my case, removing line
> *repo_gpgcheck=1* from repo file (i.e. el-passenger.repo) helped.
>
> Best Regards,
> Kacper
>
> W dniu niedziela, 3 kwietnia 2016 14:18:00 UTC+2 użytkownik TJG napisał:
>
>> Hi all;
>>
>> I'm pretty new to Ansible, but have generally made good progress with a
>> playbook to set up a (vagrant) CentOS 7 box. One point of grief is my
>> translation of Phusion's instructions for installing Passenger, from here
>> 
>> .
>>
>> Running the following playbook (*as root*) fails with "[Errno -1]
>> repomd.xml signature could not be verified for passenger"
>> yet works perfectly when done interactively.
>>
>> Any ideas what the difference is?
>>
>> Thanks,
>> Tim
>>
>> - name: Passenger | Add Phusion's EL7 YUM repository
>>   shell: sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo
>> https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
>>
>> - name: Passenger | Set root as owner of passenger.repo and allow only
>> root to read and write passenger.repo
>>   file: path=/etc/yum.repos.d/passenger.repo owner=root mode=600
>>
>>
>> - name: Passenger | Install mod_passenger
>>   yum: name={{ item }} state=present enablerepo=passenger
>>   with_items:
>> - mod_passenger
>>
>> Results in:
>>
>>
>>
>> ^@failed: [localhost] (item=[u'mod_passenger']) => {"failed": true,
>> "invocation": {"module_args": {"conf_file": null, "disable_gpg_check":
>> false, "disablerepo": null, "enablerepo": "passenger", "exclude": null,
>> "install_repoquery": true, "list": null, "name": ["mod_passenger"],
>> "state": "present", "update_cache": false, "validate_certs": true},
>> "module_name": "yum"}, "item": ["mod_passenger"], "msg": "Failure
>> talking to yum: failure: repodata/repomd.xml from passenger: [Errno 256] No
>> more mirrors to try.\nhttps://
>> oss-binaries.phusionpassenger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml:
>> [Errno -1] repomd.xml signature could not be verified for passenger"}
>>
>>
>> Transcript of interactive installation:
>>
>> [vagrant@test-httpd ~]$ sudo yum install -y mod_passenger
>> Loaded plugins: fastestmirror
>> base
>>
>>  | 3.6 kB  00:00:00
>> epel/x86_64/metalink
>>
>>  |  11 kB  00:00:00
>> epel
>>
>>  | 4.3 kB  00:00:00
>> extras
>>
>>  | 3.4 kB  00:00:00
>> passenger/7/x86_64/signature
>>
>>  |  836 B  00:00:00
>> Retrieving key from https://packagecloud.io/gpg.key
>> Importing GPG key 0xD59097AB:
>>
>>  Userid : "packagecloud ops (production key) "
>>  Fingerprint: 418a 7f2f b0e1 e6e7 eabf 6fe8 c2e7 3424 d590 97ab
>>  From   : https://packagecloud.io/gpg.key
>> passenger/7/x86_64/signature
>>
>>  | 1.0 kB  00:00:00 !!!
>> passenger-source/7/signature
>> ...
>> ...
>> Total
>>  337
>> kB/s | 6.4 MB  00:00:19
>> Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
>> Importing GPG key 0x352C64E5:
>>  Userid : "Fedora EPEL (7) "
>>
>>  Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
>>  Package: epel-release-7-5.noarch (@extras)
>>  From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
>> Running transaction check
>> Running transaction test
>> Transaction test succeeded
>> Running transaction
>>   Updating   : selinux-policy-3.13.1-60.el7_2.3.noarch
>>
>> 1/8
>>   Installing : 1:rubygem-rack-1.6.4-2.el7.noarch
>>
>> 2/8
>>   Installing : rubygem-rake-0.9.6-25.el7_1.noarch
>>
>>  3/8
>>   Installing : passenger-5.0.26-8.el7.x86_64
>>
>> 4/8
>>   Installing : mod_passenger-5.0.26-8.el7.x86_64
>>
>> 5/8
>> ...
>>
>> Installed:
>>   mod_passenger.x86_64 0:5.0.26-8.el7
>>
>>
>> Dependency Installed:
>>   passenger.x86_64 0:5.0.26-8.el7rubygem-rack.noarch
>> 1:1.6.4-2.el7rubygem-rake.noarch 0:0.9.6-25.el7_1
>>
>>
>> Dependency Updated:
>>   selinux-policy.noarch 0:3.13.1-60.el7_2.3
>>selinux-policy-targeted.noarch 0:3.13.1-60.el7_2.3
>>
>>
>> Complete!
>> [vagrant@test-httpd ~]$
>>
>>
>>
>>
>>
>> --
> 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/dHuToEsVqOc/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
> 

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.


[ansible-project] Ansible test frameworks ?

2016-05-09 Thread Michael Bright


I want to do some testing across multiple hosts (of an OpenStack platform) 
and I'd really like to base this on Ansible to take advantage of the 
inventory management.

However, I really don't want the standard ansible-playbook output, even in 
check mode, I'd like something where I can craft the output.

I'd like to avoid reinventing the wheel, just like I'd like to avoid making 
bad implementation choices but I'm surprised not to find an existing 
framework as it seems such a good use case for Ansible.

So not having found anything it strikes me that I could
- use the Ansible API ... seems to be a no no as there seem to be no 
guarantees of stability across releases
- write a python wrapper which invokes ansible via the command-line and 
parses the output ... not very nice

I'm sure I've missed something obvious.
Any pointers?

Thanks,
Mike.



-- 
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/eb45b27e-4eb4-4791-9a95-ad8e500104de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Register shell output in a variable

2016-05-09 Thread Petre Bandac
  Register: 'x' = script.stdout or something? :)Hab's irgendwo gemacht, schicke dir morn ein BispiuGruss :)From: Ivo HechmannSent: Monday, May 9, 2016 14:53To: Ansible ProjectReply To: ansible-project@googlegroups.comSubject: [ansible-project] Register shell output in a variableHello team ansibleHow can I register the output of a script in a variable? Thus, not the script result object with all its attributes like stdout, stderr etc, but only catch the stdout and register as variable?Thank you very much for any hints...Ivo 



-- 
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/25f9684c-4005-4b74-b1af-057ee6a3ad96%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/20160509144256.5419091.11215.52310%40kgb.ro.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Installing Passenger fails: "repomd.xml signature could not be verified for passenger" but works interactively

2016-05-09 Thread Kacper Patro
Hi Tim,

I had similar issue with VirtualBox repo. In my case, removing line 
*repo_gpgcheck=1* from repo file (i.e. el-passenger.repo) helped.

Best Regards,
Kacper

W dniu niedziela, 3 kwietnia 2016 14:18:00 UTC+2 użytkownik TJG napisał:
>
> Hi all;
>
> I'm pretty new to Ansible, but have generally made good progress with a 
> playbook to set up a (vagrant) CentOS 7 box. One point of grief is my 
> translation of Phusion's instructions for installing Passenger, from here 
> 
> . 
>
> Running the following playbook (*as root*) fails with "[Errno -1] 
> repomd.xml signature could not be verified for passenger"
> yet works perfectly when done interactively. 
>
> Any ideas what the difference is? 
>
> Thanks,
> Tim
>
> - name: Passenger | Add Phusion's EL7 YUM repository
>   shell: sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo 
> https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
>   
> - name: Passenger | Set root as owner of passenger.repo and allow only 
> root to read and write passenger.repo
>   file: path=/etc/yum.repos.d/passenger.repo owner=root mode=600
>
>
> - name: Passenger | Install mod_passenger
>   yum: name={{ item }} state=present enablerepo=passenger
>   with_items:
> - mod_passenger
>
> Results in:
>
>
>
> ^@failed: [localhost] (item=[u'mod_passenger']) => {"failed": true, 
> "invocation": {"module_args": {"conf_file": null, "disable_gpg_check": 
> false, "disablerepo": null, "enablerepo": "passenger", "exclude": null, 
> "install_repoquery": true, "list": null, "name": ["mod_passenger"], 
> "state": "present", "update_cache": false, "validate_certs": true}, 
> "module_name": "yum"}, "item": ["mod_passenger"], "msg": "Failure talking 
> to yum: failure: repodata/repomd.xml from passenger: [Errno 256] No more 
> mirrors to try.\nhttps://
> oss-binaries.phusionpassenger.com/yum/passenger/el/7/x86_64/repodata/repomd.xml:
>  
> [Errno -1] repomd.xml signature could not be verified for passenger"}
>
>
> Transcript of interactive installation:
>
> [vagrant@test-httpd ~]$ sudo yum install -y mod_passenger
> Loaded plugins: fastestmirror
> base 
> 
>  | 3.6 kB  00:00:00 
> epel/x86_64/metalink 
> 
>  |  11 kB  00:00:00 
> epel   
>
> | 4.3 kB  00:00:00 
> extras 
>
> | 3.4 kB  00:00:00 
> passenger/7/x86_64/signature 
> 
>  |  836 B  00:00:00 
> Retrieving key from https://packagecloud.io/gpg.key
> Importing GPG key 0xD59097AB:
>  Userid : "packagecloud ops (production key)  >"
>  Fingerprint: 418a 7f2f b0e1 e6e7 eabf 6fe8 c2e7 3424 d590 97ab
>  From   : https://packagecloud.io/gpg.key
> passenger/7/x86_64/signature 
> 
>  | 1.0 kB  00:00:00 !!! 
> passenger-source/7/signature 
> ...
> ...
> Total 
>337 kB/s 
> | 6.4 MB  00:00:19 
> Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
> Importing GPG key 0x352C64E5:
>  Userid : "Fedora EPEL (7) "
>  Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
>  Package: epel-release-7-5.noarch (@extras)
>  From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
> Running transaction check
> Running transaction test
> Transaction test succeeded
> Running transaction
>   Updating   : selinux-policy-3.13.1-60.el7_2.3.noarch   
> 
> 1/8 
>   Installing : 1:rubygem-rack-1.6.4-2.el7.noarch 
> 
> 2/8 
>   Installing : rubygem-rake-0.9.6-25.el7_1.noarch 
> 
>3/8 
>   Installing : passenger-5.0.26-8.el7.x86_64 
> 
>

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.


[ansible-project] Re: Register shell output in a variable

2016-05-09 Thread 'J Hawkesworth' via Ansible Project
You could use set_fact to store just the stdout into another variable, but 
personally I wouldn't bother - you can just ignore the bits of the register 
output that you don't care about.

On Monday, May 9, 2016 at 1:53:15 PM UTC+1, Ivo Hechmann wrote:
>
> Hello team ansible
>
> How can I register the output of a script in a variable? Thus, not the 
> script result object with all its attributes like stdout, stderr etc, but 
> only catch the stdout and register as variable?
>
> Thank you very much for any hints...
>
> Ivo 
>

-- 
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/af73b197-b3cd-4326-951f-907245a8160c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Register shell output in a variable

2016-05-09 Thread Ivo Hechmann
Hello team ansible

How can I register the output of a script in a variable? Thus, not the 
script result object with all its attributes like stdout, stderr etc, but 
only catch the stdout and register as variable?

Thank you very much for any hints...

Ivo 

-- 
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/25f9684c-4005-4b74-b1af-057ee6a3ad96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Inventory level files and templates

2016-05-09 Thread 'J Hawkesworth' via Ansible Project
You could pick up a different version of a file say for each environment

- name: copy environment-specific config
  copy: 
src: "configuration.{{environment}}.conf"
dest: /etc/someconf.conf

I'd argue that if there are lots of things that are different between test 
and prod then you are more likely to hit problems when your applications 
finally reach prod, so might be worth some pain to try and make some things 
(that aren't directly related to scaling) the same in both test and 
production.

Also defaults in ansible are pretty easy.  As well as defining defaults in 
your roles, you can do in-line defaults in your playbooks

- name: wait for startup
  pause:
 seconds: "{{ some_app_startup_pause_seconds | default(60 }}"

Hope this helps,

Jon
On Monday, May 9, 2016 at 10:13:31 AM UTC+1, Krzysztof Zarzycki wrote:
>
> Hi! 
> Is it possible to store files or templates per inventory? Similar to how 
> we can store group_vars per inventory.
> I often hit the issue with Ansible, that I would like to store a file or a 
> template per inventory (TEST, PROD). These usually are large configuration 
> files of some components (like Hadoop), that are almost completely 
> different per inventory and have so many variables, that it seems worthless 
> to create shell-like templates with a lot of variables in it. Especially, 
> that these configuration files are nicely written, with a lot of nested 
> structure, while ansible variables are just flat (IMHO using nested 
> variables in Ansible is unfeasible either because it's hard to do defaults 
> and overrides, hard to do references between variables, etc).   
>
> Not only templates, I would also like to store binary files (zipfiles?) 
> that could be different per inventory. Is that possible? 
>
> Thanks a lot for answers,
> Krzysztof 
>
>

-- 
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/10b75b4b-9c2b-4617-afb2-80e2cbc50740%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Inventory level files and templates

2016-05-09 Thread Krzysztof Zarzycki
Hi! 
Is it possible to store files or templates per inventory? Similar to how we 
can store group_vars per inventory.
I often hit the issue with Ansible, that I would like to store a file or a 
template per inventory (TEST, PROD). These usually are large configuration 
files of some components (like Hadoop), that are almost completely 
different per inventory and have so many variables, that it seems worthless 
to create shell-like templates with a lot of variables in it. Especially, 
that these configuration files are nicely written, with a lot of nested 
structure, while ansible variables are just flat (IMHO using nested 
variables in Ansible is unfeasible either because it's hard to do defaults 
and overrides, hard to do references between variables, etc).   

Not only templates, I would also like to store binary files (zipfiles?) 
that could be different per inventory. Is that possible? 

Thanks a lot for answers,
Krzysztof 

-- 
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/253bfbc2-edde-45c2-b75b-119ffbf76dab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.