[ansible-project] Run a task based on variable defined or not

2018-08-16 Thread Neetu
Hi Guys


Can some one here help me on how to run a task if a variable is undefined.


I want to check if a variable exists or not and register that .

If Variable exists I want to run a task. 

Has any one successfully done this ?

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


Re: [ansible-project] git version not cloning branch

2018-08-16 Thread Jonathan Lozada De La Matta
you need to add version: centos

On Thu, Aug 16, 2018 at 11:57 PM  wrote:

> hi,
> I'm using the git module, specifying 'centos' as the version. 'centos' is
> the name of a branch in my gitlab repo.
> No errors, and the clone part works but always 'master' is what's left in
> the destination. I suppose the code actually does a clone and then a
> checkout of the branch.
> So it looks like the checkout is not happening.
>
> ansible 2.6.2, python 2.7.5
>
> I get this response:
> changed: [mymachine] => (item={u'version': u'centos', u'reponame':
> u'myrepo', u'destname': u'/path/to/code/repodir'})
>
> What am I doing wrong? This is the relevant snip from my playbook.
>
> - name: retrieve repos
> become_user: myusername
> git:
> repo: g...@gitlab.myco.com:myusername/{{ item.reponame }}.git
> accept_hostkey: yes
> ssh_opts: "-o StrictHostKeyChecking=no"
> clone: yes
> force: yes
> dest: "{{ item.destname }}"
>
> loop:
> - {'reponame': 'myrepo', 'destname': "{{coderoot}}/myrepo", 'version':
> 'centos'}
> more repos go 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/b4ba1286-214e-4846-bfb4-67e9f7dce0b6%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services 

jloza...@redhat.com

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


Re: [ansible-project] webserver secure

2018-08-16 Thread coach rhca
thanks Jonathan for reciprocating, i use the openssl on the OS to generate
the pem file and then the crt file but i am checking on how to achieve this
on ansible.
just like a private self signed certificate for internal use for the
webserver that will be provisioned.

On Thu, Aug 16, 2018 at 10:49 PM, Jonathan Lozada De La Matta <
jloza...@redhat.com> wrote:

> Coach,
>
> how do you currently do your certs? you can either use the letsencrypt
> modules, use copy to put it on webserver you build or use get_url. You can
> also do the same for the webserver config you are using. You can also
> template the config file.
>
> On Thu, Aug 16, 2018 at 1:15 PM coach rhca  wrote:
>
>> Hi,
>>
>> Trying to create an ec2 instance using ansible. which will host a normal
>> webserver but not sure on how to add the self signed certificate to the
>> http - webserver using ansible.
>> Also how to redirect all the http request to https one using ansible.
>> Could you please suggest. 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/afe8c42d-c0ec-46af-b8be-
>> ed09b473e6b0%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION CONSULTANT - AUTOMATION PRACTICE
>
> Red Hat Consulting Services 
>
> jloza...@redhat.com
>
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/tBBrc4ycXmI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAFYJA%2BJDFNLFkqV2JD4620xgr7e833ophj
> VsvwgA524xaBkQjw%40mail.gmail.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/CALguqPJWaybPSPxQTGtPqoUSem%2BMyy9f9C6edXDNgXZ%2BGVs77Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Transfer execute and delete script python via playbook

2018-08-16 Thread Drew Mullen
You can do this using the ansible script module

https://docs.ansible.com/ansible/2.5/modules/script_module.html

-- 
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/28be8e97-f288-4e1a-9f56-aab3680b9248%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] nxos_facts - fails on a lot of versions.

2018-08-16 Thread Trishna Guha
Hi,

You are getting this error on 5.2(1)N1(1) Nexus as JSON structured output
is not supported on the device.
Non structured output support for this module is added in 2.6. Please
upgrade to Ansible 2.6.2.

Thanks,

On Tue, Aug 14, 2018 at 4:25 AM Jonathan Lozada De La Matta <
jloza...@redhat.com> wrote:

> Dennis,
>
> I'm not an expert on networking but, we can try to gather some information
> and track it down. How does your playbook/role look like ? did you follow
> the instructions in here
> https://docs.ansible.com/ansible/2.5/network/user_guide/platform_nxos.html#nxos-platform-options
> ?
>
> On Mon, Aug 13, 2018 at 6:44 PM Dennis McCarthy 
> wrote:
>
>> I'm running ansible 2.5.5-1.
>> It seems that the issue I have where the nxos_module spits out an error
>> seem to be related to the version or image on the device I'm trying to
>> connect to.
>> I think the error is saying that the object containing stdout doesn't
>> have a get() method. "unicode", that there is like a sub-class of string,
>> right?
>>
>> I'm reading thru issues on git-hub, but they talk way over my head.
>> ELI5 (Explain it Like I'm 5);
>>   IS this fixed in 2.6?
>>   Is this a "too bad, so sad" sort of issue where I just need to get
>> newer switches or older ansible?
>>
>> The Error:
>> fatal: [NDDCBPSWNX01]: FAILED! => changed=false
>>   module_stderr: |-
>> Traceback (most recent call last):
>>   File "/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py", line 602,
>> in 
>> main()
>>   File "/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py", line 585,
>> in main
>> inst.populate()
>>   File "/tmp/ansible_5wMQsv/ansible_module_nxos_facts.py", line 233,
>> in populate
>> if data.get('sys_ver_str'):
>> AttributeError: 'unicode' object has no attribute 'get'
>>   module_stdout: ''
>>   msg: MODULE FAILURE
>>   rc: 1
>> An exception occurred during task execution. To see the full traceback,
>> use -vvv. The error was: AttributeError: 'unicode' object has no attribute
>> 'get'
>>
>>
>> The results of my testing:
>>
>> Connection IOSVersion
>> Failed 5.2(1)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2011 by Cisco
>> Systems, Inc. Device Manager Version 6.1(1),  Compiled 7/12/2012 19:00:00
>> Worked 6.0(2)A6(4), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc.   Compiled 8/18/2015 13:00:00
>> Worked 6.0(2)A8(3), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc.   Compiled 10/28/2016 20:00:00
>> Failed 6.0(2)N1(2), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc. Device Manager Version 6.0(2)N1(1),  Compiled 3/14/2013
>> 1:00:00
>> Worked 6.0(2)U6(10), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc.   Compiled 3/30/2017 9:00:00
>> Failed 6.0(4), RELEASE SOFTWARE Copyright (c) 2002-2011 by Cisco
>> Systems, Inc. Compiled 6/6/2012 18:00:00
>> Failed 6.1(2), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc. Compiled 9/7/2012 13:00:00
>> Failed 6.2(16), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco
>> Systems, Inc. Compiled 1/27/2016 9:00:00
>> Failed 7.0(1)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco
>> Systems, Inc. Device Manager Version 6.3(1),  Compiled 3/19/2014 14:00:00
>> Worked 7.0(3)I2(2a), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco
>> Systems, Inc. Compiled 12/14/2015 3:00:00
>> Worked 7.0(3)I2(2b), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco
>> Systems, Inc. Compiled 2/28/2016 19:00:00
>> Worked 7.0(3)I5(1), RELEASE SOFTWARE Copyright (c) 2002-2016 by Cisco
>> Systems, Inc. Compiled 10/29/2016 8:00:00
>> Worked 7.3(2)N1(1), RELEASE SOFTWARE Copyright (c) 2002-2012, 2016-2017
>> by Cisco Systems, Inc. Device Manager Version 6.0(2)N1(1),Compiled
>> 5/12/2017 23:00:00
>>
>> --
>> 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/485a2dcf-4c76-41a4-a0ae-448dec9f81e9%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION CONSULTANT - AUTOMATION PRACTICE
>
> Red Hat Consulting Services 
>
> jloza...@redhat.com
>
>
>
>
> --
> 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
> 

[ansible-project] Transfer execute and delete script python via playbook

2018-08-16 Thread Drew Mullen
You can do this using the ansible script module

https://docs.ansible.com/ansible/2.5/modules/script_module.html

-- 
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/ad847972-5fe9-40a1-b635-a8b0bd967611%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] git version not cloning branch

2018-08-16 Thread jtim . arnold
hi,
I'm using the git module, specifying 'centos' as the version. 'centos' is 
the name of a branch in my gitlab repo.
No errors, and the clone part works but always 'master' is what's left in 
the destination. I suppose the code actually does a clone and then a 
checkout of the branch.
So it looks like the checkout is not happening.

ansible 2.6.2, python 2.7.5

I get this response:
changed: [mymachine] => (item={u'version': u'centos', u'reponame': 
u'myrepo', u'destname': u'/path/to/code/repodir'})

What am I doing wrong? This is the relevant snip from my playbook.

