Re: [ansible-project] Re: Adding new route to cisco router Jinja2 template

2017-05-18 Thread Rodrigo
Hello All,

I believe you can use this example to add more routes.

- name: load new acl into device
  ios_config:
lines:
  - 10 permit ip host 1.1.1.1 any log
  - 20 permit ip host 2.2.2.2 any log
  - 30 permit ip host 3.3.3.3 any log
  - 40 permit ip host 4.4.4.4 any log
  - 50 permit ip host 5.5.5.5 any log
parents: ip access-list extended test
before: no ip access-list extended test
match: exact

Kind Regards,

Rodrigo


2017-05-18 21:40 GMT-03:00 naeem dhby :

> Thanks Cody for your reply
>
> so you mean i can create my jinja2 template for routing and just use
> ios_config with src parameter to merge my template to my router? is that
> will create new line to my configuration, i know "before" and "after"
> parameters exist in ios_config but can i use that parameters with in src
> parameter and template file?
> For example i have 3 static route already in my router, can i add only 2
> more route to router with ios_config by using jinja2 template without
> changing other configs or reuse old config file?
>
> Thanks again.
>
>
> On Thursday, May 18, 2017 at 5:26:30 PM UTC-7, Cody John wrote:
>>
>> Any reason not to use ios_config module along with the src parameter
>> pointing to your jinja template?
>>
>> On Wednesday, May 10, 2017 at 10:37:48 AM UTC-7, naeem dhby wrote:
>>>
>>> Hi,
>>>
>>> i have configured Cisco router and i want to setup automation to only
>>> add new route to router, and do not change any old configuration already
>>> exist in router
>>> is it possible to use Jinja2 template for this case, i'm new in Ansible
>>> and also just started working on jinja2 templates, in examples i reviewed
>>> look like i need to create Jinja2 template file for each part of
>>> configuration and by using "include" i'll merge all of them in one main
>>> file, and by using group_vars i'll set variables, and result will be one
>>> config file you can import to network device, but i didn't see any example
>>> to just add new line to existing configuration in network device.
>>>
>>> i know i can do this by using ios_command module, but just want to know
>>> if it is possible to do this with Jinja2 template.
>>>
>>> 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/0fc4a445-2a68-4d99-be09-4c32d7823cbf%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Att,
Rodrigo Rovere
www.ciscoredes.com.br
Twitter: @rar_21

-- 
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/CAC1_Japf9oajPzcg2aO%2BCWCw8c-K7sKSwSvWTrkXxXeYPLhgJw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Plays taking way to long to run...

2017-05-18 Thread Willard Dennis
Tested my role on an Ubuntu host running Ansible 2.3.0.0, same problem... 
So it wasn't just my Macbook.

On a hunch, edited /etc/ssh/sshd_config on the target system, put in 
"UseDNS no", and restarted sshd - reran on my Macbook, problem solved!

Thus confirming the age-old sysadmin haiku truth:

It's not DNS
There's no way it is DNS
It was DNS



On Thursday, May 18, 2017 at 3:58:51 PM UTC-4, Willard Dennis wrote:
>
> Seeing a weird problem with running playbooks from my Macbook, which is 
> running OS X 10.10.5... The plays are taking a very long time to run:
>
>
> Wills-MacBook-Air:ist-ansible will$ ansible-playbook --version
> ansible-playbook 2.3.0.0
>   config file = /Users/will/Downloads/my-ansible/ansible.cfg
>   configured module search path = Default w/o overrides
>   python version = 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 
> Compatible Apple LLVM 6.0 (clang-600.0.39)]
> Wills-MacBook-Air:ist-ansible will$ ansible-playbook -i prod -u root -k 
> run_role.yml -e "ROLE=common" -e "TARGET=my-server"
> SSH password:
>
>
> PLAY [my-server] 
> 
>
>
> TASK [Gathering Facts] 
> ***
> Thursday 18 May 2017  15:46:25 -0400 (0:00:00.119)   0:00:00.119 
> **
> ok: [my-server]
>
>
> TASK [common : RHELFAM | Ensure python-selinux is installed] 
> *
> Thursday 18 May 2017  15:48:58 -0400 (0:02:33.523)   0:02:33.642 
> **
>
>   [...]
>
> TASK [common : DEBFAM | Ensure AppArmor is turned off] 
> ***
> Thursday 18 May 2017  15:51:33 -0400 (0:02:33.419)   0:05:08.434 
> **
> ok: [admin12-10]
>
> TASK [common : DEBFAM | Ensure UFW is turned off] 
> 
> Thursday 18 May 2017  15:54:06 -0400 (0:02:33.385)   0:07:41.819 
> **
> ok: [admin12-10]
>
>
> As you may notice, the profiling of the plays that do stuff (as above) all 
> are taking 2:33... Anyone know the problem offhand (DNS?)
>
> Thanks,
> Will
>

-- 
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/c8cb12a3-927c-48d0-8f5b-3a4778eab89b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Is there any better way to find if a list of packes installed

2017-05-18 Thread Kiran Kumar
I just figured it out. If a package is not installed it would return fail 
and if all packages are installed it would return pass

  vars:
pkg: '0'
  tasks:
  - name: Check if packages are installed
command: rpm -q {{ item }}
with_items:
   - kernel
   - perf
register: rpm_check
failed_when: rpm_check.rc > 1

  - set_fact: pkg=1
when: item.rc == 1
with_items: "{{ rpm_check.results }}"
failed_when: pkg != '1'


  - set_fact: pkg_test=fail
when: pkg == '1'

  - set_fact: pkg_test=pass
when: pkg == '0'
  - debug: var=pkg_test


