[ansible-project] Re: win_shell hangs

2017-03-03 Thread Hmdi Bz
The app is embededd inside an osgi container (karaf), there is no 
installer,the app is started by just executing the karaf start script.

Thx

On Friday, March 3, 2017 at 6:29:45 PM UTC+1, J Hawkesworth wrote:
>
> Many apps with msi installers have a quiet mode for unattended 
> installations. Might be worth checking to see if your app has a silent 
> mode. Often there is a /qn option you can pass to the installer program.
>
> Hope this helps, 
>
>
> Jon
>
>

-- 
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/ba48adb1-b19b-41c8-b39a-b83c9585aea7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] I am new to ansible modules / playbooks and I simply can not get the archive module to work

2017-03-03 Thread David Brendlinger

I just want to make a very simple playbook  using the archive module: 

http://docs.ansible.com/ansible/archive_module.html


I tried many things including:
---
  - hosts: all
tasks:
- name: Archive

- archive:
path: /path/to/foo
dest: /path/to/foo.tgz


Can someone show me how to archive a file in a playbook ? 

Is there a better place for newbies to post this level of question?

-- 
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/78c3e14c-d20e-4459-8eff-6e62df6b9494%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Human readable Stdout ansible (2.3.0)

2017-03-03 Thread rajeev


Hello All,


I am in need of your urgent help. 
I am new to ansible. I have installed the latest version of ansible (2.3.0).

I need to run the tool across my entire UNIX environment with 1+ hosts.


*The problem is with the output which is not in a human readable format. I 
have created a basic playbook to get some status and have tried both 
callback version of the human_log.py 

 listed 
by Cliff, did not help.*

"For Ansible 2.x, please check out https://gist.github.com/dms 
...
 
and/or https://github.com/n0ts/ans 

..."



Please assist/advise at your earliest, what can I do to make the output 
more readable.



thanks much!
Rajeev

-- 
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/5e7cd06a-49e6-4388-9eec-e8625ea558d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.1.5 and 2.2.2 RC2 are ready for testing

2017-03-03 Thread James Cammarata
Hi all, we're very happy to announce that RC2 for Ansible 2.1.5 and 2.2.2
are ready for testing!

These rc's include one fix for both 2.2.2 and 2.1.5, and two more fixes
just for 2.2.2:

* Fix azure_rm version checks (#22270) (both 2.2.2 and 2.1.5)
* Fix for traceback when we encounter non-utf8 characters when using --diff
* Ensure ssh hostkey checks respect server port (#20840)

How do you get them?
--

The tar.gz of the releases can be found here:

http://releases.ansible.com/ansible/ansible-2.1.5.0-0.2.rc2.tar.gz
SHA256: c904f1962c7114675eb252ddb48d2470a3e2363144d62614d5baaa64b58ea047

http://releases.ansible.com/ansible/ansible-2.2.2.0-0.2.rc2.tar.gz
SHA256: 7638af3aaf761e36d42594936d66540e5cba8437a4ac920990af467d99cd3b1b

You can also test against the git repository as follows:

$ git clone https://github.com/ansible/ansible.git
$ cd ansible
$ git checkout 
$ git submodule update --init

You can then source our testing script:

$ . hacking/env-setup

or you can build your own .tar.gz (output will be in the dist/ directory):

$ make sdist

If you discover any errors, or if you see any regressions from playbooks
which work on 1.9.x and prior, please open a Github issue and be sure to
mention you're testing against this release candidate.

Thanks!

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

-- 
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/CAMFyvFipPAFcsp7t6h-COdBT9FYuyB7VGJJhjYx-5O0f%2B88Rcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dynamic Includes: assigning dynamic tags to included files

2017-03-03 Thread Brian Coca
tags are not dynamic, they are evaluated at compile time so no
variables are available.


--
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/CACVha7e-P%3DwrTR6u%3DBf8T_iLkBXZmhgUb2Poaa5pH4%2B3khWjow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Setting Target Machine Environment Variables

2017-03-03 Thread Brian Coca
each task is a different session, env vars created in task1, will not
be seen in task2 (if you login from one terminal and expot a variable,
you won't see it when you login from a 2nd terminal).

Use the environment: directive at play/block/task level if you want
your tasks to have a specific set environment. for example:
http://docs.ansible.com/ansible/playbooks_environment.html


--
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/CACVha7fLo5J-CFuqyTLQ75-fpQtMhY_EN6Tic0PaFQrU-n-kbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Pulling MySQL Table/Field data for Jinja templates

2017-03-03 Thread Kai Stian Olstad

On 03. mars 2017 19:51, Gilberto Valentin wrote:

Hello, I am interested in pulling specific data from a table/field and
apply that data to a .j2 template. For example, if I have a license key in
a table on a field called RedHat license, I want to pull that license value
and have my .j2 template use it for the creation of an XML template. I was
pointed to the lookup plugin (
https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/lookup)
but there isn't anything there for MySQL. There is one for MongoDB, though.
The issue is that I don't know how I would use these plugins and I don't
know how to write plugins yet or how I would include one for the lookup
plugin. What would be the best approach in my case? If I need to write my
own plugin, is there a document that can guide me on this and how I would
incorporate it with lookup? Thanks


You could use the command module and run an mysql query.

- name: Run a playbook
  command: mysql -u  -p --silent --skip-column-names 
--execute="SELECT  FROM "

  register: result

Then you can use the variable result.stdout and/or result.stdout_lines 
to get the result.


(I don't recommend using -p, use a option file instead, but 
easier to show a -p on the command line)


--
Kai Stian Olstad

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


Re: [ansible-project] lineinfile transiently results in empty file

2017-03-03 Thread Brian Coca
Ansible updates the file atomically, so having 'concurrent' updates
will clobber each other, but should not create a corrupt file. IIRC,
XFS does by default 0 out files when there is an I/O error.


--
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/CACVha7duhzvPSmWbp0eAkwovhs1Vo5Y-4TwhVg2b9cLzACR3pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Random inclusion of irrelevant hosts

2017-03-03 Thread Brian Coca
So I tried to reproduce this and examined the code step by step, I don't 
see how this can happen, much less randomly.

The only things i can think of is that you have overlapping host/group 
names and are using group_by to add the machine to a 'group with host 
name', but this should happen every run, not at random.

If you can create a reproducer please open a ticket at 
https://github.com/ansible/ansible


--
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/8679a987-b515-4808-8ae0-6f1a0fb8e2a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Pulling MySQL Table/Field data for Jinja templates

2017-03-03 Thread Gilberto Valentin
Hello, I am interested in pulling specific data from a table/field and 
apply that data to a .j2 template. For example, if I have a license key in 
a table on a field called RedHat license, I want to pull that license value 
and have my .j2 template use it for the creation of an XML template. I was 
pointed to the lookup plugin (
https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/lookup) 
but there isn't anything there for MySQL. There is one for MongoDB, though. 
The issue is that I don't know how I would use these plugins and I don't 
know how to write plugins yet or how I would include one for the lookup 
plugin. What would be the best approach in my case? If I need to write my 
own plugin, is there a document that can guide me on this and how I would 
incorporate it with lookup? 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/78a8d281-6878-45e6-9707-8af67a0f6896%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] download jts-1.13.jar

2017-03-03 Thread Dick Visser
On 3 March 2017 at 19:44, Pedro Ferro  wrote:
>
>
>
> Hi,
>  I'm tryning to make this on a file
>
>
> - name: download jts-1.13.jar
>   get_url:
>url: 
> http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
>  -O jts-1.13.jar
>dest: /tmp/jts-1.13.jar
>
> but  get this error
> TASK [download jts-1.13.jar] 
> ***
> fatal: [localhost]: FAILED! => {"changed": false, "dest": 
> "/tmp/jts-1.13.jar", "failed": true, "msg": "Request failed:  [Errno 113] No route to host>", "state": "absent", "url": 
> "http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
>  -O jts-1.13.jar"}
>
>
> on terminal if I do like this it works
>
> wget 
> http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
>  -O jts-1.13.jar
>
> If someone could help I appreciate

You included the wget '-O' option in the 'url' parameter of get_url




-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

-- 
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/CAL8fbwPXbP-i9f%2BUuAijTkE2NCPFmS2c3-3jL%3DeoxJ%2BsssePzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] with_items fail condition

2017-03-03 Thread Ansible User
got a script that is trying to check to see if a path exists, both in 
"Program Files" and "Program Files x86" and that part works, in that I can 
iterate over and check both paths, but what I am having trouble doing is 
having it fail only when both paths don't exists. 

What I want it to do is only fail if both don't exists. Otherwise I want it 
to show success if either one or the other is there. Any ideas?

-- 
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/752a9adf-4459-4921-be94-71dceaa50d7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] download jts-1.13.jar

2017-03-03 Thread Pedro Ferro


Hi,
 I'm tryning to make this on a file


- name: download jts-1.13.jar
  get_url:
   url: 
http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
 
-O jts-1.13.jar
   dest: /tmp/jts-1.13.jar

but  get this error
TASK [download jts-1.13.jar] 
***
fatal: [localhost]: FAILED! => {"changed": false, "dest": 
"/tmp/jts-1.13.jar", "failed": true, "msg": "Request failed: ", "state": "absent", "url": 
"http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
 
-O jts-1.13.jar"}


on terminal if I do like this it works

wget 
http://search.maven.org/remotecontent?filepath=com/vividsolutions/jts/1.13/jts-1.13.jar
 
-O jts-1.13.jar



If someone could help I appreciate 



Thanks in advance
Pedro

-- 
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/01f274a8-aeda-49f7-b119-24d7c267f9e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_shell hangs

2017-03-03 Thread 'J Hawkesworth' via Ansible Project
Many apps with msi installers have a quiet mode for unattended installations. 
Might be worth checking to see if your app has a silent mode. Often there is a 
/qn option you can pass to the installer program.

Hope this helps, 


Jon

-- 
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/6e013146-9b70-4deb-a6d5-66c8e4c47a91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Includes with limits and tags?

2017-03-03 Thread Stankovic, Marko
There's this feature request related to your question:
https://github.com/ansible/ansible/issues/14117

Cheers,
Marko
CONFIDENTIALITY NOTICE: This message is the property of International Game 
Technology PLC and/or its subsidiaries and may contain proprietary, 
confidential or trade secret information. This message is intended solely for 
the use of the addressee. If you are not the intended recipient and have 
received this message in error, please delete this message from your system. 
Any unauthorized reading, distribution, copying, or other use of this message 
or its attachments is strictly prohibited.

-- 
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/SN1PR01MB1950B4E89A01BB6B71C319ECEB2B0%40SN1PR01MB1950.prod.exchangelabs.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Includes with limits and tags?

2017-03-03 Thread Kai Stian Olstad

On 03. mars 2017 17:06, Josh Smift wrote:

We have a playbook that restores some data from a backup to a host, and
afterwards we want to run another playbook that fixes up some things in
the backup, but that other playbook is more general, and does a whole
bunch of tasks, and affects all the hosts of this type. We'd rather only
run the tasks that we know we need to run (which are identified by a tag),
and only run them on the host they need to run on. Something like

- include: hosttype.yml
  limit: "{{ restorehost }}"
  tags: mytags

That actual code doesn't actually work, obviously.

Is there a way to do this within Ansible?


You could do something like this if you are using ssh keys for login.
- command: ansible-playbook hosttype.yml -l {{ restorehost }} -t mytags

--
Kai Stian Olstad

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


[ansible-project] Includes with limits and tags?

2017-03-03 Thread Josh Smift
We have a playbook that restores some data from a backup to a host, and
afterwards we want to run another playbook that fixes up some things in
the backup, but that other playbook is more general, and does a whole
bunch of tasks, and affects all the hosts of this type. We'd rather only
run the tasks that we know we need to run (which are identified by a tag),
and only run them on the host they need to run on. Something like

- include: hosttype.yml
  limit: "{{ restorehost }}"
  tags: mytags

That actual code doesn't actually work, obviously.

Is there a way to do this within Ansible?

(We can do it by hand, obviously, but the restore playbook takes a long
time, and someone has to then remember to come along and run hosttype.yml
one when the restore is done. We could create a two-line shell script that
run both playbooks, but it'd be cool to just be able to do this with an
include.)

  -Josh (j...@care.com)

(apologies for the automatic corporate disclaimer that follows)

This email is intended for the person(s) to whom it is addressed and may 
contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, 
distribution, copying, or disclosure by any person other than the addressee(s) 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email and delete the message and any 
attachments from your system.

-- 
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/22713.38002.786507.66685%40gargle.gargle.HOWL.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Split inventory in multiple .yml files?

2017-03-03 Thread Dennis Klein
yes

have a look at this 
article: 
http://allandenot.com/devops/2015/01/16/ansible-with-multiple-inventory-files.html

we are using it this way.


├── inventory
│   ├── group_vars
│   │   ├── all
│   │   │   ├── vars.yml
│   │   │   └── vault.yml
│   └── host_vars
│   ├──host1
│   │   │   ├── vars.yml
│   │   │   └── vault.yml

192.168.20.10


Am Freitag, 3. März 2017 16:45:40 UTC+1 schrieb vu001:
>
> Hi,
>
> is it possible to split inventory in multiple files...
>
> eg.
> I have 3 projects on one virtual machine1, so I created group machine 
> which consists of 3 subelements (projects), ProjectA, ProjectB and ProjectC
>
> [Machine1]
> ProjectA ansible_ssh_host=machine1_fqdn
> ProjectB ansible_ssh_host=machine1_fqdn
> ProjectC ansible_ssh_host=machine1_fqdn
>
> So when I want to run some playbook I choose some (or all) of this 
> projects.
>
> But, my question is, is it possible to split ProjectA inventory file in 
> multiple inventory files...
> Somehow include in it every *.yml  file in some specific folder
>
> eg. 
> ProjectA *inventory *consists of every *.yml file in ProjectA *folder*
> So my hosts_vars would be:
>
> ProjectA - file 
> ProjectA - folder
> ProjectB - file 
> ProjectB - folder
> ProjectC - file
> ProjectC - folder
>
>
> Thanks a lot!
>

-- 
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/1a23884b-861f-4ee0-a851-33690e9f1e35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] conditional query

2017-03-03 Thread Kai Stian Olstad

On 03. mars 2017 10:32, jb795...@gmail.com wrote:

- debug:
msg: "test: {{ test.stdout }}"

- name: interface e01
  ignore_errors: yes
  eos_config:
host: arista
username: admin
password: ccc
authorize: yes
lines:
  - switchport access vlan 200
  - no shutdown
parents:
  - interface Ethernet1
  when: '"200" in test'


You need to use "test.stdout" as you did in the debug task.

--
Kai Stian Olstad

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


[ansible-project] Ask for a new password for every host using --ask-pass

2017-03-03 Thread Dennis Klein
Hello,

i need to add my ssh key first to be able to connect using it.

I made a simple playbook for it:

- hosts: all
  tasks:
- name: add admin ssh keys
  authorized_key: user=root key={{ ssh_key[item] }} state=present
  with_items:
- user1
- user2
- user3

I'm only asked once for a password, but all servershave different passwords.

Why don't asks Ansible for a password every time the login via key don't 
works?

-- 
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/0c187746-53fd-4270-8846-29ea68330e0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Split inventory in multiple .yml files?

2017-03-03 Thread vu001
Hi,

is it possible to split inventory in multiple files...

eg.
I have 3 projects on one virtual machine1, so I created group machine which 
consists of 3 subelements (projects), ProjectA, ProjectB and ProjectC

[Machine1]
ProjectA ansible_ssh_host=machine1_fqdn
ProjectB ansible_ssh_host=machine1_fqdn
ProjectC ansible_ssh_host=machine1_fqdn

So when I want to run some playbook I choose some (or all) of this projects.

But, my question is, is it possible to split ProjectA inventory file in 
multiple inventory files...
Somehow include in it every *.yml  file in some specific folder

eg. 
ProjectA *inventory *consists of every *.yml file in ProjectA *folder*
So my hosts_vars would be:

ProjectA - file 
ProjectA - folder
ProjectB - file 
ProjectB - folder
ProjectC - file
ProjectC - folder


Thanks a lot!

-- 
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/f1e0368e-2e62-4cf0-90b5-72da3575e812%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] conditional query