- name: retrieve repos
become_user: myusername
git:
repo: g...@gitlab.myco.com:myusername/{{ item.reponame }}.git
accept_hostkey: yes
ssh_opts: "-o StrictHostKeyChecking=no"
clone: yes
force: yes
dest: "{{ item.destname }}"

loop:
- {'reponame': 'myrepo', 'destname': "{{coderoot}}/myrepo", 'version': 
'centos'}
more repos go 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/b4ba1286-214e-4846-bfb4-67e9f7dce0b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Please explain ec2_instance volumes config

2018-08-16 Thread Karl Auer
So:

"System A" is the one you call "Master", and has public IP 18.191.161.9. It
has the private IP address 172.31.20.219.

"System B" is the one you call "Client", and has the private IP address
172.31.24.31. I know this because before you changed the prompt to "Client@",
the prompt was "root@ip-172-31-24-31:~#".

You were logged into System A, and you ran ssh to connect to 18.222.135.76.
The next command prompt you saw was "ubuntu@ip-172-31-24-31:~$". See above
- that IP address, 172.31.24.31, is System B.

*In other words, you were on System A, ran ssh, and ended up logged into
System B. Success!*

I do not understand what error you think you are seeing. This is how it is
supposed to work.

Remember: You logged into System B as "ubuntu", not "root". So you were in
a different home directory, with a different ~/.ssh directory.

Also remember that although you are connecting to a public address, in the
AWS universe instances don't know about their own public (or EIP) IPv4
addresses. That is why when you are logged in to AWS instances, you can see
only their private addresses.

Regards, K.

PS: None of the steps you did on System B ("Client") were needed.


On Tue, Aug 14, 2018 at 3:26 PM, Kiran Sonawane <
kiransonawane.nm...@gmail.com> wrote:

> Good Morning Karl. I just tried Doing the same thing with newly created
> Instances but same error, you're right though we don't have to change
> anything in sshd_config.
>
> Now I'm sending you screen shots of Master and Client1 instances Public
> Private IP's .
>
>
>
> On Mon, Aug 13, 2018 at 9:11 PM, Karl Auer  wrote:
>
>> Please do this:
>>
>> Use the AWS EC2 Console to find out the public and private addresses of
>> the system you want to connect FROM. We will call this system "system A".
>> Please post those details here.
>>
>> Use the AWS EC2 Console to find out the private and public addresses of
>> the system you want to connect TO. We will call this system "system B".
>> Please post those details here.
>>
>> Regards, K.
>>
>> PS: You do not need PasswordAuthentication, and you should revert any
>> changes you have made to ssh_config or sshd_config.
>>
>> On Tue, Aug 14, 2018 at 12:07 AM, Kiran Sonawane <
>> kiransonawane.nm...@gmail.com> wrote:
>>
>>> sorry i forgot screen shot attachment
>>>
>>> On Mon, Aug 13, 2018 at 7:36 PM, Kiran Sonawane <
>>> kiransonawane.nm...@gmail.com> wrote:
>>>
 Even now I directly tried without being an root user but it still shows
 the same thing . my last logged in details. but before that it may be
 connect to the client since there were no errors shown. so now I'm
 completely confused and tried every combination in this week. but no idea
 what exactly is happening.

 On Mon, Aug 13, 2018 at 7:28 PM, Kiran Sonawane <
 kiransonawane.nm...@gmail.com> wrote:

> I made Changes in my sshd_config file like yes to
> passwordauthentication and bunch of as shown on youtube. is that problem ?
> because it won't be here it'll give permission errors then .
>
> On Mon, Aug 13, 2018 at 7:21 PM, Kiran Sonawane <
> kiransonawane.nm...@gmail.com> wrote:
>
>> I'm Constantly getting this window. What is this ? sending a new
>> screen shot
>>
>> On Mon, Aug 13, 2018 at 7:13 PM, Kiran Sonawane <
>> kiransonawane.nm...@gmail.com> wrote:
>>
>>> I mean i was loged out as root user and become normal use. I didn't
>>> really go to my remote machine. but I'm sending you screen shots of my 
>>> cmd
>>> where i changed Insta_1.pen to 600 then try to shh -i  
>>> ~/.ssh/Insta_1.pem
>>> ubuntu@publicIP and it did the same thing as last time.
>>> Logged out of super user and vanished my .pen file.
>>> I really have no idea what's happening. please tell me what exactly
>>> happening, i'm doing something wrong ?
>>>
>>> Thanx You're really helping me so much.
>>>
>>> On Mon, Aug 13, 2018 at 5:16 PM, Karl Auer 
>>> wrote:
>>>
 Look carefully at the pictures you sent me. They show, very
 clearly, that you have successfully logged into 18.222.132.35.

 The reason you think things are "gone" is because those things
 exist on your source system, not on your target system.

 From the command prompt "ubuntu@ip-172-31-23-215" type "exit" and
 press return. You will find yourself back on your source system, and 
 the
 "missing" items will be there. They never left - you did :-)

 Regards, K.


 On Mon, Aug 13, 2018 at 9:30 PM, Kiran Sonawane <
 kiransonawane.nm...@gmail.com> wrote:

> I already did that all changes, made the path on same line. Then I
> changed permissions to from 777 to 666
> Then I again changed to 400. Nothing worked. I just don't
> understand what's happening?
> All the files from /.ssh are gone. Id_rsa, Id_rsa.pub, my  .pem

[ansible-project] Ansible 2.6.3 is available

2018-08-16 Thread Matt Clay
Hi all -- we're happy to announce that the general release of Ansible 2.6.3 
is now available!


How do you get it?
--

$ pip install ansible==2.6.3 --user

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

https://releases.ansible.com/ansible/ansible-2.6.3.tar.gz
SHA256: 1027f627e6d8a2d51f3a79abb01447716a78aa646e0c2f9860cfde273256a28c


What's new in 2.6.3?
--

The 2.6.3 release is a maintenance release containing numerous bug fixes. 
The full changelog is at:

https://github.com/ansible/ansible/blob/v2.6.3/changelogs/CHANGELOG-v2.6.rst


What's the schedule for future 2.6 maintenance releases?
--

Future 2.6 maintenance releases will occur approximately every 2-3 weeks.


We've published a porting guide at 
https://docs.ansible.com/ansible/2.6/porting_guides/porting_guide_2.6.html 
to help migrate your content to 2.6. If you discover any errors, or if you 
see any regressions from playbooks which work on 2.5.x and prior, please 
open a GitHub issue, and be sure to mention you're using 2.6.3.


Thanks!

Matt Clay (@mattclay)
Ansible Core Engineering / 2.6 Release Manager

-- 
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/156f1492-2555-4006-82e2-e3326ea9690a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Usage of the zone plugin

2018-08-16 Thread Tim Shaw
Hi,

I'm attempting to use the zone plugin to connect to Solaris 11 zones to 
re-configure the primary network.

Here's my test inventory file;

[playpen]
localhost
e7812svsun003

[my-zones]
e7812svsun031 ansible_zone_host=e7812svsun003


and here's my test playbook;
---
- hosts: my-zones
  gather_facts: no

  tasks:
- name: Hello
  connection: zone
  command: /usr/sbin/ipadm

And here's what I get when I run the playbook;