On Tuesday, May 9, 2017 at 3:28:00 PM UTC-7, Dick Davies wrote:
>
> You'd probably get what you want from an Ansible dummy run then, just 
> pass '--check' to ansible-playbook. 
>
> On 9 May 2017 at 20:09, Kiran Kumar  
> wrote: 
> > Hi  Tai Kedzierski , 
> > 
> > Thanks for your reply. Am intending only to validate if packages are 
> > installed or not and am not installing any packages as part of other 
> task. 
> > Am building a validation playbook that would check few things and 
> packages 
> > is one of them. 
> > 
> > On Tuesday, May 9, 2017 at 8:00:51 AM UTC-7, Tai Kedzierski wrote: 
> >> 
> >> Hello Kiran 
> >> 
> >> As I understand it, the way Ansible is intended to be used, you should 
> not 
> >> need this ? 
> >> 
> >> If you write a task specifying packageX , and specify a state of 
> >> installed/uninstalled/latest then that state is enforced... no prior 
> need to 
> >> check. 
> >> 
> >> If you want then to perform an action only if a package is present, it 
> >> begs the question as to why you do not know already - since you are 
> using 
> >> Ansible to maintain the server in a known state ? 
> >> 
> >> Could you describe what it is you are trying to enable by doing a 
> package 
> >> check ? 
> >> 
> >> 
> >> On Tuesday, 9 May 2017 04:05:30 UTC+1, Kiran Kumar wrote: 
> >>> 
> >>> Hi Friends, 
> >>> 
> >>> Is there any better way to find if a list of packes is installed or 
> not 
> >>> on a linux machine. It needs to return something may be a single 
> variable to 
> >>> decide if all packages are installed or any one of them missed. 
> >>> 
> >>> Assuming i need to check if below packages are installed or not and it 
> >>> should return true if all the listed packages are installed and false 
> if 
> >>> anything is missed. 
> >>> 
> >>>   - name: Check if packages are installed 
> >>> command: rpm -q {{ item }} 
> >>> with_items: 
> >>>- kernel 
> >>>- perf 
> >>> 
> >>>- perl 
> >>> 
> >>>- python 
> >>> 
> >>> 
> > 
> > -- 
> > 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/16477645-14b2-4a5b-b8cc-3772b1a1f108%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/7dee523d-89ea-4851-bb1d-dadfe80c59cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Adding new route to cisco router Jinja2 template

2017-05-18 Thread naeem dhby
Thanks Cody for your reply

so you mean i can create my jinja2 template for routing and just use 
ios_config with src parameter to merge my template to my router? is that 
will create new line to my configuration, i know "before" and "after" 
parameters exist in ios_config but can i use that parameters with in src 
parameter and template file?
For example i have 3 static route already in my router, can i add only 2 
more route to router with ios_config by using jinja2 template without 
changing other configs or reuse old config file?

Thanks again.


On Thursday, May 18, 2017 at 5:26:30 PM UTC-7, Cody John wrote:
>
> Any reason not to use ios_config module along with the src parameter 
> pointing to your jinja template?
>
> On Wednesday, May 10, 2017 at 10:37:48 AM UTC-7, naeem dhby wrote:
>>
>> Hi,
>>
>> i have configured Cisco router and i want to setup automation to only add 
>> new route to router, and do not change any old configuration already exist 
>> in router
>> is it possible to use Jinja2 template for this case, i'm new in Ansible 
>> and also just started working on jinja2 templates, in examples i reviewed 
>> look like i need to create Jinja2 template file for each part of 
>> configuration and by using "include" i'll merge all of them in one main 
>> file, and by using group_vars i'll set variables, and result will be one 
>> config file you can import to network device, but i didn't see any example 
>> to just add new line to existing configuration in network device.
>>
>> i know i can do this by using ios_command module, but just want to know 
>> if it is possible to do this with Jinja2 template.
>>
>> 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/0fc4a445-2a68-4d99-be09-4c32d7823cbf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Adding new route to cisco router Jinja2 template

2017-05-18 Thread Cody John
Any reason not to use ios_config module along with the src parameter 
pointing to your jinja template?

On Wednesday, May 10, 2017 at 10:37:48 AM UTC-7, naeem dhby wrote:
>
> Hi,
>
> i have configured Cisco router and i want to setup automation to only add 
> new route to router, and do not change any old configuration already exist 
> in router
> is it possible to use Jinja2 template for this case, i'm new in Ansible 
> and also just started working on jinja2 templates, in examples i reviewed 
> look like i need to create Jinja2 template file for each part of 
> configuration and by using "include" i'll merge all of them in one main 
> file, and by using group_vars i'll set variables, and result will be one 
> config file you can import to network device, but i didn't see any example 
> to just add new line to existing configuration in network device.
>
> i know i can do this by using ios_command module, but just want to know if 
> it is possible to do this with Jinja2 template.
>
> 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/1a67db4f-3c35-4116-b1e2-4d8c45d93a8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Tower and "Check Mode"?

2017-05-18 Thread Cody John
Is there any way to run playbooks in Tower using the "--check" flag?   This 
is a pretty critical feature and I'm surprised that it either doesn't exist 
or I am just missing it (entirely possible).

-- 
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/3b8a238d-8986-42ac-91b9-a74a7e116a2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Getting paths right in Windows

2017-05-18 Thread Trond Hindenes
Thanks, will check those out!