2017-03-03 Thread jb795333
Hello,

I am trying to enforce a conditional match to check if a VLAN is configured 
on a switch before applying changes

I can see that the variable is being recorded, but the match against it 
always results in the skipping of the task 'interface e01' even though the 
vlan number is present.


PLAY [arista] 
**


TASK [check VLAN] 
**

ok: [arista]


TASK [debug] 
***

ok: [arista] => {

"msg": "test: [u'VLAN  Name Status
Ports\\n-  - 
---\\n1 default  
activeEt2, Et3\\n100   VLAN0100 active
Et1\\n200   VLAN0200 active   \\n']"

}


TASK [interface e01] 
***

skipping: [arista]



playbook file:


---


- hosts: arista

  gather_facts: no

  connection: local

  strategy: free

  tasks:

- name: check VLAN

  ignore_errors: yes

  eos_command:

host: arista

username: admin

password: ccc

commands:

  - show vlan

  register: test

- debug:

msg: "test: {{ test.stdout }}"

- name: interface e01

  ignore_errors: yes

  eos_config:

host: arista

username: admin

password: ccc

authorize: yes 

lines: 

  - switchport access vlan 200

  - no shutdown

parents: 

  - interface Ethernet1

  when: '"200" in test'

-- 
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/327a33bd-c47e-4c23-835a-4674b0c987de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible-galaxy requirements.yml meta-dependencies.