[asgadmin@e7812svint026 workspace]$ ansible-playbook -vvv -i myinventory 
ztest.pb -bKk
ansible-playbook 2.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = 
[u'/home/asgadmin/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Apr 11 2018, 17:41:36) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-28.0.1)]
Using /etc/ansible/ansible.cfg as config file
SSH password:
SUDO password[defaults to SSH password]:
Parsed /home/asgadmin/workspace/myinventory inventory source with ini plugin

PLAYBOOK: ztest.pb 
*
1 plays in ztest.pb

PLAY [my-zones] 

META: ran handlers

TASK [Hello] 
***
task path: /home/asgadmin/workspace/ztest.pb:6
fatal: [e7812svsun031]: FAILED! => {
"msg": "zone connection requires running as root"
}
to retry, use: --limit @/home/asgadmin/workspace/ztest.retry

PLAY RECAP 
*
e7812svsun031  : ok=0changed=0unreachable=0failed=1


I was under the impression that the zone plugin would connect to the 
ansible_zone_host  then set up the connection to the zone - effectively 
working in a proxy fashion.
Have I completely misunderstood how the zone plugin works?

Thanks
Tim

-- 
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/17899ee3-ec33-4b8c-b112-ae36091a84ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible 2.5.8 is available

2018-08-16 Thread mattdavi
Hi all- we're happy to announce that the general release of Ansible 2.5.8 
is now available! 


How do you get it?
--

$ pip install ansible==2.5.8 --user

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

https://releases.ansible.com/ansible/ansible-2.5.8.tar.gz
SHA256: fa82b79938d6254960d9d8bcd61755794d53f5c37804f84a98bbfea7e2c152af


What's new in 2.5.8?
--

The 2.5.8 release is a maintenance release containing numerous bugfixes. 
The full changelog is at:

https://github.com/ansible/ansible/blob/stable-2.5/changelogs/CHANGELOG-v2.5.rst


What's the schedule for future 2.5 maintenance releases?
--

Future 2.5 maintenance releases will occur approximately every 2-3 weeks.


We've published a porting guide at 
https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html 
to help migrate your content to 2.5. If you discover any errors, or if you 
see any regressions from playbooks which work on 2.4.x and prior, please 
open a Github issue, and be sure to mention you're using 2.5.8.


Thanks!

Matt Davis (@nitzmahone)
Ansible Core Engineering / 2.5 release manager

-- 
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/b9877cf5-90cc-43d4-90e5-bcbc56d57319%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Jonathan Lozada De La Matta
your issue was in  " but it boils down to the fact that the 'upgrade' was
unintentional and cost us three weeks of head scratching.". Ansible docs,
changelogs and release announcements talk about all the changes that
happened. If its something that happened in your environment then its not
really ansible's fault.

On Thu, Aug 16, 2018 at 5:40 PM Karl Auer  wrote:

> In three weeks of head-scratching you didn't realise the version of
> A
> nsible had changed, meaning you allow uncontrolled upgrades to your
> production systems?
>
> Or in three weeks of head-scratching, knowing that Ansible had upgraded,
> it didn't occur to you to read the release notes?
>
> It's a bit rough to blame Ansible for those...
>
> Regards, K.
>
>
>
>
> On Fri, Aug 17, 2018 at 7:30 AM, Ilsa Loving 
> wrote:
>
>> I'll skip the story since it's long, convoluted, and frustrating, but it
>> boils down to the fact that the 'upgrade' was unintentional and cost us
>> three weeks of head scratching.
>>
>> Thanks for the info.  Now that I know how capricious Ansible is, we will
>> need to reconsider how it is used, and how heavily.  This kind of
>> fundamental instability make Ansible a very high risk product to use.
>>
>> Thanks!
>>
>>
>>
>> On Thursday, 16 August 2018 16:53:53 UTC-4, Kai Stian Olstad wrote:
>>>
>>> On Thursday, 16 August 2018 22.36.17 CEST Ilsa Loving wrote:
>>> > This should theoretically add the instance to inventory so that when
>>> we
>>> > perform the following task later:
>>> > # Perform server default tasks
>>> > - include_tasks: set_server_defaults.yml
>>> > delegate_to: "ec2_instance_host"
>>> > become: true
>>> >
>>> >
>>> > The task applies a number of changes such as yum updates, etc.
>>> >
>>> > But as soon as ansible is updated to 2.5+, this behaviour breaks and
>>> > instead applies all those server settings to the local host running
>>> the
>>> > playbook.
>>> >
>>> > So far our only solution has been to block updates and to keep Ansible
>>> at
>>> > 2.4, which is far from ideal.
>>> >
>>> > Does anyone have any insight as to why Ansible's behaviour would
>>> change so
>>> > fundamentally?  This is a catastrophic disruption that has seriously
>>> shaken
>>> > our confidence in Ansible.
>>>
>>> Before upgrading it is crucial to read the porting guide
>>>
>>> https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html
>>>
>>> for you, especial this
>>>
>>> https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance
>>>
>>> The short answer (for the long one read the links) the delegate_to only
>>> applies to the include_tasks, not the tasks inside the include.
>>>
>>>
>>> --
>>> 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/804d6159-b9bb-4283-a848-a6a30a82eb72%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Karl Auer
>
> Email  : ka...@2pisoftware.com
> Website: http://2pisoftware.com
>
> GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
> Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA
>
> --
> 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%2B%2BT08R4vDm%3Dr5AGUUNox2yC-aPzO%3DAhfK_vP-orLHzaLVoGpg%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services 

jloza...@redhat.com

-- 
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/CAFYJA%2BJZTirnLGrewowBvikHERGcTwJJY7QKNtgt%3DdoCJUaomw%40mail.gmail.com.
For more options, visit 

Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
There are two things here:

1. If you're using SSH the public key of the remote server must be added to
'known_hosts', for example like this:

ssh-keyscan -t rsa github.com | sed "s/^[^ ]* //" >> ~/.ssh/known_hosts

(alternatively you can get ansible to just accept whatever key is offered
with --accept-host-key)

2. Secondly you have to specify the private key associated with the repo
with --private-key

kind regards
Pshem


On Thu, 16 Aug 2018 at 22:36 SUMIT SAHAY  wrote:

> Thanks Pshem for your reply.
>
> ansible-pull -U [git_url] -k playbook.yml --limit localhost
>
> I am using this command to run the ansible pull, while doing this I am
> getting one error, unable to resolve the error.
>
>
> "msg": "Failed to download remote objects and refs:  Host key verification
> failed.\r\nfatal: Could not read from remote repository.\n\nPlease make
> sure you have the correct access rights\nand the repository exists.\n"
>
> Can you please help me out on this
>
>
> Looking forward for your reply
>
>
> Thanks & Regards
> Sumit Sahay
> 07044112109
>
> On Thu, Aug 16, 2018 at 3:56 PM, Pshem Kowalczyk 
> wrote:
>
>> Hi,
>>
>> That's correct, in pull mode ansible modifies and sets things on the
>> machine on which it runs. The easiest way of providing inventory in this
>> case is via command line:
>>
>> -i $(hostname),
>>
>> Please note the comma at the end.
>>
>> kind regards
>> Pshem
>>
>>
>> On Wed, 15 Aug 2018 at 02:55 SUMIT SAHAY 
>> wrote:
>>
>>> Thanks for your reply Jonathan.
>>> localhost : from where we are triggering command.
>>> This is what you want to say?
>>>
>>> Looking forward for your reply.
>>>
>>> Regards
>>> Sumit Sahay
>>> 07044112109
>>>
>>> On Tue, Aug 14, 2018, 7:44 PM Jonathan Lozada De La Matta <
>>> jloza...@redhat.com> wrote:
>>>
 usually ansible-pull its used on localhost and not other hosts. If you
 are trying to do other host then use regular ansible. Ansible-pull is a
 different use case.

 On Tue, Aug 14, 2018 at 8:26 AM SUMIT SAHAY 
 wrote:

> Thanks Jonathan, for your reply.
>
> No, I am not using localhost, I want to run my playbook on ubuntu host
> which I set up in my host file, and the host file is located in
> /home/test/sumit/
>
> How to run this so that it will pick up the host and execute on ubuntu
> remote host.
>
> Looking forward for your reply.
>
> Thanks & Regards
> Sumit Sahay
> 7044112109 <(704)%20411-2109>
>
>
> On Tue, Aug 14, 2018 at 5:17 PM, Jonathan Lozada De La Matta <
> jloza...@redhat.com> wrote:
>
>> what hosts are on your playbook? is it localhost?
>>
>> On Tue, Aug 14, 2018 at 3:07 AM SUMIT SAHAY 
>> wrote:
>>
>>> Thanks Balz, for your reply.
>>>
>>> Could you help me with the command for ansible pull, I installed git
>>> and repository and I committed the ansible playbook there now I want to 
>>> run
>>> this from my localhost server following command I am using but getting
>>> error,
>>>
>>> ansible-pull -U https://repourl.com/git/user_name/git_location -k
>>> -i /home/test/hosts playbook.yml
>>>
>>> getting error saying skipping the hosts.
>>>
>>> Could you please navigate me to the correct command.
>>>
>>> Looking forward for your reply.
>>>
>>> Regards
>>> Sumit Sahay
>>> 7044112109 <(704)%20411-2109>
>>>
>>> On Wednesday, 8 August 2018 22:43:53 UTC+5:30, balz.as...@unibas.ch
>>> wrote:

 Hi Sumit

 We're using a wrapper around ansible-pull. We use it mainly for
 clients but we've a step-by-step guide you might find helpful:
 https://github.com/ANTS-Framework/ants

 Regards
 Balz

 Am Mittwoch, 8. August 2018 08:03:45 UTC+2 schrieb SUMIT SAHAY:
>
>
> Hi All,
>
> I am trying to setup the ansible pull based on my vm server.
>
> Is there any step-wise documentation for this?
>
>
> Regards
> Sumit Sahay
> 7044112109 <(704)%20411-2109>
>

> --
>>> 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/ceb0cea7-7919-45f0-8288-e7ac8341cb57%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>>
>> Jonathan lozada de la matta
>>
>> 

Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Karl Auer
In three weeks of head-scratching you didn't realise the version of
A
nsible had changed, meaning you allow uncontrolled upgrades to your
production systems?

Or in three weeks of head-scratching, knowing that Ansible had upgraded, it
didn't occur to you to read the release notes?

It's a bit rough to blame Ansible for those...

Regards, K.




On Fri, Aug 17, 2018 at 7:30 AM, Ilsa Loving  wrote:

> I'll skip the story since it's long, convoluted, and frustrating, but it
> boils down to the fact that the 'upgrade' was unintentional and cost us
> three weeks of head scratching.
>
> Thanks for the info.  Now that I know how capricious Ansible is, we will
> need to reconsider how it is used, and how heavily.  This kind of
> fundamental instability make Ansible a very high risk product to use.
>
> Thanks!
>
>
>
> On Thursday, 16 August 2018 16:53:53 UTC-4, Kai Stian Olstad wrote:
>>
>> On Thursday, 16 August 2018 22.36.17 CEST Ilsa Loving wrote:
>> > This should theoretically add the instance to inventory so that when we
>> > perform the following task later:
>> > # Perform server default tasks
>> > - include_tasks: set_server_defaults.yml
>> > delegate_to: "ec2_instance_host"
>> > become: true
>> >
>> >
>> > The task applies a number of changes such as yum updates, etc.
>> >
>> > But as soon as ansible is updated to 2.5+, this behaviour breaks and
>> > instead applies all those server settings to the local host running the
>> > playbook.
>> >
>> > So far our only solution has been to block updates and to keep Ansible
>> at
>> > 2.4, which is far from ideal.
>> >
>> > Does anyone have any insight as to why Ansible's behaviour would change
>> so
>> > fundamentally?  This is a catastrophic disruption that has seriously
>> shaken
>> > our confidence in Ansible.
>>
>> Before upgrading it is crucial to read the porting guide
>> https://docs.ansible.com/ansible/2.5/porting_guides/porting_
>> guide_2.5.html
>>
>> for you, especial this
>> https://docs.ansible.com/ansible/2.5/porting_guides/porting_
>> guide_2.5.html#dynamic-includes-and-attribute-inheritance
>>
>> The short answer (for the long one read the links) the delegate_to only
>> applies to the include_tasks, not the tasks inside the include.
>>
>>
>> --
>> 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/ms
> gid/ansible-project/804d6159-b9bb-4283-a848-a6a30a82eb72%
> 40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Karl Auer

Email  : ka...@2pisoftware.com
Website: http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

-- 
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%2B%2BT08R4vDm%3Dr5AGUUNox2yC-aPzO%3DAhfK_vP-orLHzaLVoGpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Ilsa Loving
I'll skip the story since it's long, convoluted, and frustrating, but it 
boils down to the fact that the 'upgrade' was unintentional and cost us 
three weeks of head scratching.

Thanks for the info.  Now that I know how capricious Ansible is, we will 
need to reconsider how it is used, and how heavily.  This kind of 
fundamental instability make Ansible a very high risk product to use.

Thanks!



On Thursday, 16 August 2018 16:53:53 UTC-4, Kai Stian Olstad wrote:
>
> On Thursday, 16 August 2018 22.36.17 CEST Ilsa Loving wrote: 
> > This should theoretically add the instance to inventory so that when we 
> > perform the following task later: 
> > # Perform server default tasks 
> > - include_tasks: set_server_defaults.yml 
> > delegate_to: "ec2_instance_host" 
> > become: true 
> > 
> > 
> > The task applies a number of changes such as yum updates, etc. 
> > 
> > But as soon as ansible is updated to 2.5+, this behaviour breaks and 
> > instead applies all those server settings to the local host running the 
> > playbook. 
> > 
> > So far our only solution has been to block updates and to keep Ansible 
> at 
> > 2.4, which is far from ideal. 
> > 
> > Does anyone have any insight as to why Ansible's behaviour would change 
> so 
> > fundamentally?  This is a catastrophic disruption that has seriously 
> shaken 
> > our confidence in Ansible. 
>
> Before upgrading it is crucial to read the porting guide 
> https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html 
>
> for you, especial this 
>
> https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance
>  
>
> The short answer (for the long one read the links) the delegate_to only 
> applies to the include_tasks, not the tasks inside the include. 
>
>
> -- 
> 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/804d6159-b9bb-4283-a848-a6a30a82eb72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 22.36.17 CEST Ilsa Loving wrote:
> This should theoretically add the instance to inventory so that when we 
> perform the following task later:
> # Perform server default tasks
> - include_tasks: set_server_defaults.yml
> delegate_to: "ec2_instance_host"
> become: true
> 
> 
> The task applies a number of changes such as yum updates, etc.
> 
> But as soon as ansible is updated to 2.5+, this behaviour breaks and 
> instead applies all those server settings to the local host running the 
> playbook.
> 
> So far our only solution has been to block updates and to keep Ansible at 
> 2.4, which is far from ideal.
> 
> Does anyone have any insight as to why Ansible's behaviour would change so 
> fundamentally?  This is a catastrophic disruption that has seriously shaken 
> our confidence in Ansible.

Before upgrading it is crucial to read the porting guide
https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html

for you, especial this
https://docs.ansible.com/ansible/2.5/porting_guides/porting_guide_2.5.html#dynamic-includes-and-attribute-inheritance

The short answer (for the long one read the links) the delegate_to only applies 
to the include_tasks, not the tasks inside the include.


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


[ansible-project] No longer able to apply commands to AWS instances after upgrade to 2.5

2018-08-16 Thread Ilsa Loving
Hi all,

I have a bunch of scripts I inherited that do a variety of things, 
primarily for setting up new environments in AWS.

Using v2.4, everything worked just fine.  As of v2.5, modules are applied 
to the currently running host instead of the target instance.  Needless to 
say this caused a really big confusing mess until we figured out what 
happened and forced everything to stay at v2.4.

For example, we have a playbook of:

- hosts: localhost
gather_facts: no
roles:
- { role: create_web_tier, tags: 'web' }


The role includes a 'create_ec2_instance' task which does the following:

- name: "create_ec2_instance | AWS EC2 | Create server"
local_action:
module: ec2
region: "{{ aws_region }}"
key_name: "{{ ec2_key_name }}"
image: "{{ ec2_image }}"
instance_type: "{{ ec2_instance_type }}"
vpc_subnet_id: "{{ ec2_vpc_subnet_id }}"
assign_public_ip: "{{ ec2_assign_public_ip }}"
group_id: "{{ ec2_group_id }}"
count: "{{ ec2_count }}"
instance_tags: "{{ ec2_instance_tags}}"
wait: yes
register: ec2

- debug: var=ec2 verbosity=4

- name: create_ec2_instance | Ansible | Add instance to host group
add_host:
hostname: "ec2_instance_host"
ansible_ssh_host: "{{ item.private_ip }}"
# ansible_ssh_user: "{{ global_ansible_ssh_user }}"
# ansible_ssh_private_key_file: "{{ global_ansible_ssh_private_key_file }}"
with_items: "{{ ec2.instances }}"


This should theoretically add the instance to inventory so that when we 
perform the following task later:
# Perform server default tasks
- include_tasks: set_server_defaults.yml
delegate_to: "ec2_instance_host"
become: true


The task applies a number of changes such as yum updates, etc.

But as soon as ansible is updated to 2.5+, this behaviour breaks and 
instead applies all those server settings to the local host running the 
playbook.

So far our only solution has been to block updates and to keep Ansible at 
2.4, which is far from ideal.

Does anyone have any insight as to why Ansible's behaviour would change so 
fundamentally?  This is a catastrophic disruption that has seriously shaken 
our confidence in Ansible.









-- 
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/6fd8f723-a889-4416-99ed-bbc33565cbc7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread yaakov.kuperman via Ansible Project
one more thing - I'm doing something similar and I've found it necessary to 
use wait_for: to determine that port 22 actually went down before I wait 
for it to come up again.  I've also used wait_for_conection: to wait for it 
to come all the way back before I proceed.

On Thursday, August 16, 2018 at 3:14:56 PM UTC-4, Patrick Hunt wrote:
>
> I have the following playbook snippet
>
> ---
>
>
> - hosts: collector
>   become: true
>   become_method: su
>   become_user: root
>
>
>   tasks:
>
>
>   - name: restart server, if kernel updated
> command: reboot
> async: 1
> poll: 0
> ignore_errors: true
> notify:
>   - wait for server to restart
>
>
>   handlers:
>   - name: wait for server to restart
> wait_for:
>   host: "{{ ansible_default_ipv4.address }}"
>   port: 22
>   state: started
>   delay: 25
>   timeout: 300
> become: false
> delegate_to: localhost
>
>
> ...
>
>
>
> This is really part of a much larger maintenance playbook.  My problem is 
> that in our Test environment (RHEL 6 & 7) this succeeds, in our Dev 
> environment (CentOS 7) this fails.  When the play fails ansible will 
> connect and gather facts, when the play to restart is executed it will 
> state that the server is unreachable, however the task has been executed 
> and the server *is* restarted if you check the actual VM.  It seems that 
> the execution of the tasks completes before ansible is able to recognize 
> this fact, so it never gets to the point where it waits for the server to 
> restart and fails as unreachable instead.
>
> The ansible.cfg files are identical.  The inventory (hosts) files do not 
> have any additional variables/connection information other than hostnames 
> and groups defined.
>
> In the dev environment the playbook is executed as root, and in the Test 
> environment the playbook is executed as a user.
>
> Both environments are running ansible 2.6.2
>
> The dev environment functioned properly for a year or more until about 2-3 
> months ago when this restart task began to fail.
>
> Any ideas?
>
>
> Thanks, 
> Patrick
>

-- 
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/e3dd9b44-c3d7-4676-9e5e-7f38be8ce188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Looking for advice: json returned from API with and without brackets

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 21.12.49 CEST J-F Gaudreault wrote:
> The json... returning a list of 2+ objects.
> When the API returns only one object, the brackets are gone.

But when it return multiple entries, which one of them will you have?
If it's the fist element in the list this should work

  {{ nagios_xi_hosts.json.host.host_name | 
default(nagios_xi_hosts.json.host.0.host_name }}

If nagios_xi_hosts.json.host.host_name doesn't exist it will return the 
host_name in the first list element.

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


Re: [ansible-project] Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 21.14.56 CEST Patrick Hunt wrote:
> I have the following playbook snippet
> 
> ---
> 
> 
> - hosts: collector
>   become: true
>   become_method: su
>   become_user: root
> 
> 
>   tasks:
> 
> 
>   - name: restart server, if kernel updated
> command: reboot
> async: 1
> poll: 0
> ignore_errors: true
> notify:
>   - wait for server to restart

It fails because the server shutdown too fast.
Use
  shell: sleep 2 && reboot
instead of your command: and it will work without issues.


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


[ansible-project] Re: Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread yaakov.kuperman via Ansible Project
Check out 
https://stackoverflow.com/questions/29955605/how-to-reboot-centos-7-with-ansible

On Thursday, August 16, 2018 at 3:14:56 PM UTC-4, Patrick Hunt wrote:
>
> I have the following playbook snippet
>
> ---
>
>
> - hosts: collector
>   become: true
>   become_method: su
>   become_user: root
>
>
>   tasks:
>
>
>   - name: restart server, if kernel updated
> command: reboot
> async: 1
> poll: 0
> ignore_errors: true
> notify:
>   - wait for server to restart
>
>
>   handlers:
>   - name: wait for server to restart
> wait_for:
>   host: "{{ ansible_default_ipv4.address }}"
>   port: 22
>   state: started
>   delay: 25
>   timeout: 300
> become: false
> delegate_to: localhost
>
>
> ...
>
>
>
> This is really part of a much larger maintenance playbook.  My problem is 
> that in our Test environment (RHEL 6 & 7) this succeeds, in our Dev 
> environment (CentOS 7) this fails.  When the play fails ansible will 
> connect and gather facts, when the play to restart is executed it will 
> state that the server is unreachable, however the task has been executed 
> and the server *is* restarted if you check the actual VM.  It seems that 
> the execution of the tasks completes before ansible is able to recognize 
> this fact, so it never gets to the point where it waits for the server to 
> restart and fails as unreachable instead.
>
> The ansible.cfg files are identical.  The inventory (hosts) files do not 
> have any additional variables/connection information other than hostnames 
> and groups defined.
>
> In the dev environment the playbook is executed as root, and in the Test 
> environment the playbook is executed as a user.
>
> Both environments are running ansible 2.6.2
>
> The dev environment functioned properly for a year or more until about 2-3 
> months ago when this restart task began to fail.
>
> Any ideas?
>
>
> Thanks, 
> Patrick
>

-- 
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/402dea11-43c6-4a93-8c16-a99666a53b28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Restart server playbook fails on one set of targets, but not on another.

2018-08-16 Thread Patrick Hunt
I have the following playbook snippet

---


- hosts: collector
  become: true
  become_method: su
  become_user: root


  tasks:


  - name: restart server, if kernel updated
command: reboot
async: 1
poll: 0
ignore_errors: true
notify:
  - wait for server to restart


  handlers:
  - name: wait for server to restart
wait_for:
  host: "{{ ansible_default_ipv4.address }}"
  port: 22
  state: started
  delay: 25
  timeout: 300
become: false
delegate_to: localhost


...



This is really part of a much larger maintenance playbook.  My problem is 
that in our Test environment (RHEL 6 & 7) this succeeds, in our Dev 
environment (CentOS 7) this fails.  When the play fails ansible will 
connect and gather facts, when the play to restart is executed it will 
state that the server is unreachable, however the task has been executed 
and the server *is* restarted if you check the actual VM.  It seems that 
the execution of the tasks completes before ansible is able to recognize 
this fact, so it never gets to the point where it waits for the server to 
restart and fails as unreachable instead.

The ansible.cfg files are identical.  The inventory (hosts) files do not 
have any additional variables/connection information other than hostnames 
and groups defined.

In the dev environment the playbook is executed as root, and in the Test 
environment the playbook is executed as a user.

Both environments are running ansible 2.6.2

The dev environment functioned properly for a year or more until about 2-3 
months ago when this restart task began to fail.

Any ideas?


Thanks, 
Patrick

-- 
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/3db9e382-1842-4dc9-8b4c-284ba243a03f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Looking for advice: json returned from API with and without brackets

2018-08-16 Thread J-F Gaudreault
The json... returning a list of 2+ objects.
When the API returns only one object, the brackets are gone.

{
"nagios_xi_hosts.json.host": [
{
"@attributes": {
"id": "26128"
}, 
"action_url": {}, 
"active_checks_enabled": "1", 
"address": "1.1.1.1", 
"alias": "sldops0725", 
"check_interval": "5", 
"config_type": "1", 
"display_name": "sldops0725", 
"first_notification_delay": "0", 
"host_name": "sldops0725", 
"icon_image": "redhat.png", 
"icon_image_alt": {}, 
"instance_id": "1", 
"is_active": "1", 
"max_check_attempts": "5", 
"notes": {}, 
"notes_url": {}, 
"notification_interval": "60", 
"notifications_enabled": "1", 
"passive_checks_enabled": "1", 
"retry_interval": "1", 
"statusmap_image": "redhat.png"
}, 
{
"@attributes": {
"id": "14039"
}, 
"action_url": {}, 
"active_checks_enabled": "1", 
"address": "2.2.2.2", 
"alias": "sldops0196", 
"check_interval": "5", 
"config_type": "1", 
"display_name": "sldops0196", 
"first_notification_delay": "0", 
"host_name": "sldops0196", 
"icon_image": "redhat.png", 
"icon_image_alt": {}, 
"instance_id": "1", 
"is_active": "1", 
"max_check_attempts": "5", 
"notes": {}, 
"notes_url": {}, 
"notification_interval": "60", 
"notifications_enabled": "1", 
"passive_checks_enabled": "1", 
"retry_interval": "1", 
"statusmap_image": "redhat.png"
}
]
}

Le jeudi 16 août 2018 14:57:40 UTC-4, J-F Gaudreault a écrit :
>
> Hi! I getting a json from an API request. I've registered the json in a 
> var.
>
> I'm trying to find a way to get the hostname in the json.
> I need to find it even if it has brackets or not.
>
> I only got this far 
>
>
> with brackets:
>
> - name: test1
>   debug:
> msg: "{{ nagios_xi_hosts | json_query('json.host[0].host_name') }}"
>
> no brackets:
>
> - name: test2
>   debug:
> var: nagios_xi_hosts.json.host.host_name
>
>
>
>
>

-- 
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/b5c3ae27-ce9f-4938-a443-686fdd3ef481%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Looking for advice: json returned from API with and without brackets

2018-08-16 Thread Jonathan Lozada De La Matta
a copy of the json would be helpful.

On Thu, Aug 16, 2018 at 2:57 PM J-F Gaudreault  wrote:

> Hi! I getting a json from an API request. I've registered the json in a
> var.
>
> I'm trying to find a way to get the hostname in the json.
> I need to find it even if it has brackets or not.
>
> I only got this far 
>
>
> with brackets:
>
> - name: test1
>   debug:
> msg: "{{ nagios_xi_hosts | json_query('json.host[0].host_name') }}"
>
> no brackets:
>
> - name: test2
>   debug:
> var: nagios_xi_hosts.json.host.host_name
>
>
>
>
> --
> 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/7091e4ea-4272-4697-8558-1fc82bff2562%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services 

jloza...@redhat.com

-- 
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/CAFYJA%2BKHBdNCdzh-M2T36%2BKhaTBbH74UrUABhugjNMBCwOGwzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Looking for advice: json returned from API with and without brackets

2018-08-16 Thread J-F Gaudreault
Hi! I getting a json from an API request. I've registered the json in a var.

I'm trying to find a way to get the hostname in the json.
I need to find it even if it has brackets or not.

I only got this far 


with brackets:

- name: test1
  debug:
msg: "{{ nagios_xi_hosts | json_query('json.host[0].host_name') }}"

no brackets:

- name: test2
  debug:
var: nagios_xi_hosts.json.host.host_name




-- 
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/7091e4ea-4272-4697-8558-1fc82bff2562%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: cannot login to cisco switch using ansible

2018-08-16 Thread Ajay Kumar Manukonda
Hi Michael,

I am glad you found a solution. I see that you are only taking the output
of stdout[0] under copy task. Since your config will have the output of
multiple commands you might need config.stdout[1] and config.stdout[2] as
well.

You can use something like the following to capture all your output in one
file,

   - copy:
   content: "{{ config.stdout[0] }}"
   dest: "*your destination*"
   - blockinfile: |
   dest: "*your destination*"
   content= "{{ config.stdout[1] }}"
   - blockinfile: |
   dest: "*your destination*"
   content="{{ output.stdout[2] }}"

There might be a more efficient and better solution than this, but this is
what I found so far.

Regards,
Ajay


On Tue, Aug 14, 2018 at 7:13 PM Michael Ikram 
wrote:

> Hi Ajay,
>
>
>
> I managed to fix my script as below:
>
> ---
>
> - name: show version
>
>   hosts: "switches"
>
>   gather_facts: false
>
>   connection: local
>
>
>
>   vars:
>
> backup_root: /etc/ansible/backups
>
> cli:
>
>   host: "{{ inventory_hostname }}"
>
>   username: msawires
>
>   password: Irukandji.=
>
>
>
>   tasks:
>
> - name: GATHERING INFO
>
>   ios_command:
>
> commands:
>
>  - command: sh run | i hostname
>
>  - command: sh ip int brief | i 10.11.64
>
>  - command: sh ver | i Model Number|System Serial
>
> provider: "{{ cli }}"
>
>   register: config
>
>
>
> - copy:
>
> content: "{{ config.stdout[0] }}"
>
> dest: "{{ backup_root }}/{{ inventory_hostname
> }}/running-config_{{ timestamp.stdout }}"
>
> ...
>
>
>
> My problem now is I can save only first command, cannot save the other two
> in file, do you have any suggestion how to save all commands output in one
> file?
>
>
>
> Thank you,
>
> Michael
>
>
>
> *From: *Ajay Kumar Manukonda 
> *Sent: *Friday, 10 August 2018 10:23 AM
> *To: *ansible-project@googlegroups.com
> *Subject: *Re: [ansible-project] Re: cannot login to cisco switch using
> ansible
>
>
>
> At this point, I am almost out of ideas. I am sorry, I couldn't be of much
> help.
>
>
>
> One last thing you might want to try is turning of "gathering facts". Some
> devices have issues with that. You can do that by entering "gathering =
> explicit" in the ansible.cfg file.
>
>
>
> Regards,
>
> Ajay
>
>
>
> On Thu, Aug 9, 2018 at 5:04 PM Michael Ikram 
> wrote:
>
>
>
> Hi Ajay,
>
>
>
> I tried with -k, it does not work
>
>
>
> netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml
> -k
>
> SSH password:
>
>
>
> PLAY [10.11.32.100]
> 
>
>
>
> TASK [Gathering Facts]
> *
>
> [WARNING]: sftp transfer mechanism failed on [10.11.32.100]. Use
> ANSIBLE_DEBUG=1 to see detailed information
>
> [WARNING]: scp transfer mechanism failed on [10.11.32.100]. Use
> ANSIBLE_DEBUG=1 to see detailed information
>
> fatal: [10.11.32.100]: UNREACHABLE! => {"changed": false, "msg": "SSH
> Error: data could not be sent to remote host \"10.11.32.100\". Make sure
> this host can be reached over ssh", "unreachable": true}
>
> [WARNING]: Could not create retry file '/etc/ansible/ios.retry'.
> [Errno 13] Permission denied: u'/etc/ansible/ios.retry'
>
>
>
> PLAY RECAP
> *
>
> 10.11.32.100   : ok=0changed=0unreachable=1
> failed=0
>
>
>
>
>
>
>
> Here is the output of -vvv
>
>
>
>
>
> netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml
> -vvv
>
> ansible-playbook 2.5.7
>
>   config file = /etc/ansible/ansible.cfg
>
>   configured module search path =
> [u'/home/netadmin/.ansible/plugins/modules',
> u'/usr/share/ansible/plugins/modules']
>
>   ansible python module location = /usr/lib/python2.7/dist-packages/ansible
>
>   executable location = /usr/bin/ansible-playbook
>
>   python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
>
> Using /etc/ansible/ansible.cfg as config file
>
> Parsed /etc/ansible/hosts inventory source with ini plugin
>
>
>
> PLAYBOOK: ios.yml
> **
>
> 1 plays in ios.yml
>
>
>
> PLAY [10.11.32.100]
> 
>
>
>
> TASK [Gathering Facts]
> 

Re: [ansible-project] webserver secure

2018-08-16 Thread 'Felix Fontein' via Ansible Project
Hi,

> how do you currently do your certs? you can either use the letsencrypt
> modules,

the letsencrypt module was renamed to acme_certificate (to not violate
Let's Encrypt's trademark) for Ansible 2.6.
(The renamed module's documentation: 
https://docs.ansible.com/ansible/latest/modules/acme_certificate_module.html)

Note that it's also possible to use acme-tiny
(https://github.com/diafygi/acme-tiny/) with Ansible using the
openssl_certificate module
(https://docs.ansible.com/ansible/latest/modules/openssl_certificate_module.html).
Depending on your use-case, this can be much simpler than using the
acme_certificate module. There are also roles encapsulating the
acme_certificate module and make it easier to use (for example, one by
myself: https://github.com/felixfontein/acme-certificate/).

Cheers,
Felix



> use copy to put it on webserver you build or use get_url.
> You can also do the same for the webserver config you are using. You
> can also template the config file.
> 
> On Thu, Aug 16, 2018 at 1:15 PM coach rhca 
> wrote:
> 
> > Hi,
> >
> > Trying to create an ec2 instance using ansible. which will host a
> > normal webserver but not sure on how to add the self signed
> > certificate to the http - webserver using ansible.
> > Also how to redirect all the http request to https one using
> > ansible. Could you please suggest. 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/20180816192846.64d5a570%40rovaniemi.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] webserver secure

2018-08-16 Thread Jonathan Lozada De La Matta
Coach,

how do you currently do your certs? you can either use the letsencrypt
modules, use copy to put it on webserver you build or use get_url. You can
also do the same for the webserver config you are using. You can also
template the config file.

On Thu, Aug 16, 2018 at 1:15 PM coach rhca  wrote:

> Hi,
>
> Trying to create an ec2 instance using ansible. which will host a normal
> webserver but not sure on how to add the self signed certificate to the
> http - webserver using ansible.
> Also how to redirect all the http request to https one using ansible.
> Could you please suggest. 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/afe8c42d-c0ec-46af-b8be-ed09b473e6b0%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Jonathan lozada de la matta

AUTOMATION CONSULTANT - AUTOMATION PRACTICE

Red Hat Consulting Services 

jloza...@redhat.com

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


[ansible-project] webserver secure

2018-08-16 Thread coach rhca
Hi,

Trying to create an ec2 instance using ansible. which will host a normal 
webserver but not sure on how to add the self signed certificate to the 
http - webserver using ansible. 
Also how to redirect all the http request to https one using ansible. Could 
you please suggest. 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/afe8c42d-c0ec-46af-b8be-ed09b473e6b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Use of vmware_guest module

2018-08-16 Thread Dimitri Yioulos
Doing this"

---

- hosts: localhost
  gather_facts: false
  *serial: 1*

  vars:
  ~

doesn't seem to help.  Any help would be appreciated.

On Tuesday, August 14, 2018 at 3:38:03 PM UTC-4, Dimitri Yioulos wrote:
>
> Hello, all.
>
> I need to create a playbook which will include shutting down, then 
> restarting, six virtual machines.  The shut-downs/start-ups must be done on 
> the machines in specific order (start-ups in reverse order of shut-downs).  
> Since they are virtual, I was thinking of using the vmware_guest module.  I 
> know that it works for a single machine at a time, such as:
>
> ---
>
> - hosts: localhost
>   gather_facts: false
>
>   vars:
> vsphere_host: 10.0.101.17
> vsphere_username: user
> vsphere_password: password
> vsphere_guestname: vmname
> vm_state: restarted #poweredon shutdownguest restarted
>
>   tasks:
> - name: boot vmware guest
>   vmware_guest:
>  hostname: "{{ vsphere_host }}"
>  username: "{{ vsphere_username }}"
>  password: "{{ vsphere_password }}"
>  validate_certs: no
>  name: "{{ vsphere_guestname }}"
>  wait_for_ip_address: no
>  state: "{{ vm_state }}"
>
> But, is there a way to specify all the machines to be shut down/brought 
> up, in the order that I'd like that to happen?  If so, how?
>
> 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/c8484469-9e9e-4875-90b8-83b118720a17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] only show run give error

2018-08-16 Thread Kai Stian Olstad
On Thursday, 16 August 2018 04.40.02 CEST nbctcp wrote:
> Hi,
> I have working playbook to cisco on eve-ng.
> It will give error only when I want to run "show run".
> Other commands like "show version" "show clock" all ok
> 
> Please help
> tq
> 
> # cat showrun.yml
> ---
> - name: Run multiple commands
>   connection: network_cli
>   hosts: cisco1
>   gather_facts: true
>   tasks:
> - name: run multiple commands
>   ios_command:
> commands:
> - show run
> #- show version | i Version
> #- show clock
> #- show interfaces
>   register: output
>   #- name: copy output to file
>   #copy: content="{{ output.stdout[0] }}" dest=./output/{{ 
> inventory_hostname }}.txt
> - debug: var=output.stdout_lines

show run need enable if I remember correctly.
How to use enable with network_cli is documented here
https://docs.ansible.com/ansible/2.6/network/user_guide/platform_ios.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/1790380.BWmvFHppD6%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread SUMIT SAHAY
Thanks Pshem for your reply.

ansible-pull -U [git_url] -k playbook.yml --limit localhost

I am using this command to run the ansible pull, while doing this I am
getting one error, unable to resolve the error.


"msg": "Failed to download remote objects and refs:  Host key verification
failed.\r\nfatal: Could not read from remote repository.\n\nPlease make
sure you have the correct access rights\nand the repository exists.\n"

Can you please help me out on this


Looking forward for your reply


Thanks & Regards
Sumit Sahay
07044112109

On Thu, Aug 16, 2018 at 3:56 PM, Pshem Kowalczyk  wrote:

> Hi,
>
> That's correct, in pull mode ansible modifies and sets things on the
> machine on which it runs. The easiest way of providing inventory in this
> case is via command line:
>
> -i $(hostname),
>
> Please note the comma at the end.
>
> kind regards
> Pshem
>
>
> On Wed, 15 Aug 2018 at 02:55 SUMIT SAHAY  wrote:
>
>> Thanks for your reply Jonathan.
>> localhost : from where we are triggering command.
>> This is what you want to say?
>>
>> Looking forward for your reply.
>>
>> Regards
>> Sumit Sahay
>> 07044112109
>>
>> On Tue, Aug 14, 2018, 7:44 PM Jonathan Lozada De La Matta <
>> jloza...@redhat.com> wrote:
>>
>>> usually ansible-pull its used on localhost and not other hosts. If you
>>> are trying to do other host then use regular ansible. Ansible-pull is a
>>> different use case.
>>>
>>> On Tue, Aug 14, 2018 at 8:26 AM SUMIT SAHAY 
>>> wrote:
>>>
 Thanks Jonathan, for your reply.

 No, I am not using localhost, I want to run my playbook on ubuntu host
 which I set up in my host file, and the host file is located in
 /home/test/sumit/

 How to run this so that it will pick up the host and execute on ubuntu
 remote host.

 Looking forward for your reply.

 Thanks & Regards
 Sumit Sahay
 7044112109 <(704)%20411-2109>


 On Tue, Aug 14, 2018 at 5:17 PM, Jonathan Lozada De La Matta <
 jloza...@redhat.com> wrote:

> what hosts are on your playbook? is it localhost?
>
> On Tue, Aug 14, 2018 at 3:07 AM SUMIT SAHAY 
> wrote:
>
>> Thanks Balz, for your reply.
>>
>> Could you help me with the command for ansible pull, I installed git
>> and repository and I committed the ansible playbook there now I want to 
>> run
>> this from my localhost server following command I am using but getting
>> error,
>>
>> ansible-pull -U https://repourl.com/git/user_name/git_location -k -i
>> /home/test/hosts playbook.yml
>>
>> getting error saying skipping the hosts.
>>
>> Could you please navigate me to the correct command.
>>
>> Looking forward for your reply.
>>
>> Regards
>> Sumit Sahay
>> 7044112109 <(704)%20411-2109>
>>
>> On Wednesday, 8 August 2018 22:43:53 UTC+5:30, balz.as...@unibas.ch
>> wrote:
>>>
>>> Hi Sumit
>>>
>>> We're using a wrapper around ansible-pull. We use it mainly for
>>> clients but we've a step-by-step guide you might find helpful:
>>> https://github.com/ANTS-Framework/ants
>>>
>>> Regards
>>> Balz
>>>
>>> Am Mittwoch, 8. August 2018 08:03:45 UTC+2 schrieb SUMIT SAHAY:


 Hi All,

 I am trying to setup the ansible pull based on my vm server.

 Is there any step-wise documentation for this?


 Regards
 Sumit Sahay
 7044112109 <(704)%20411-2109>

>>>
 --
>> 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/ceb0cea7-7919-45f0-8288-
>> e7ac8341cb57%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
>
> Jonathan lozada de la matta
>
> AUTOMATION CONSULTANT - AUTOMATION PRACTICE
>
> Red Hat Consulting Services 
>
> jloza...@redhat.com
>
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/W9jYFiNta_A/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view 

Re: [ansible-project] Ansible "replace" & "lineinfile" issue

2018-08-16 Thread Dick Visser
On 16 August 2018 at 08:30, Kanhaiya Ashtekar
 wrote:
>
> I am having a requirement where I need to replace/comment a line from 
> rsyslog.conf file
> I am unable to correctly state the regexp. Please Help.
>
> INADEQUATE INFORMATION AVAILABLE ONLINE.
>
> I have been testing the following script which is failing:
>
>
> YAML using "lineinfile"
> ---
> - name: Comment out *.*@10.1.0.100 line in /etc/rsyslog.conf
>   lineinfile:
>   path: /etc/rsyslog.conf
>   regexp: '^*\.*@10\.1\.0\.100)'
>   line: '# *.* @10.1.0.100'
>



Your regex has a closing parenthesis but no starting one.
Also, the wildcard character needs to be escaped.
If your goal is to comment out whatever you matched first, then it
makes sense to use backrefs in the substituted line.
You should also use the $ to match the end of the string.
In this specific case it won't be a problem (i.e. there are probably
no instances like *.*@10.1.0.1000), but suppose you wanted to match:

*.*@10.1.0.10

then without the $ this would also match *.*@10.1.0.100, *.*@10.1.0.104, etc

This should work for you:


- name: Comment out *.*@10.1.0.100 line in /etc/rsyslog.conf
  lineinfile:
path: /etc/rsyslog.conf
regexp: '^(\*\.\*@10\.1\.0\.100)'
line: '#\1'
backrefs: yes


BTW that screen capture is huge and makes it hard to read the
message... you might want to just copy/paste the text next time...


Dick

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


Re: [ansible-project] Re: ansible-pull configuration

2018-08-16 Thread Pshem Kowalczyk
Hi,

That's correct, in pull mode ansible modifies and sets things on the
machine on which it runs. The easiest way of providing inventory in this
case is via command line:

-i $(hostname),

Please note the comma at the end.

kind regards
Pshem


On Wed, 15 Aug 2018 at 02:55 SUMIT SAHAY  wrote:

> Thanks for your reply Jonathan.
> localhost : from where we are triggering command.
> This is what you want to say?
>
> Looking forward for your reply.
>
> Regards
> Sumit Sahay
> 07044112109
>
> On Tue, Aug 14, 2018, 7:44 PM Jonathan Lozada De La Matta <
> jloza...@redhat.com> wrote:
>
>> usually ansible-pull its used on localhost and not other hosts. If you
>> are trying to do other host then use regular ansible. Ansible-pull is a
>> different use case.
>>
>> On Tue, Aug 14, 2018 at 8:26 AM SUMIT SAHAY 
>> wrote:
>>
>>> Thanks Jonathan, for your reply.
>>>
>>> No, I am not using localhost, I want to run my playbook on ubuntu host
>>> which I set up in my host file, and the host file is located in
>>> /home/test/sumit/
>>>
>>> How to run this so that it will pick up the host and execute on ubuntu
>>> remote host.
>>>
>>> Looking forward for your reply.
>>>
>>> Thanks & Regards
>>> Sumit Sahay
>>> 7044112109 <(704)%20411-2109>
>>>
>>>
>>> On Tue, Aug 14, 2018 at 5:17 PM, Jonathan Lozada De La Matta <
>>> jloza...@redhat.com> wrote:
>>>
 what hosts are on your playbook? is it localhost?

 On Tue, Aug 14, 2018 at 3:07 AM SUMIT SAHAY 
 wrote:

> Thanks Balz, for your reply.
>
> Could you help me with the command for ansible pull, I installed git
> and repository and I committed the ansible playbook there now I want to 
> run
> this from my localhost server following command I am using but getting
> error,
>
> ansible-pull -U https://repourl.com/git/user_name/git_location -k -i
> /home/test/hosts playbook.yml
>
> getting error saying skipping the hosts.
>
> Could you please navigate me to the correct command.
>
> Looking forward for your reply.
>
> Regards
> Sumit Sahay
> 7044112109 <(704)%20411-2109>
>
> On Wednesday, 8 August 2018 22:43:53 UTC+5:30, balz.as...@unibas.ch
> wrote:
>>
>> Hi Sumit
>>
>> We're using a wrapper around ansible-pull. We use it mainly for
>> clients but we've a step-by-step guide you might find helpful:
>> https://github.com/ANTS-Framework/ants
>>
>> Regards
>> Balz
>>
>> Am Mittwoch, 8. August 2018 08:03:45 UTC+2 schrieb SUMIT SAHAY:
>>>
>>>
>>> Hi All,
>>>
>>> I am trying to setup the ansible pull based on my vm server.
>>>
>>> Is there any step-wise documentation for this?
>>>
>>>
>>> Regards
>>> Sumit Sahay
>>> 7044112109 <(704)%20411-2109>
>>>
>>
>>> --
> 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/ceb0cea7-7919-45f0-8288-e7ac8341cb57%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 --

 Jonathan lozada de la matta

 AUTOMATION CONSULTANT - AUTOMATION PRACTICE

 Red Hat Consulting Services 

 jloza...@redhat.com




 --
 You received this message because you are subscribed to a topic in the
 Google Groups "Ansible Project" group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/ansible-project/W9jYFiNta_A/unsubscribe
 .
 To unsubscribe from this group and all its topics, send an email to
 ansible-project+unsubscr...@googlegroups.com.
 To post to this group, send email to ansible-project@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CAFYJA%2BLARn5QZ8L8SqNO%2BSE-iDO16AnfMEcFcqqnrx%2Be6r4WRQ%40mail.gmail.com
 
 .

 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>>