On Wednesday, May 17, 2017 at 4:37:51 PM UTC+2, J Hawkesworth wrote:
>
> Sorry, trying to help too early in the morning!.  I had missed the single 
> \ in the path.
>
> Not tried but have noticed jinja2 has a 'tojson' filter that might help 
> (new in 2.9 so maybe 'pip install Jinja2 --upgrade' might be needed, 
> although I think installing ansible 2.3 from pip will drag this in, if I 
> recall.  Also there's a 'safe' filter which might stop automatic escaping 
> from happening.
>
> http://jinja.pocoo.org/docs/2.9/templates/
>
> Hope this helps,
>
> Jon
>
>
>
> On Tuesday, May 16, 2017 at 11:28:50 PM UTC+1, Trond Hindenes wrote:
>>
>> To me it looks like you're getting the same as me (I had to zoom in my 
>> screen to be sure :-) ) - contents of templated json contains a single 
>> backslash after the drive letter (which is not valid)
>>
>> These Json files might be read by applications that are not able to parse 
>> "forward-slashed" paths, so although Powershell would be fine with that 
>> format, it's not always an option to use them in json files (so essentially 
>> this is not as much a problem with the Powershell-based Ansible modules as 
>> the fact that its hard to inject valid json into json files).
>>
>> I'll look into the win_* filter - I haven't spent much time with those (I 
>> kinda wish they were a bit better documented)
>>
>> I'll keep this thread updated with my findings.
>>
>>
>> On Monday, May 15, 2017 at 9:38:10 AM UTC+2, J Hawkesworth wrote:
>>>
>>> I'm not seeing the behaviour you describe - maybe my playbook isn't 
>>> doing the same things as yours though?
>>>
>>> # playbook:
>>>
>>> $ cat trondpath.yml
>>> ---
>>> - name: test trond observed strange path behaviour
>>>   hosts: TENSY
>>>   vars:
>>> logfiles_path: "F:\\Logs"
>>>   connection: winrm
>>>   gather_facts: false
>>>   tasks:
>>> - name: create json file from template
>>>   win_template:
>>> src: template.json
>>> dest: templated.json
>>>
>>> # template file:
>>>
>>> $ cat template.json
>>> {
>>>"FilePath":"{{ logfiles_path }}\\*",
>>>"Stuff": otherstuff
>>> }
>>>
>>> contents of templated.json: 
>>>
>>> {
>>>"FilePath":"F:\Logs\\*",
>>>"Stuff": otherstuff
>>> }
>>>
>>> I'm using ansible 2.3 (Win 10 WSL / Ubuntu )
>>>
>>> Dag is right though we should document this - I've put it on my list.  
>>> Better still would be to document and make some kind of automated test like 
>>> the integration tests for modules.  There are probably quite a few possible 
>>> combinations to work through - absolute and relative paths, paths to files, 
>>> paths to dirs and then all the places you can define them - hostvars, group 
>>> vars, included vars, in-playbook vars, hardcoded in playbooks, hardcoded in 
>>> templates, and inside {{ }} 
>>>
>>> For info there are filters for windows style paths.
>>> See http://docs.ansible.com/ansible/playbooks_filters.html 
>>> win_basename, win_splitdrive and win_dirname are the windows-specific 
>>> ones.
>>>
>>> Another trick you can use is to use unix style path separators - 
>>> powershell is *usually* ok with this but obviously it depends on what is 
>>> happening in your powershell code - if you pass a path to a native windows 
>>> binary in your powershell (or ansible module code) obviously this isn't 
>>> going to work.
>>>
>>> Hope this helps,
>>>
>>> Jon
>>>
>>>
>>> On Tuesday, May 9, 2017 at 1:30:11 PM UTC+1, Dag Wieers wrote:

 On Tue, 9 May 2017, Trond Hindenes wrote: 

 > Hope someone can help me shed some light on this one: 
 > 
 > Since Ansible is python-based, us Windows dudes generally have to 
 stick an 
 > extra backslash anywhere we're manipulating Windows paths. However, 
 in some 
 > cases this causes unexpected behavior. In my current case, I need to 
 inject 
 > a file path into a json file on a Windows box. This path is defined 
 as such 
 > in an Ansible var: 
 > logfiles_path: "F:\\Logs" 
 > 
 > In my template json file I add to this path, using the following: 
 > 
 > "FilePath":"{{ logfiles_path }}\\*", 
 > 
 > The goal is to populate the target json with 
 > "F:\\Logs\\*" 
 > 
 > However, since Ansible kicks in the resulting file contains: 
 > "F:\Logfiles\\*" 
 > 
 > In other words, Ansible "normalises" the part of the path that comes 
 from a 
 > variable, but not the part "outside" of the variable. 
 > 
 > I'm not sure what the best way to solve this is - it would be great 
 to have 
 > some builtin filters that would do "json normalization" of a string 
 or 
 > something. How are people solving this? 

 I stick to using single backslashes (and not quotes) in YAML, or single 
 quotes if you have to. And single quotes everywhere else. I never had 
 the 
 need to use double-backslashes. 

 I remember one issues (with YAML?), which 

[ansible-project] Re: Ansible support for Windows Server 2016

2017-05-18 Thread Trond Hindenes
Timothy, I'm not quite getting what you're trying to accomplish. Let's just 
get terminology out of the way first:
1. An ansible environment consists of a control node, and on or multiple 
target nodes. The control node is where you "run ansible", and it reaches 
out to the target nodes (for target nodes running Windows, this typically 
happens using WinRM)
2. Ansible supports windows-based target nodes, but not control nodes. You 
still need a Linux node as a control node, although many are using WSL for 
dev/test.
3. WSL is currently _not_ available on Windows 2016, only Windows 10. 
Microsoft has announced plans for WSL on Server tho, but it's kinda not 
that relevant in this context (imho).
4. As far as support for Windows 2016 goes, it should be fully supported as 
an Ansible target node

If you could explain a bit more I'm sure theres a bunch of people here who 
are ready to help

-Trond


On Thursday, May 18, 2017 at 10:57:21 PM UTC+2, Jordan Borean wrote:
>
> Hey
>
> At home and for dev work I use Windows 10 and WSL to run Ansible and that 
> works pretty well for me. While this works this method is not supported by 
> Ansible at all and if you come across issues you will usually be asked to 
> replicate it on and actual unix box.
>
> The other issue with this is WSL,  only works on Windows 10/Server 2016 
> and newer. This is also only supported by Microsoft for development 
> purposes and is not designed to run in a production setting. So if you 
> really want to run Ansible on Windows your 2 choices are to use WSL for 
> newer OS' or use Cygwin. Both do work but your probably setting yourself up 
> for failure if this is for non development work.
>
> For getting Ansible to talk to a Windows box and executing commands you 
> can do this with Server 2008/Vista onwards as long as some of the earlier 
> versions have powershell 3.0 installed. There are scripts to upgrade 
> powershell available if you have an older version. Ansible uses the WinRM 
> protocol to communicate to the Windows box over HTTP/S which is definitely 
> usable but a bit slower than SSH and at copying files between hosts.
>
> Hopefully this answers your questions.
>
>

-- 
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/fb98341a-3c9b-46ae-9ae9-a9eedeae090e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] using eval in debugger

2017-05-18 Thread horos22
all, 

we are using the ansible debugger and running into some issues - 

basically, we are hitting a place where a string is being eval'ed to get 
another string, ie:

var: "{{ another_var | user_filter | user_filter2 }}"

and it is dying because user_filter is hitting an error on 'another_var' as 
input.

therefore, we'd like to see what's going on with user_filter here, and 
would like to reproduce with eval'ing the relevant string.

for example, we can do:

(debug) p "{{ another_var | user_filter | user_filter2 }}"

but that doesn't run user_filter or user_filter2.

so - how can you get the debugger to eval any given ansible statement?

thanks much for any info..


-- 
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/0c2d51d8-6821-4e69-9de1-c9e9e292479c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using modules offline

2017-05-18 Thread Andrew Latham
Roles from https://galaxy.ansible.com/ maybe?

You can down load and side load them if it is roles or modules.

On Tue, May 16, 2017 at 3:03 AM, Avishay Niv  wrote:

> hello
>
> We installed ansible on a stand alone network that is not connected to the
> internet. the only way to insert data  (files) to that network is offline.
>
> how can we use ansible modules in this case ? is there an option to
> downloadonly from ansible galaxy ? is there another way to install modules
> offline (like copying files from w connected environment ?
>
> Thanks
>
> Avishay
>
> --
> 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/6a93b9ac-8675-4d79-9693-74b9856e8fff%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
- Andrew "lathama" Latham lath...@gmail.com http://lathama.org -

-- 
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%2Bqj4S9ZbMf7GhHETCUtebrZDVFCX8X%2B_6h%3Dy6f63y01HLfyzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Using modules offline

2017-05-18 Thread Brian Coca
Not sure what you are asking, modules are normally shipped with
Ansible,  you can use your own custom ones with library/ dir adjacent
to play or in role. Any method of copying the module should work,
Ansible only cares that it is there.


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


[ansible-project] Ansible support for Windows Server 2016

2017-05-18 Thread Jordan Borean
Hey

At home and for dev work I use Windows 10 and WSL to run Ansible and that works 
pretty well for me. While this works this method is not supported by Ansible at 
all and if you come across issues you will usually be asked to replicate it on 
and actual unix box.

The other issue with this is WSL,  only works on Windows 10/Server 2016 and 
newer. This is also only supported by Microsoft for development purposes and is 
not designed to run in a production setting. So if you really want to run 
Ansible on Windows your 2 choices are to use WSL for newer OS' or use Cygwin. 
Both do work but your probably setting yourself up for failure if this is for 
non development work.

For getting Ansible to talk to a Windows box and executing commands you can do 
this with Server 2008/Vista onwards as long as some of the earlier versions 
have powershell 3.0 installed. There are scripts to upgrade powershell 
available if you have an older version. Ansible uses the WinRM protocol to 
communicate to the Windows box over HTTP/S which is definitely usable but a bit 
slower than SSH and at copying files between hosts.

Hopefully this answers your questions.

-- 
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/0d9551ac-371b-45b2-a515-1b4c3a3bb6e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansilbe Usage

2017-05-18 Thread Kai Stian Olstad

On 18. mai 2017 10:32, Jae Kim wrote:

I tried running the following sample source code from
 http://stackoverflow.com/questions/39293527/ansible-uri-module-with-form
--
-  uri:
url: http://mydomain.bla/api/v1/login_check
method: POST
body: "access_key={{ api_user }}_key={{ api_pass }}"
return_content: yes
register: token_response
environment:
http_proxy: ''

-  debug: var=token_response.content


This is not a playbook, it's two tasks.

I highly recommend reading the documentation to get a basic knowledge of 
Ansible.


A great place to start is this one.
https://docs.ansible.com/ansible/playbooks_intro.html


--
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/f956e7e4-92e3-72e3-3b3d-01da62d1960e%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] issue in counting no. of host in inventory ?

2017-05-18 Thread Brian Coca
or just run on localhost

- name: Host Count In Inventory
  hosts: localhost
  gather_facts: no
  tasks:

- name: Host Count
  debug:
 msg: "Host Count: {{ groups['ios'] | length }}"


alternatively:

ansible ios --list-hosts|head -n 1
--
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/CACVha7fvOxHhSeY5%3D7ksgs2HUaJGQmuSiDLmU%3DX5TvBp%2BmQREQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Plays taking way to long to run...

2017-05-18 Thread Willard Dennis
Seeing a weird problem with running playbooks from my Macbook, which is 
running OS X 10.10.5... The plays are taking a very long time to run:


Wills-MacBook-Air:ist-ansible will$ ansible-playbook --version
ansible-playbook 2.3.0.0
  config file = /Users/will/Downloads/my-ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 
Compatible Apple LLVM 6.0 (clang-600.0.39)]
Wills-MacBook-Air:ist-ansible will$ ansible-playbook -i prod -u root -k 
run_role.yml -e "ROLE=common" -e "TARGET=my-server"
SSH password:


PLAY [my-server] 



TASK [Gathering Facts] 
***
Thursday 18 May 2017  15:46:25 -0400 (0:00:00.119)   0:00:00.119 
**
ok: [my-server]


TASK [common : RHELFAM | Ensure python-selinux is installed] 
*
Thursday 18 May 2017  15:48:58 -0400 (0:02:33.523)   0:02:33.642 
**

  [...]

TASK [common : DEBFAM | Ensure AppArmor is turned off] 
***
Thursday 18 May 2017  15:51:33 -0400 (0:02:33.419)   0:05:08.434 
**
ok: [admin12-10]

TASK [common : DEBFAM | Ensure UFW is turned off] 

Thursday 18 May 2017  15:54:06 -0400 (0:02:33.385)   0:07:41.819 
**
ok: [admin12-10]


As you may notice, the profiling of the plays that do stuff (as above) all 
are taking 2:33... Anyone know the problem offhand (DNS?)

Thanks,
Will

-- 
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/d9ba0b18-d180-454d-a9c1-665bb10f7852%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] issue in counting no. of host in inventory ?

2017-05-18 Thread Gurminder Singh
Thank You Kai,

I corrected that and made some more changes to my playbook which eventually 
worked. We can also use 

debug:
   msg: "Host count: {{ ansible_play_hosts | length }}"

- _ansible_play_hosts_ is an Ansible-defined variable which is a list of 
the hosts in the current play, i.e. what the above pattern matches

- **run_once** ensures we don't run the debug command for every single host 
in the list, which would be a big waste of time


---
- name: Host Count In Inventory
  hosts: ios
  gather_facts: no
  connection: local

  tasks:

- name: Host Count
  run_once: true
  debug:
 msg: "Host Count: {{ groups['ios'] | length }}"


On Wednesday, 17 May 2017 23:00:51 UTC+5:30, Kai Stian Olstad wrote:
>
> On 16. mai 2017 20:23, Gurminder Singh wrote: 
> > I wrote a playbook to count number of host in inventory, can someone 
> look 
> > or suggest better way of achieving this task, this play gives error in 
> > compling stage itself, however when I check the syntax in 
> > http://codebeautify.org/yaml-validator this shows it is valid. 
> > 
> > Please add your comment and suggestions ? 
> > 
> > *My Playbook* 
> > --- 
> > - name: Host Entry in Inventory 
> >   hosts: "ios_switches" 
> >   gather_facts: no 
> >   connection: local 
> > 
> >   task: 
> >   - name: Host Count 
> >vars: 
> >   num_hosts: "{{ groups['ios_switches'] | length }}" 
> > 
> > *Error I get after running playbook* 
> > 
> > ERROR! 'task' is not a valid attribute for a Play 
>
> It tasks and not 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/0809f0b1-183c-4450-b690-26ac4425ab80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2017-05-18 Thread americanoz
Hi all here is the solution to this issue I really hope this helps the next 
poor person who has to bang there head for weeks trying to figure this one 
out.

---
   - hosts: all
 tasks:
 - name: Create Snapshot
   vmware_guest_snapshot:
 datacenter: Development
 hostname: virtual server name
 folder: /DVT-UX
 username: John doe
 password: xx
 name: "{{ ansible_hostname }}"
 uuid: "{{ ansible_product_uuid | lower }}"
 state: present
 snapshot_name: test1
 description: patch_snapshot
 validate_certs: false
   delegate_to: localhost