2017-03-03 Thread Leigh Hayward
Hi all,

I have a quick question regarding the install -r requirements.yml 
functionality in ansible-galaxy.

I have role A which has a requirements.yml file which defines role B as a 
requirement. Role B in turn has a requirements.yml file which states role C 
is required.

If i use ansible-galaxy install -r requirements.yml in Role A will it 
install Role C?

Best Regards,
Leigh Hayward

-- 
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/b5d04040-df1c-494f-a36c-87ae41cc7a8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible and Jenkins integration

2017-03-03 Thread vu001
Thank you Ted, this is also useful, not for this particular purpose, but 
useful...

Dana četvrtak, 2. ožujka 2017. u 19:49:20 UTC+1, korisnik Ted Zlatanov 
napisao je:
>
> On Thu, 2 Mar 2017 01:27:54 -0800 (PST) ishan jain  > wrote: 
>
> ij> I would suggest that you add server2 as a slave in your Jenkins. 
> Create a 
> ij> Jenkins job, configure it to run on this slave and specify the Ansible 
> ij> commands in the build step just like you execute any other shell 
> command. 
>
> Also note that an Ansible playbook can be turned into a shell script 
> easily. 
>
> ``` 
> #!/usr/bin/ansible-playbook 
>
> - hosts: localhost 
>   tasks: 
> - debug: var=item 
>   with_items: "{{ [ 1, 2, 3 ] }}" 
> ``` 
>
> Ted 
>
>