>>> --
>>> Sumit Sahay
>>> 9353031613
>>>
>>> --
>>> 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] Re: Ansible - "pyvmomi module required" error

2018-08-16 Thread 董小呆
Hi, i meet the same issue, are you how to solved ?

PLAY [Revert the given snapshot for virtual machines] 
***

TASK [Gathering Facts] 
**
ok: [localhost]

TASK [get vm state] 
*
fatal: [localhost]: FAILED! => {"changed": false, "msg": "PyVmomi Python 
module required. Install using \"pip install PyVmomi\""}
to retry, use: --limit @/etc/ansible/Vm_rollback_snapshost.retry

PLAY RECAP 
**
localhost  : ok=1changed=0unreachable=0failed=1

Gathering Facts - 
2.76s
get vm state  
1.30s

Playbook finished: Thu Aug 16 16:41:51 2018, 2 total tasks.  0:00:04 
elapsed.

[root@Georgeoelv1 ansible]# pip list | grep pyvmomi
pyvmomi  6.7.0
[root@Georgeoelv1 ansible]#




在 2018年1月17日星期三 UTC+8上午3:29:43,ludm...@gmail.com写道:
>
> When I add the following section to otherwise working ansible playbook:
>
> - name: Revert to a snapshot
>   vmware_guest_snapshot:
> hostname: myvcenter
> username: myusername
> password: mypassword
> datacenter: myvcenter
> folder: myfolder
> name: guestname
> state: revert
> snapshot_name: snapshotname
>
> and run:
>
> ansible-playbook myplaybook
>
> I get the following error:
>
> TASK [Revert to a snapshot] 
> ***
> fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "pyvmomi module 
> required"}
>
>
> I was referencing the ansible documentation, linked below:
>
> http://docs.ansible.com/ansible/latest/vmware_guest_snapshot_module.html
>
> Here's some info about my ansible server:
>
> [root@ansible ansible]# uname -a
> Linux ansible 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 
> 2017 x86_64 x86_64 x86_64 GNU/Linux
>
> [root@ansible ansible]# cat /etc/*release
> CentOS release 6.9 (Final)
>
> [root@ansible ansible]# ansible --version
> ansible 2.4.2.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u'/root/.ansible/plugins/modules', u
> '/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.6/site-packages/
> ansible
>   executable location = /usr/bin/ansible
>   python version = 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 
> 20120313 (Red Hat 4.4.7-17)]
>
> [root@ansible ansible]# pip list | grep pyvmomi
> DEPRECATION: Python 2.6 is no longer supported by the Python core team, 
> please upgrade your Python. A future version of pip will drop support for 
> Python 2.6
> DEPRECATION: The default format will switch to columns in the future. You 
> can use --format=(legacy|columns) (or define a format=(legacy|columns) in 
> your pip.conf under the [list] section) to disable this warning.
> pyvmomi (6.5.0.2017.5.post1)
>
> I tried googling for the error, but wasn't able to find any solutions so 
> far. I would appreciate any help, regarding this issue.
>
> Thank you!
>
>
在 2018年1月17日星期三 UTC+8上午3:29:43,ludm...@gmail.com写道:
>
> When I add the following section to otherwise working ansible playbook:
>
> - name: Revert to a snapshot
>   vmware_guest_snapshot:
> hostname: myvcenter
> username: myusername
> password: mypassword
> datacenter: myvcenter
> folder: myfolder
> name: guestname
> state: revert
> snapshot_name: snapshotname
>
> and run:
>
> ansible-playbook myplaybook
>
> I get the following error:
>
> TASK [Revert to a snapshot] 
> ***
> fatal: [x.x.x.x]: FAILED! => {"changed": false, "msg": "pyvmomi module 
> required"}
>
>
> I was referencing the ansible documentation, linked below:
>
> http://docs.ansible.com/ansible/latest/vmware_guest_snapshot_module.html
>
> Here's some info about my ansible server:
>
> [root@ansible ansible]# uname -a
> Linux ansible 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 
> 2017 x86_64 x86_64 x86_64 GNU/Linux
>
> [root@ansible 

[ansible-project] Ansible "replace" & "lineinfile" issue

2018-08-16 Thread Kanhaiya Ashtekar
I am having a requirement where I need to replace/comment a line from 
rsyslog.conf file 
I am unable to correctly state the regexp. Please Help.

INADEQUATE INFORMATION AVAILABLE ONLINE.

I have been testing the following script which is failing:


YAML using "lineinfile"
---
- name: Comment out *.*@10.1.0.100 line in /etc/rsyslog.conf
  lineinfile:
  path: /etc/rsyslog.conf
  regexp: '^*\.*@10\.1\.0\.100)'
  line: '# *.* @10.1.0.100'


YAML using "replace"
---

- name: Comment out *.*@10.1.0.100 line in /etc/rsyslog.conf
  replace:
  path: /etc/rsyslog.conf
  regexp: '*.* @10.1.0.100'
  replace: '# *.* @10.1.0.100'
  

[image: ansible_issue.PNG] 


PLEASE HELP. 

## CHECKED WITH ANSIBLE 2.6 DOCUMENTATION. FOLLOWED THE GIVEN INFORMATION. 
#
## YET HAVING ISSUE WITH PARSING THE "REGEXP" and "REPLACE"ing  
   #


-- 
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/255d4307-4522-49ec-af91-ab119b9f6d21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.