This does work I have confirmed it. 
I really do want to thank Kai for all his help on this I really owe you one 
sir.. 
I will update this later with the final playbook we are trying to patch our 
servers using ansible. if physical patch if virtual take snapshot then 
patch, reboot if needed.

Thanks.. 

On Thursday, May 18, 2017 at 11:12:28 AM UTC-4, Kai Stian Olstad wrote:
>
> On 18. mai 2017 15:11, ameri...@optonline.net  wrote: 
> > Hi Kai, 
> > 
> > Thank you for taking the time to review and reply. I thought the same 
> thing 
> > yesterday and ran through every option I could think of. the funny part 
> > about the module is it states in the documentation that UUID is not 
> > required but if I run it with out the UUID I get a different result. 
>
> Have you read this one? 
>
> "vmware_guest_snapshot don't find vm if not folder is specified" 
> https://github.com/ansible/ansible/issues/22644 
>
>
> -- 
> 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/e7758833-d0e1-4702-9dce-a141011a4410%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dependency check between roles

2017-05-18 Thread Dick Davies
I'd skip the dependency mechanics and just explicitly apply both roles
in the play.

On 18 May 2017 at 13:21, Jose Luis Fernández Pérez  wrote:
> Hi all!
>
> I need to disallow a role from being executed when it is include more than
> once. The scenario is like this.
>
> Role A includes as a dependency Role B
> Role C includes as a dependency Role B
>
> I include role A and role C in a playbook
>
> The result is.
>
> B is run
> A is run
> B is run
> C is run
>
> Given that B is already executed I would like it not to be run again.
>
> Any idea? Im currently setting a fact in B and use a conditional include in
> its main.yml file but this is code smell IMHO.
>
> 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/24f27e6d-0d17-455b-9e4f-fb8b051a09f1%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/CAK5eLPTPHeF%3DjBGOiw8ANzd9kgGf7q-RX5Fg7%2BCBsLveA_JHTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2017-05-18 Thread americanoz
Thank you sir that is the exact issue I am having. I wish folks would be 
more forth coming with issues with the modules it would make things a 
little easier. 

I am trying to understand the folder structure of the VC as when I run the 
PB with folder I get back vm/foldername 

On Thursday, May 18, 2017 at 11:12:28 AM UTC-4, Kai Stian Olstad wrote:
>
> On 18. mai 2017 15:11, ameri...@optonline.net  wrote: 
> > Hi Kai, 
> > 
> > Thank you for taking the time to review and reply. I thought the same 
> thing 
> > yesterday and ran through every option I could think of. the funny part 
> > about the module is it states in the documentation that UUID is not 
> > required but if I run it with out the UUID I get a different result. 
>
> Have you read this one? 
>
> "vmware_guest_snapshot don't find vm if not folder is specified" 
> https://github.com/ansible/ansible/issues/22644 
>
>
> -- 
> 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/d2e6734f-90dc-4b4c-b8e2-ff25f4472dc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] single encrypted vault variable not working

2017-05-18 Thread Kai Stian Olstad

On 16. mai 2017 00:50, John Jolet wrote:

ERROR! Syntax Error while loading YAML.


The error appears to have been in 
'/home/Q2DC/jjolet/ansible-operations/configure/group_vars/nomad-servers-stg.yml':
 line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

q2docker_file: "q2docker1.2.1"
vault_token: !vault |
 ^ here


so according to that documentation:

you just have to be sure to add the !vault tag so both Ansible and YAML are 
aware of the need to decrypt.

i've installed ansible via yum:

rpm -qa|grep ansible
ansible-2.3.0.0-3.el7.noarch

was there something else that needed to be updated for the yaml parsing to 
succeed with the encrypted variable?


You get this error message if you don't provide a vault password.


--
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/0a37bc6a-ab5a-1cf1-b0ba-88e514864c61%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Cannot execute a command on remote machine

2017-05-18 Thread Lee Sigauke
Accidentally submitted this before I finished so just adding more details. 

shell: mix local.hex--force
  args:
  executable:  /usr/bin/env sh

On my remote machine when I print out my PATH, I get 
$PATH
-bash: 
/usr/lib/kerl/installs/19.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/vagrant/.local/bin:/home/vagrant/bin:
 
No such file or directory

if I do which mix, I get 

$ which mix
/usr/local/bin/mix