-- 
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/896a0fbd-7a05-497b-94c9-53f9a0b48f21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Ansible copy file on remote machines on different location.

2017-03-03 Thread niraj pandey
I tried this but it copying the file on both the location on both the 
machines.

On Friday, March 3, 2017 at 3:03:04 PM UTC+5:30, niraj pandey wrote:
>
>
>
> down votefavorite 
> 
>
> How can I copy a file from machine A to machine B and machine C on 
> different location. ie:
>
> On machine A I have file abc and I want to copy it on the /tmp area of 
> machine B and /opt area of  machine C.
>
>
> I tried this so far:
>
>
> *My inventory file:*
>
>
> [webserver]
>
> machine-B dst=/tmp
>
> machine-C dst=/opt
>
>
> *Playbook:*
>
>
> - hosts: webserver
>
>   tasks:
>
> - name: Transfer file from ServerA to ServerB
>
>   synchronize:
>
> src: /home/niraj/ansible_testing
>
> dest: "{{ hostvars[item]['dst'] }}"
>
>   with_items: "{{ groups['webserver'] }}"
>
> #dest: /home/niraj
>
> #mode: pull
>
>   delegate_to: machine-A
>

-- 
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/9edabaf2-fe96-45d8-8549-cfe158e76b81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible copy file on remote machines on different location.

2017-03-03 Thread niraj pandey


down votefavorite 


How can I copy a file from machine A to machine B and machine C on 
different location. ie:

On machine A I have file abc and I want to copy it on the /tmp area of 
machine B and /opt area of  machine C.


I tried this so far:


*My inventory file:*


[webserver]

machine-B dst=/tmp

machine-C dst=/opt


*Playbook:*


- hosts: webserver

  tasks:

- name: Transfer file from ServerA to ServerB

  synchronize:

src: /home/niraj/ansible_testing

dest: "{{ hostvars[item]['dst'] }}"

  with_items: "{{ groups['webserver'] }}"

#dest: /home/niraj

#mode: pull

  delegate_to: machine-A

-- 
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/2e7572ed-986d-4318-8198-d10ba38c1e6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] template module on top of symlink always returns "changed"

2017-03-03 Thread Ioannis Cherouvim
Hello

My playbook contains:
- name: configure mysql
  template: src=my.cnf.j2 dest=/etc/mysql/my.cnf
  notify: 
  - restart mysql

In ubuntu 14 /etc/mysql/my.cnf is an actual file.
In ubuntu 16 /etc/mysql/my.cnf is a symlink to /etc/alternatives/my.cnf.

When it's a symlink, the template module always outputs a "changed", even 
if the actual contents are exactly the same, thus mysql is always restarted.

Is there a way to configure template in a way to not return "changed" when 
the actual target is behind a symlink?

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/07f22c66-bf64-4cb0-8c3b-02ae7a3d7845%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Showing Syntax error in a module

2017-03-03 Thread nexio . global
It is working now. Thank you very much for helping me. :)

-- 
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/c8227538-5f2a-402a-9ed8-4a54a3a26728%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Shouldn’t --user on command line overwrite ansible_user?

2017-03-03 Thread Kai Stian Olstad

Hi

In the host_var file for the server I have ansible_user set like this.

$ cat host_vars/u1.yml
---
ansible_user: ansible


Sometimes I would like to use an another user for some ad hoc commands, 
but -u/--user is ignored


$ ansible u1 -a id - -u user1
Loaded callback minimal of type stdout, v2.0
<192.168.122.106> ESTABLISH SSH CONNECTION FOR USER: ansible


Shouldn’t -u/--user overwrite ansible_user variable?

Or is -e/--extra-vars the only way?

$ ansible u1 -a id - -e ansible_user=user1
Loaded callback minimal of type stdout, v2.0
<192.168.122.106> ESTABLISH SSH CONNECTION FOR USER: user1


--
Kai Stian Olstad

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


Re: [ansible-project] Re: Showing Syntax error in a module

2017-03-03 Thread Kai Stian Olstad

On 03.03.2017 06:13, nexio.glo...@gmail.com wrote:
Thank you for helping me I tried that solution but now it is showing 
syntax

error on different module

The offending line appears to be:


- name: Update default Apache site
^ here

Can you please check the whole script and tell me all the mistakes I 
have

been done in this. It would be very thankful


I did an corrected them all except for sudo: that should be become:, but 
sudo will work, you just get a deprecation message.
You have probably introduced new ones, so without the new code it's 
difficult to see what's wrong now.

But your code should look like this now.

---
- name: Download WordPress
  get_url:
url=https://wordpress.org/latest.tar.gz
dest=/tmp/wordpress.tar.gz
validate_certs=no

- name: Extract WordPress
  unarchive:
src=skins/larry/tmp/wordpress.tar.gz
dest=/var/www/
copy=no
  become: yes

- name: Update default Apache site
  become: yes
  lineinfile:
dest=/etc/apache2/sites-enabled/000-default.conf
regexp="(.)+DocumentRoot /var/www/html"
line="DocumentRoot /var/www/wordpress"
  notify:
- restart apache

- name: Copy sample config file
  command: mv /var/www/wordpress/wp-config-sample.php 
/var/www/wordpress/wp-config.php 
creates=/var/www/wordpress/wp-config.php

  become: yes

- name: Update WordPress config file
  lineinfile:
dest=/var/www/wordpress/wp-config.php
regexp="{{ item.regexp }}"
line="{{ item.line }}"
  with_items:
- {'regexp': "define\\('DB_NAME', '(.)+'\\);", 'line': 
"define('DB_NAME', '{{wp_mysql_db}}');"}
- {'regexp': "define\\('DB_USER', '(.)+'\\);", 'line': 
"define('DB_USER', '{{wp_mysql_user}}');"}
- {'regexp': "define\\('DB_PASSWORD', '(.)+'\\);", 'line': 
"define('DB_PASSWORD', '{{wp_mysql_password}}');"}

  become: yes


--
Kai Stian Olstad

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