On Thursday, May 18, 2017 at 6:15:45 PM UTC+1, Lee Sigauke wrote:
>
> I have a role with the following task
>
> - name: Install Hex and Rebar
> become: true
> command: mix {{ item }} --force
> with_items:
> - local.hex
> - local.rebar
>
> When I run my tasks I get the following error
>
> TASK [mix_packages : Install Hex and Rebar] 
> *
> failed: [odds_history_service] (item=local.hex) => {"cmd": "mix local.hex 
> --force", "failed": true, "item": "local.hex", "msg": "[Errno 2] No such 
> file or directory", "rc": 2}
> failed: [odds_history_service] (item=local.rebar) => {"cmd": "mix 
> local.rebar --force", "failed": true, "item": "local.rebar", "msg": "[Errno 
> 2] No such file or directory", "rc": 2}
>
> I know that mix is installed on the remote machine, I can run one of these 
> commands on the remote machine without any issues but when I use ansible, 
> it fails. I have tried several different versions of this like 
>
> command: bash mix local.hex--force
>
> command: /usr/bin/env sh mix local.hex --force
>
> command:  mix local.hex--force
> args:
>   executable: /usr/bin/env sh
>
> shell: 
>
>
>
>
>

-- 
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/b7d22a64-d0da-4e21-b1e3-f5fe7eb3958a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Cannot execute a command on remote machine

2017-05-18 Thread Lee Sigauke
I have a role with the following task

- name: Install Hex and Rebar
become: true
command: mix {{ item }} --force
with_items:
- local.hex
- local.rebar

When I run my tasks I get the following error

TASK [mix_packages : Install Hex and Rebar] 
*
failed: [odds_history_service] (item=local.hex) => {"cmd": "mix local.hex 
--force", "failed": true, "item": "local.hex", "msg": "[Errno 2] No such 
file or directory", "rc": 2}
failed: [odds_history_service] (item=local.rebar) => {"cmd": "mix 
local.rebar --force", "failed": true, "item": "local.rebar", "msg": "[Errno 
2] No such file or directory", "rc": 2}

I know that mix is installed on the remote machine, I can run one of these 
commands on the remote machine without any issues but when I use ansible, 
it fails. I have tried several different versions of this like 

command: bash mix local.hex--force

command: /usr/bin/env sh mix local.hex --force

command:  mix local.hex--force
args:
  executable: /usr/bin/env sh

shell: 




-- 
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/5ca77eaf-27f7-4e8a-9544-77e2ad3391f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Number of nodes

2017-05-18 Thread Hải Nguyễn Duy
Does Ansible recommend the number of nodes when executing a Playbook is 
best? (examples: 100 nodes or smaller or bigger?)


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/98f2348b-01f9-415d-b293-4087222632de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] single encrypted vault variable not working

2017-05-18 Thread John Jolet
I'm running ansible 2.3.0.0,and attempting to use an inline encrypted 
variable per this documentation:
http://docs.ansible.com/ansible/playbooks_vault.html#running-a-playbook-with-vault

this structure:

mysecret: !vault |
  $ANSIBLE_VAULT;1.1;AES256
  
66386439653236336462626566653063336164663966303231363934653561363964363833313662
  
6431626536303530376336343832656537303632313433360a626438346336353331386135323734
  
62656361653630373231613662633962316233633936396165386439616533353965373339616234
  
3430613539666330390a31373632326565643236623660313963326365653937323833366536
  34623731376664623134383463316265643436343438623266623965636363326136


yields this error:

ERROR! Syntax Error while loading YAML.


The error appears to have been in 
'/home/Q2DC/jjolet/ansible-operations/configure/group_vars/nomad-servers-stg.yml':
 line 13, column 14, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

q2docker_file: "q2docker1.2.1"
vault_token: !vault |
 ^ here


so according to that documentation: 

you just have to be sure to add the !vault tag so both Ansible and YAML are 
aware of the need to decrypt.

i've installed ansible via yum:

rpm -qa|grep ansible
ansible-2.3.0.0-3.el7.noarch

was there something else that needed to be updated for the yaml parsing to 
succeed with the encrypted variable?

-- 
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/7d816fb6-ce28-4484-986b-85880645f678%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: lineinfile - simply replace a string

2017-05-18 Thread John Jolet
did you try  ( ?) or some such?

On Tuesday, May 16, 2017 at 12:17:29 AM UTC-5, AnsiNoob wrote:
>
> Hi
>
> Two things that I miss in Ansible when compared to shell scripting is easy 
> 'grep' and 'sed'. That was easy to do in shell!
>
> My case is very simple. I have a file with lot of lines (sample below) and 
> the line mentioned below comment has to be checked for its presence. 
>
> __
> someline
> my line
> {
> another line
> # Below line's presence needs to be checked
> another=myother
> }
> another line
> __
>
> Now, below line does not work as there are lot of spaces before 
> "another=myother".
>
> lineinfile:
>   dest: /my/path
>   line: "another=myother"
>   state: present
>
> I tried regexp: "$another=myother" and few other combinations but nothing 
> works. lineinfile is never able to read for the entry and everytime says 
> "line added" when playbook is run in --check mode.
>

-- 
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/87ba8c18-4b8e-46bb-8b42-1118f81174b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] import branch on ansible-galaxy

2017-05-18 Thread Marco Tangaro
Dear experts,
I'm trying to import my ansible-role on github: 
https://github.com/mtangaro/ansible-galaxy-tools
It is a fork and for this reason I don't want modify the master branch, 
therefore I've added new branches.
I'd like to import on ansible-galaxy the handler-include-static-no

I've used this command, after the login:

ansible-galaxy import mtangaro ansible-galaxy-tools --branch 
handler-include-static-no
Successfully submitted import request 88846
Starting import 88846: role_name=ansible-galaxy-tools 
repo=mtangaro/ansible-galaxy-tools
Accessing branch: handler-include-static-no
Parsing and validating meta data.
No issue tracker defined. Enable issue tracker in repo settings, or provide 
an issue tracker in meta data.
Parsing galaxy_tags
Found categories in meta data. Update the meta data to use galaxy_tags 
rather than categories.
Parsing platforms
Parsing and validating README
Adding repo tags as role versions
Removing old tags
Import completed
Status SUCCESS : warnings=2 errors=0

The branch seems to be imported, but I can't install it

sudo ansible-galaxy install 
mtangaro.ansible-galaxy-tools,handler-include-static-no
- downloading role 'ansible-galaxy-tools', owned by mtangaro
 [WARNING]: - mtangaro.ansible-galaxy-tools was NOT installed successfully: 
- the specified version (handler-include-static-no) of 
mtangaro.ansible-galaxy-tools was not found in the list of available 
versions ([{u'name':
u'v0.3.0', u'created': u'2017-05-18T07:38:56.374Z', u'url': u'', 
u'release_date': u'2016-09-07T19:33:41Z', u'modified': 
u'2017-05-18T07:38:56.435Z', u'related': {}, u'id': 31813, u'active': True, 
u'summary_fields': {u'role':
{u'id': 17914, u'name': u'ansible-galaxy-tools'}}}, {u'name': u'v0.2.1', 
u'created': u'2017-05-18T07:38:56.439Z', u'url': u'', u'release_date': 
u'2016-06-26T14:16:00Z', u'modified': u'2017-05-18T07:38:56.500Z', 
u'related':
{}, u'id': 31814, u'active': True, u'summary_fields': {u'role': {u'id': 
17914, u'name': u'ansible-galaxy-tools'}}}, {u'name': u'v0.2.0', 
u'created': u'2017-05-18T07:38:56.505Z', u'url': u'', u'release_date':
u'2015-08-14T17:48:28Z', u'modified': u'2017-05-18T07:38:56.888Z', 
u'related': {}, u'id': 31815, u'active': True, u'summary_fields': {u'role': 
{u'id': 17914, u'name': u'ansible-galaxy-tools'}}}, {u'name': u'v0.1.1',
u'created': u'2017-05-18T07:38:56.893Z', u'url': u'', u'release_date': 
u'2015-08-14T13:36:35Z', u'modified': u'2017-05-18T07:38:56.940Z', 
u'related': {}, u'id': 31816, u'active': True, u'summary_fields': {u'role': 
{u'id':
17914, u'name': u'ansible-galaxy-tools'}}}, {u'name': u'v0.1.0', 
u'created': u'2017-05-18T07:38:56.945Z', u'url': u'', u'release_date': 
u'2015-08-05T12:57:25Z', u'modified': u'2017-05-18T07:38:57.021Z', 
u'related': {},
u'id': 31817, u'active': True, u'summary_fields': {u'role': {u'id': 17914, 
u'name': u'ansible-galaxy-tools'}}}]).

ERROR! - you can use --ignore-errors to skip failed roles and finish 
processing the list.

ansible --version:
ansible 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
20160609]


Any idea?
Marco.


-- 
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/87e8d864-2f62-4291-9686-8c29f98bc4c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] how to pass a file into AnsibleModule as argument

2017-05-18 Thread Bruce Lok
I know the basic to pass a some string to an Ansible Module as argument, 
but curious how to pass a file

for example:
I have a file containing some variable in yaml format (eg: 
/var/www/project/var.yaml)

def main():
module = AnsibleModule(
argument_spec = dict(user = dict(default='me'),
 pass = dict(required=True),
 ip = dict(required=True),
 var1 = dict(required=True),
 filename = dict(required=True),
 ))

the argument 'filename' is expected to be a file, I want to pass the 
var.yaml into the ansible module which will read it
Thank you so much

-- 
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/61dcef96-ac54-455a-b5a2-6e5d6199d746%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible only completing first task in playbook

2017-05-18 Thread JK
So Initially I thought that I had a rogue playbook but now I am finding 
that Ansible is only executing the first task in any playbook. For role 
below only first task is completed but no errors are given even with -v -vv 
or -vvv. --list-tasks lists all tasks and if I comment first task out then 
second one runs fine. I have tried uninstalling and reinstalling Ansible 
and verified /etc/ansible/ansible.cfg. No joy I am on CentOS 
7.3 ansible-2.3.0.0-3.el7.noarch


  - name: ensure file exists
file:
  path: /etc/modprobe.d/blacklist.conf
  state: touch
  mode: 0755
  
  - name: ensure blacklist line is in file
lineinfile:
  path: /etc/modprobe.d/blacklist.conf
  regexp: '^blacklist\ usb-storage'
  state: present
  line: 'blacklist usb-storage' 

-- 
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/16641da8-2410-4a3d-afb0-cc053a1af35a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Dependency check between roles

2017-05-18 Thread Jose Luis Fernández Pérez
Hi all!

I need to disallow a role from being executed when it is include more than 
once. The scenario is like this.

Role A includes as a dependency Role B
Role C includes as a dependency Role B

I include role A and role C in a playbook

The result is.

B is run
A is run
B is run
C is run

Given that B is already executed I would like it not to be run again.

Any idea? Im currently setting a fact in B and use a conditional include in 
its main.yml file but this is code smell IMHO.

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/24f27e6d-0d17-455b-9e4f-fb8b051a09f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible for Microsoft update patching

2017-05-18 Thread Vinod Kashyap
Hi,
I am trying to understand if Ansible can be used for Microsoft update 
patching for windows servers in conjunction with WSUS? and if yes what are 
Pros and Cons of using this tool instead of using some GUI tool like 
BatchPatch where we get auto login,  progress bar for each server being 
patched, and final reporting. Has any one used it and could please share 
experience.

Regards,
Vinod Kashyap

-- 
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/3deab0cf-c8cd-490a-af52-b81213df65d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] using modules offline

2017-05-18 Thread Avishay Niv
hello

we have just started to use Ansible in one of our networks. one of our 
networks is a stand alone network which is not connected to the internet 
and the only way to insert data (files) to this environment is with offline 
copy. i would like to use some modules from the ansible galaxy but i didnt 
find any documented way to use install and use modules offline. 

if needed i can install Ansible on a server in a network that connected to 
the internet and install the modules on that server but i need to know if 
coping the relevant files is enough ?  ehat files to copy and where to put 
them ? do i need to do somethng special to use the modules offline ?

thanks

Avishay 

-- 
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/b4fcc29f-4506-41f7-9f8a-ed9f1195959c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Looping from a list of definitions and values which is based on group var

2017-05-18 Thread Ilan Harel
Might be a simple solution that I didn't understand after reading 
http://docs.ansible.com/ansible/playbooks_loops.html but here is my case:

There is a command that should run different parameters for the same role 
based on group of hosts for example:

webservers group:
/usr/bin/command definition1=value1a
/usr/bin/command definition2=value2a
/usr/bin/command definition3=value3a

dbservers group:
/usr/bin/command definition1=value1b
/usr/bin/command definition2=value2b
/usr/bin/command definition3=value3b
/usr/bin/command definition4=value4b

There will be two var files, webserver.yml and dbservers.yml with the 
following content:
webserver.yml 
definition1,value1a
definition2,value2a
definition3,value3a

dbservers.yml 
definition1,value1b
definition2,value2b
definition3,value3b
definition4,value4b

1. how should I loop through all pairs of definitions and values in var 
files and run the command?
2. where do I add the name definition that it will be displayed when it's 
running?

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/baf73ebb-5e64-404d-8564-a47d0d153006%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2017-05-18 Thread Kai Stian Olstad

On 18. mai 2017 15:11, america...@optonline.net wrote:

Hi Kai,

Thank you for taking the time to review and reply. I thought the same thing
yesterday and ran through every option I could think of. the funny part
about the module is it states in the documentation that UUID is not
required but if I run it with out the UUID I get a different result.


Have you read this one?

"vmware_guest_snapshot don't find vm if not folder is specified"
https://github.com/ansible/ansible/issues/22644


--
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/4dec3c31-2580-d36a-f000-20f25d168f81%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: winrm certificate authentication

2017-05-18 Thread Leo Y
@Hmdi Did you have any progress on the issue? I am trying to achieve the 
same result with the same level of success. I came across the blog post 
that Matt had referenced. Unfortunately, it explains how do it for 
Windows-to-Windows but omit the part how Windows created certificate is 
translated to pair private/public keys.

On Wednesday, April 5, 2017 at 9:37:16 AM UTC+3, Hmdi Bz wrote:
>
> Thank you for the response,
>
> I need to use certificate based authentication because I need to automate 
> the whole process without any obvious security risks, My playbook along 
> with other files (inventory, group_vars, roles) will be in a "semi public" 
> repository so I can't hard code the passwords, even if I used vaulted 
> passwords I would need to type the encryption passphrase in a clear text 
> file  and I can't risk having the same encryption passphrase for all hosts,
>
> On Tuesday, April 4, 2017 at 9:55:45 PM UTC+1, Matt Davis wrote:
>>
>> Doesn't look like you actually set up the cert->user mapping. Take a look 
>> at 
>> http://www.hurryupandwait.io/blog/certificate-password-less-based-authentication-in-winrm
>>  
>> - it's a decent end-to-end tutorial on how to set it up. That said, I'd 
>> strongly recommend you don't use it- the mapping is brittle, it doesn't 
>> work for domain users, and underlying urllib3 requirements mean that the 
>> cert has to be sitting on disk unencrypted. Most folks are better off just 
>> using vaulted passwords.
>>
>> -Matt
>>
>> On Tuesday, April 4, 2017 at 9:03:10 AM UTC-7, Hmdi Bz wrote:
>>>
>>> Hi,
>>>
>>> I have two VMs the first one is centos 7 VM with ansible 2.2.1 installed 
>>>  (ip: 192.168.26.2)
>>> the second one is a windows 10 VM(ip: 192.168.26.3)
>>>
>>> I have managed to connect to windows VM from centos VM using basic 
>>> authentication (username +  password)
>>>
>>> I need to use certificate authentication between centos and windows and 
>>> I did the following with no success:
>>>
>>>  1) I have generated a self-signed certificate in the windows VM 
>>> then I have installed it  with the following command 
>>>  $ip="192.168.26.3"
>>>  $c = New-SelfSignedCertificate -DnsName $ip -CertStoreLocation 
>>> cert:\LocalMachine\My
>>>
>>>  2) I have created the following winrm listener on the windows VM:
>>>  winrm create winrm/config/Listener?Address=*+Transport=HTTPS 
>>> "@{Hostname=`"$ip`";CertificateThumbprint=`"$($c.ThumbPrint)`"}"
>>>
>>>  3) I have generated a private key on centos VM:
>>>  openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt 
>>> rsa_keygen_bits:2048
>>>
>>>  4) I have generated a csr on centos VM:
>>> openssl req -key private_key.pem -new -out ansible.csr
>>>
>>>  5) I have signed the csr (ansible.csr) using the self-generated 
>>> certificate in windows VM
>>>   openssl ca -out ansible.crt -infiles ansible.csr
>>>
>>>  6) I have edited the inventory file:
>>> [test]
>>> 192.168.26.2
>>> [test:vars]
>>> ansible_user=administrator 
>>> ansible_winrm_port=5986
>>> ansible_connection=winrm
>>> ansible_winrm_scheme=https
>>> ansible_winrm_transport=certificate
>>> ansible_winrm_server_cert_validation=ignore
>>> ansible_winrm_cert_key_pem=path/to/private/key/ private_key.pem
>>> ansible_winrm_cert_pem=path/to/certificate/ansible.crt
>>>
>>>  7) I have executed the following command  but it failed
>>>  ansible -i pilote.ini test win_ping
>>>
>>>I had the following error:
>>> msg:"certificate: the specified credentials were rejected by the 
>>> server
>>>
>>>
>>>   
>>> can you point me what  am I doing wrong??
>>> Thank you
>>>
>>

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


Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2017-05-18 Thread americanoz
Hi Kai,

Thank you for taking the time to review and reply. I thought the same thing 
yesterday and ran through every option I could think of. the funny part 
about the module is it states in the documentation that UUID is not 
required but if I run it with out the UUID I get a different result. I will 
run give it another try today.  Not sure if you know much about the VC can 
there be a incompatibility with pyvmomi and the VC we are running 6.0 VC. I 
did check and pyvmomi will go back 4 version so that should be good. Sorry 
running through everything in my head.. 

Thanks again. I will update later today.. 
richg 

On Thursday, May 18, 2017 at 4:10:10 AM UTC-4, Kai Stian Olstad wrote:
>
> On 17.05.2017 22:57, ameri...@optonline.net  wrote: 
> > Hi Kai, 
> > 
> > Just to followup I have now tried different Datacenters, different 
> > Virtual 
> > Centers, and different users and I still get the same result. But 
> > vmware_vm_facts works fine. I trying the vmware mods to see if I can 
> > figure 
> > it out. Any suggestions or help would be really appreciated. thanks, 
> > 
> > I am at a total loss.. could it be a network or firewall or port issue. 
> > I 
> > can validate via ping to each VM Guest. But 
>
> It's most likely a wrong combination of datacenter:, name: and uuid: 
> since it can't find the VM. 
>
> Is {{ ansible_hostname }} the same name it's called in Vmware? Is the 
> UUID correct? 
>
> Vmware is case sensitive, is the case correct in datacenter:, name: and 
> uuid: ? 
>
> -- 
> 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/4651ad09-913a-4df7-a9ab-7a28a1842a0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is posible add an EXTRAVARS with tower api?

2017-05-18 Thread Matt Martz
For Tower support or questions please use
https://access.redhat.com/products/ansible-tower-red-hat

This mailing list is for the open source Ansible project.


On Thu, May 18, 2017 at 2:50 AM Aitor Gómez  wrote:

>
>
> i need to add an extravars while ejecutin the job.. i nedd start the job..
> get the extravars, and ADD it in the Job extravars to use it
>
> is posible add it with tower api?
>
> --
> 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/8e847a13-b331-475c-a0aa-4f36b2741ac6%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/CAD8N0v8PiDx%3DbVCEs1N6XZBCE-f1MEcAXTboWiOggxT3HRpTpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Issue with vmware_guest_snapshot module

2017-05-18 Thread Kai Stian Olstad

On 17.05.2017 22:57, america...@optonline.net wrote:

Hi Kai,

Just to followup I have now tried different Datacenters, different 
Virtual

Centers, and different users and I still get the same result. But
vmware_vm_facts works fine. I trying the vmware mods to see if I can 
figure

it out. Any suggestions or help would be really appreciated. thanks,

I am at a total loss.. could it be a network or firewall or port issue. 
I

can validate via ping to each VM Guest. But


It's most likely a wrong combination of datacenter:, name: and uuid: 
since it can't find the VM.


Is {{ ansible_hostname }} the same name it's called in Vmware? Is the 
UUID correct?


Vmware is case sensitive, is the case correct in datacenter:, name: and 
uuid: ?


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


Re: [SOCIAL NETWORK] [ansible-project] With_items over the loops with "when", can we write multiple "when" in one task?

2017-05-18 Thread Werner Flamme
Raj Martha [15.05.2017 16:40]:
> -
>   debug: var=allcluster_status.stdout_lines
> -
>   name: " Starting the clusters which is stopped"
>   shell: "{{ script to start cluster}] {{item.cluster1}} 

the {{ do not match the }] here!



-- 


-- 
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/d8e51f50-498a-5bdb-f0fe-18c28ae1749c%40ufz.de.
For more options, visit https://groups.google.com/d/optout.


smime.p7s
Description: S/MIME Cryptographic Signature


[ansible-project] Is posible add an EXTRAVARS with tower api?

2017-05-18 Thread Aitor Gómez


i need to add an extravars while ejecutin the job.. i nedd start the job.. 
get the extravars, and ADD it in the Job extravars to use it

is posible add it with tower api?

-- 
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/8e847a13-b331-475c-a0aa-4f36b2741ac6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.