[ansible-project] Need assistance to write script to find free space in all member switches (not just master switch)

2021-03-11 Thread Vikram S


Problem: In a stacked switch, 'ansible_net_filesystems_info' of ios_facts 
module only shows total and free space of master switch. It doesn't show 
space of member switch. But I need to write a script that will check for 
certain amount of free space in EVERY member switch before copying ios 
image.


A workaround idea i have is to execute below command and make ansible store 
free space of every member switch in a custom variable. Then is it possible 
to somehow tell ansible to check if the value in variable (free space value 
listed below) should be higher than 50 MB before copying image?

Or do you have any other suggestion?


*sh flash2: | i bytes free*

122185728 bytes total (*9308672 bytes free*)


sh flash3: | i bytes free

122185728 bytes total (9304874 bytes free)


Thanks,

Vikram

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1d5c324b-ffc9-4f1c-87e8-7348681e7b99n%40googlegroups.com.


[ansible-project] Ansible-3.1.0 release and ansible-4.0 alpha1 delay

2021-03-11 Thread Toshio Kuratomi
Hi all,

We're happy to announce that the ansible-3.1.0 package is now
available! This update contains bugfixes and new, backwards compatible
features in the contained collections.

If you would like to learn about how and why we got to version 3.0.0,
we invite you to visit our blog for the background as well as a Q:

- https://www.ansible.com/blog/announcing-the-community-ansible-3.0.0-package
- https://www.ansible.com/blog/ansible-3.0.0-qa

How to get it
-

Due to a limitation in pip, if you are upgrading from Ansible 2.9 (or
earlier), you need to uninstall ansible before installing the 3.x
version:

```
$ pip uninstall ansible
$ pip install ansible==3.1.0 --user
```

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

* Ansible 3.1.0
https://pypi.python.org/packages/source/a/ansible/ansible-3.1.0.tar.gz
SHA256: 8a8faab85161f2e6d173d9e0885b1c3ab43fedf419691122e1547fb65eb982d1

What's new in Ansible 3.1.0
---

* The Ansible package has moved to semantic versioning
(https://semver.org/). This standard allows you to tell if a new
version of Ansible contains incompatibilities by looking at the
version number. We've moved from 3.0.0 to 3.1.0 to show that this
release should be backwards compatible with Ansible-3.0.0 but may
contain new features.  Read the semver specification for more
information.

* This release catches the ansible-3.x series up with the collection
versions in the last ansible-2.10.x release, ansible-2.10.7.  The
collections in this release should all be the same version or newer
than what was in 2.10.7.

* Collections which have opted into being a part of the Ansible-3.1.0
unified changelog will have an entry on this page:
  * 
https://github.com/ansible-community/ansible-build-data/blob/main/3/CHANGELOG-v3.rst#v3-1-0

* For collections which have not opted into the unified changelog,
consult the list of included collections in the link below and check
their entry on https://galaxy.ansible.com for information about their
changes.
  * 
https://github.com/ansible-community/ansible-build-data/blob/main/3/ansible-3.1.0.deps

* You can find more information for those on
https://galaxy.ansible.com/. For instance, the community.crypto
collection listed in the ansible-3.1.0.deps file has a galaxy page at
https://galaxy.ansible.com/community/crypto/

* Changelog for ansible-base-2.10.6 which this release of ansible
installs: 
https://github.com/ansible/ansible/blob/stable-2.10/changelogs/CHANGELOG-v2.10.rst

What's the schedule for new Ansible releases after 3.1.0?
-

* Except for ansible-2.9.x, older versions of ansible are not seeing
maintenance releases.  If there is a desire for maintenance releases
of older versions, drop by a Community Working Group Meeting to
discuss how you can help. (
https://github.com/ansible/community/tree/main/meetings#wednesdays )

* Minor releases of ansible-3 will be released approximately every
three weeks.  Since we're now using semantic versioning, these new
releases will be 3.1.0, 3.2.0, etc.  They will contain bugfixes and
new features but no backwards incompatibilities.
  * Expect 3.2.0 around March 30.

* We're currently planning to release Ansible-4.0.0 in the middle of
May, roughly a month after Ansible-core-2.11 releases.  See the
Ansible 4 Roadmap for details:
https://docs.ansible.com/ansible/devel/roadmap/COLLECTIONS_4.html
  * We're having to rework some of our release tools due to the rename
of the ansible-base package to ansible-core so ansible-4.0.0alpha1 has
been delayed.  We hope to have it released next week.

Porting Help
-

There's a unified porting guide for collections which have opted-in.
You can find that at:
https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/porting_guides/porting_guide_2.10.rst

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPrnkaSYXXVk2s_to%3Dj%3DcPmdEL4Yqfy5499gM%3DZmLQsiizLt5g%40mail.gmail.com.


[ansible-project] Module azure_rm_deployment getting OpenSSL.SSL.Error: [('SSL routines', 'ssl3_write_pending', 'bad write retry')]

2021-03-11 Thread mathew...@gmail.com
Hi 

I tried to use azure_rm_deployment  module for deployment and getting 
OpenSSL.SSL.Error: [('SSL routines', 'ssl3_write_pending', 'bad write 
retry')] error. here is more details.
self._raise_ssl_error(self._ssl, result)\n  File 
\"/var/lib/awx/venv/ansible/lib/python2.7/site-packages/OpenSSL/SSL.py\", 
line 1671, in _raise_ssl_error\n_raise_current_error()\n  File 
\"/var/lib/awx/venv/ansible/lib/python2.7/site-packages/OpenSSL/_util.py\", 
line 54, in exception_from_error_queue\nraise 
exception_type(errors)\nOpenSSL.SSL.Error: [('SSL routines', 
'ssl3_write_pending', 'bad write retry')]\n",

Anybody know the root cause. Thanks in advance.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b3d53379-cc70-4471-8296-86de9f455fbdn%40googlegroups.com.


[ansible-project] become_user with prompt

2021-03-11 Thread Alejandro Larzabal
Hello,

How can I respond to a user prompt that happens upon authentication?

Like 'expect' enables us to respond to command prompts, but the prompt in 
question happens when the user logs in, not after a command.

Does ansible support that?

Thanks,

Alex.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1bd115de-27b6-4823-a744-e8c31578cbffn%40googlegroups.com.


Re: [ansible-project] any_errors_fatal doesn't fail with unreachable hosts

2021-03-11 Thread 'Mark Faine' via Ansible Project
I don't know what to tell you, it does for me.

Sent from ProtonMail mobile

 Original Message 
On Mar 11, 2021, 09:52, Jorge Rúa wrote:

> I've tried the following with a vanilla ansible.cfg (nothing but defaults)
>
> mkdir ~/temp
>
> ➜ temp cat test.yml
> - hosts: all
> serial: 1
> max_fail_percentage: 1
> gather_facts: false
> tasks:
> - ping:
>
> ➜ temp cat inventory
> [all]
> unreachable
> localhost
> ➜ temp ansible-playbook -i inventory test.yml -k
> SSH password:
>
> PLAY [all] 
> 
>
> TASK [ping] 
> ***
> fatal: [unreachable]: UNREACHABLE! => {"changed": false, "msg": "Failed to 
> connect to the host via ssh: ssh: Could not resolve hostname unreachable: 
> Name or service not known", "unreachable": true}
>
> PLAY RECAP 
> 
> unreachable : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 
> ignored=0
> As you can see it does not continue with localhost, which will succeed if I 
> revert the inventory order.
>
> Regards,
>
> El jue, 11 mar 2021 a las 16:41, Mark Faine () escribió:
>
>> So, you guys think I should file an issue for this? I don't know what else 
>> to do.
>>
>> On Wednesday, March 10, 2021 at 4:18:54 PM UTC-6 Mark Faine wrote:
>>
>>> It still continues on after failing, it just does so one host at a time.
>>>
>>> PLAY [Ping] 
>>> **
>>>
>>> TASK [Ping Servers] 
>>> **
>>> fatal: [myhost1]: UNREACHABLE! => {"changed": false, "msg": "Data could not 
>>> be sent to remote host \"myhost1\". Make sure this host can be reached over 
>>> ssh: ", "unreachable": true}
>>>
>>> NO MORE HOSTS LEFT 
>>> ***
>>>
>>> NO MORE HOSTS LEFT 
>>> ***
>>>
>>> PLAY [Ping] 
>>> **
>>>
>>> TASK [Ping Servers] 
>>> **
>>> fatal: [myhost2]: UNREACHABLE! => {"changed": false, "msg": "Data could not 
>>> be sent to remote host \"myhost2\". Make sure this host can be reached over 
>>> ssh: ", "unreachable": true}
>>>
>>> NO MORE HOSTS LEFT 
>>> ***
>>>
>>> NO MORE HOSTS LEFT 
>>> ***
>>>
>>> PLAY [Ping] 
>>> **
>>>
>>> TASK [Ping Servers] 
>>> **
>>> ...
>>> On Wednesday, March 10, 2021 at 3:44:50 PM UTC-6 jruar...@gmail.com wrote:
>>>
 What happens if you add serial:1 and max_fail_percentage:1 and removing 
 any_errors_fatal directive?

 On Wed, Mar 10, 2021, 21:35 Mark Faine  wrote:

> I'm trying to ping servers and fail immediately at the first one that is 
> unreachable. However, this doesn't seem to work. I found this old issue 
> about it but apparently it hasn't been resolved. 
> https://github.com/ansible/ansible/issues/16475
>
> ---
> - name: Ping
> hosts: all
> gather_facts: false
> any_errors_fatal: true
> tasks:
> - name: Ping Servers
> ping:
>
> I've purposely poisoned the inventory and yet it just says those hosts 
> are unreachable and continues on its way, it should fail at the first 
> unreachable host.
>
> Thanks,
> -Mark

> 

Re: [ansible-project] Re: Ansible upgrade cisco switch stack firmware

2021-03-11 Thread madd...@gmail.com
Thanks Ganesh,

I'll give that a try and let you know.

On Thursday, March 11, 2021 at 10:32:15 AM UTC-5 gane...@gmail.com wrote:

> You can use cli_command module to handle multiple prompts on network 
> device.
> Refer: 
>
> https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/cli_command_module.html
>
> On Thu, 11 Mar 2021 at 8:37 PM, madd...@gmail.com  
> wrote:
>
>> I ended up running the following manually. I just need a way for ansible 
>> to wait for certain prompts and allow the process to complete without 
>> ansible failing the job. Again, any suggestions would be appreciated.
>>
>> Here is the manual command ran:
>>
>> 9200L-24T-4G-E_2#$*install add file 
>> flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit*
>> install_add_activate_commit: START Thu Mar 11 08:43:55 EST 2021
>>
>> System configuration has been modified.
>> Press Yes(y) to save the configuration and proceed.
>> Press No(n) for proceeding without saving the configuration.
>> Press Quit(q) to exit, you may save configuration and re-enter the 
>> command. *[y/n/q]y*
>> Modified configuration has been saved
>> Mar 11 08:44:10.982 %INSTALL-5-INSTALL_START_INFO: R0/0: install_engine: 
>> Started install one-shot flash:cat9k_lite_iosxe.16.12.04.SPA.bin
>> install_add_activate_commit: Adding PACKAGE
>> install_add_activate_commit: Checking whether new add is allowed 
>>
>> --- Starting initial file syncing ---
>> [1]: Copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin from switch 1 to 
>> switch 2
>> [2]: Finished copying to switch 2
>> Info: Finished copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin to the 
>> selected switch(es)
>> Finished initial file syncing
>>
>> --- Starting Add ---
>> Performing Add on all members
>>   [1] Add package(s) on switch 1
>>   [1] Finished Add on switch 1
>>   [2] Add package(s) on switch 2
>>   [2] Finished Add on switch 2
>> Checking status of Add on [1 2]
>> Add: Passed on [1 2]
>> Finished Add
>>
>> Image added. Version: 16.12.4.0.4480
>> install_add_activate_commit: Activating PACKAGE
>>
>> gzip: initramfs.cpio.gz: decompression OK, trailing garbage ignored
>> Following packages shall be activated:
>> /flash/cat9k_lite-webui.16.12.04.SPA.pkg
>> /flash/cat9k_lite-srdriver.16.12.04.SPA.pkg
>> /flash/cat9k_lite-rpboot.16.12.04.SPA.pkg
>> /flash/cat9k_lite-rpbase.16.12.04.SPA.pkg
>>
>> This operation may require a reload of the system. *Do you want to 
>> proceed? [y/n]y*
>> --- Starting Activate ---
>> Performing Activate on all members
>> Mar 11 08:53:53.512: %INSTALL-5-INSTALL_AUTO_ABORT_TIMER_PROGRESS: R0/0: 
>> rollback_timer: Install auto abort timer will expire in 7200 seconds
>>   [1] Activate package(s) on switch 1
>> --- Starting list of software package changes ---
>> Old files list:
>>   Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-webui.16.12.03a.SPA.pkg
>> New files list:
>>   Added cat9k_lite-rpbase.16.12.04.SPA.pkg
>>   Added cat9k_lite-rpboot.16.12.04.SPA.pkg
>>   Added cat9k_lite-srdriver.16.12.04.SPA.pkg
>>   Added cat9k_lite-webui.16.12.04.SPA.pkg
>> Finished list of software package changes
>>   [1] Finished Activate on switch 1
>>   [2] Activate package(s) on switch 2
>> --- Starting list of software package changes ---
>> Old files list:
>>   Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
>>   Removed cat9k_lite-webui.16.12.03a.SPA.pkg
>> New files list:
>>   Added cat9k_lite-rpbase.16.12.04.SPA.pkg
>>   Added cat9k_lite-rpboot.16.12.04.SPA.pkg
>>   Added cat9k_lite-srdriver.16.12.04.SPA.pkg
>>   Added cat9k_lite-webui.16.12.04.SPA.pkg
>> Finished list of software package changes
>>   [2] Finished Activate on switch 2
>> Checking status of Activate on [1 2]
>> Activate: Passed on [1 2]
>> Finished Activate
>>
>> --- Starting Commit ---
>> Performing Commit on all members
>>   [1] Commit package(s) on switch 1
>>   [1] Finished Commit on switch 1
>>   [2] Commit package(s) on switch 2
>>   [2] Finished Commit on switch 2
>> Checking status of Commit on [1 2]
>> Commit: Passed on [1 2]
>> Finished Commit
>>
>> Install will reload the system now!
>> SUCCESS: install_add_activate_commit  Thu Mar 11 08:55:16 EST 2021
>> Mar 11 08:55:17.946 %INSTALL-5-INSTALL_COMPLETED_INFO: R0/0: 
>> install_engine: Completed install one-shot PACKAGE 
>> flash:cat9k_lite_iosxe.16.12.04.SPA.bin
>> 9200L-24T-4G-E_2#
>>
>> On Thursday, March 11, 2021 at 12:17:13 AM UTC-5 madd...@gmail.com wrote:
>>
>>> I'm trying to update a cisco switch stack with ansible and I would like 
>>> to use the archive command, but that doesn't work with .bin files.
>>>
>>> For the 9200 series switches, I can only download .bin files.  
>>>
>>> I have tried:
>>> ios_command:
>>>   

Re: [ansible-project] blockinfile and lineinfile behaviour

2021-03-11 Thread Stu Lipshires
Sorry, a little new to this. So I don't know all the cluster names up 
front. I might create 1 cluster today and then tomorrow somebody will ask 
for a new cluster. My inventory file currently has the ip address of the VM 
Host that the ansible is running on. Is there something different that I 
should be doing? Do I have to read the existing host file and then add the 
new values? Can you point to a snippet that would do that? Thanks!

On Wednesday, March 10, 2021 at 4:42:34 AM UTC-5 brae...@gmail.com wrote:

> On 3/9/21 10:44 PM, Stu Lipshires wrote:
> > I have a Host VM that I am using to launch the creation of multiple 
> OpenShift Clusters. Every time I create a new
> > cluster, I need to update the /etc/hosts and dnsmasq.conf files of this 
> Host VM  with the new cluster endpoints.
> > I am using the following code block:
> >   - name: update hosts
> >   blockinfile:
> >  path: /etc/hosts
> >  block: |
> > ${var.network_lb_ip_address}  
> api.${var.cluster_id}.${var.base_domain}
> > ${var.network_lb_ip_address}  
> api-int.${var.cluster_id}.${var.base_domain}
> >  state: present
> > - name: update dnsmasq
> >   lineinfile:
> >  path: /etc/dnsmasq.conf
> >  line: 
> address=/.apps.${var.cluster_id}.${var.base_domain}/${var.network_lb_ip_address}
> >  state: present
> > 
> > What it is doing is instead of adding a new block when I create a new 
> cluster with new ip's and ranges, it simply
> > replaces the existing block with the new info so I only ever have 1 
> cluster's info. When the file started out there was
> > no managed block. The first time I ran the script, it added the block . 
> What I currently get after the 2nd run is 
> > 
> > # BEGIN ANSIBLE MANAGED BLOCK
> > 172.16.0.20  api.ocp2.cdastu.com
> > 172.16.0.20  api-int.ocp2.cdastu.com
> > # END ANSIBLE MANAGED BLOCK
> > 
> > What I would like after the 2nd run is :
> > # BEGIN ANSIBLE MANAGED BLOCK
> > 172.16.0.19  api.ocp1.cdastu.com
> > 172.16.0.19  api-int.ocp1.cdastu.com
> > 172.16.0.20  api.ocp2.cdastu.com
> > 172.16.0.20  api-int.ocp2.cdastu.com
> > # END ANSIBLE MANAGED BLOCK
> > 
> > I also had the ever so slight idea that Ansible could delete the entries 
> that it created when I delete the cluster. Thanks!
>
> Hello,
>
> do make this work in a proper fashion, you need to have *all* clusters in 
> your inventory and not the current one on its
> own.
>
> Regards
> Racke
>
> > 
> > -- 
> > 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  ansible-proje...@googlegroups.com>.
> > To view this discussion on the web visit
> > 
> https://groups.google.com/d/msgid/ansible-project/f11e46e7-a87c-412f-9a93-07be7053878dn%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/ansible-project/f11e46e7-a87c-412f-9a93-07be7053878dn%40googlegroups.com?utm_medium=email_source=footer
> >.
>
>
> -- 
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/504e9ef4-bb07-40cd-afb3-3ea1b7466976n%40googlegroups.com.


Re: [ansible-project] any_errors_fatal doesn't fail with unreachable hosts

2021-03-11 Thread Jorge Rúa
I've tried the following with a vanilla ansible.cfg (nothing but defaults)

mkdir ~/temp

➜  temp cat test.yml
- hosts: all
  serial: 1
  max_fail_percentage: 1
  gather_facts: false
  tasks:
- ping:

➜  temp cat inventory
[all]
unreachable
localhost
➜  temp ansible-playbook -i inventory test.yml -k
SSH password:

PLAY [all]


TASK [ping]
***
fatal: [unreachable]: UNREACHABLE! => {"changed": false, "msg": "Failed to
connect to the host via ssh: ssh: Could not resolve hostname unreachable:
Name or service not known", "unreachable": true}

PLAY RECAP

unreachable: ok=0changed=0unreachable=1failed=0
   skipped=0rescued=0ignored=0

As you can see it does not continue with localhost, which will succeed if I
revert the inventory order.

Regards,









El jue, 11 mar 2021 a las 16:41, Mark Faine ()
escribió:

> So, you guys think I should file an issue for this?  I don't know what
> else to do.
>
> On Wednesday, March 10, 2021 at 4:18:54 PM UTC-6 Mark Faine wrote:
>
>> It still continues on after failing, it just does so one host at a time.
>>
>> PLAY [Ping]
>> **
>>
>> TASK [Ping Servers]
>> **
>> fatal: [myhost1]: UNREACHABLE! => {"changed": false, "msg": "Data could
>> not be sent to remote host \"myhost1\". Make sure this host can be reached
>> over ssh: ", "unreachable": true}
>>
>> NO MORE HOSTS LEFT
>> ***
>>
>> NO MORE HOSTS LEFT
>> ***
>>
>> PLAY [Ping]
>> **
>>
>> TASK [Ping Servers]
>> **
>> fatal: [myhost2]: UNREACHABLE! => {"changed": false, "msg": "Data could
>> not be sent to remote host \"myhost2\". Make sure this host can be reached
>> over ssh: ", "unreachable": true}
>>
>> NO MORE HOSTS LEFT
>> ***
>>
>> NO MORE HOSTS LEFT
>> ***
>>
>> PLAY [Ping]
>> **
>>
>> TASK [Ping Servers]
>> **
>> ...
>> On Wednesday, March 10, 2021 at 3:44:50 PM UTC-6 jruar...@gmail.com
>> wrote:
>>
>>>
>>>
>>> What happens if you add serial:1 and max_fail_percentage:1 and removing
>>> any_errors_fatal directive?
>>>
>>> On Wed, Mar 10, 2021, 21:35 Mark Faine  wrote:
>>>

 I'm trying to ping servers and fail immediately at the first one that
 is unreachable.  However, this doesn't seem to work.  I found this old
 issue about it but apparently it hasn't been resolved.
 https://github.com/ansible/ansible/issues/16475

 ---
 - name: Ping
   hosts: all
   gather_facts: false
   any_errors_fatal: true
   tasks:
 - name: Ping Servers
   ping:

 I've purposely poisoned the inventory and yet it just says those hosts
 are unreachable and continues on its way, it should fail at the first
 unreachable host.

 Thanks,
 -Mark

 --
 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 

Re: [ansible-project] any_errors_fatal doesn't fail with unreachable hosts

2021-03-11 Thread Mark Faine
So, you guys think I should file an issue for this?  I don't know what else 
to do.

On Wednesday, March 10, 2021 at 4:18:54 PM UTC-6 Mark Faine wrote:

> It still continues on after failing, it just does so one host at a time.
>
> PLAY [Ping] 
> **
>
> TASK [Ping Servers] 
> **
> fatal: [myhost1]: UNREACHABLE! => {"changed": false, "msg": "Data could 
> not be sent to remote host \"myhost1\". Make sure this host can be reached 
> over ssh: ", "unreachable": true}
>
> NO MORE HOSTS LEFT 
> ***
>
> NO MORE HOSTS LEFT 
> ***
>
> PLAY [Ping] 
> **
>
> TASK [Ping Servers] 
> **
> fatal: [myhost2]: UNREACHABLE! => {"changed": false, "msg": "Data could 
> not be sent to remote host \"myhost2\". Make sure this host can be reached 
> over ssh: ", "unreachable": true}
>
> NO MORE HOSTS LEFT 
> ***
>
> NO MORE HOSTS LEFT 
> ***
>
> PLAY [Ping] 
> **
>
> TASK [Ping Servers] 
> **
> ...
> On Wednesday, March 10, 2021 at 3:44:50 PM UTC-6 jruar...@gmail.com wrote:
>
>>
>>
>> What happens if you add serial:1 and max_fail_percentage:1 and removing 
>> any_errors_fatal directive? 
>>
>> On Wed, Mar 10, 2021, 21:35 Mark Faine  wrote:
>>
>>>
>>> I'm trying to ping servers and fail immediately at the first one that is 
>>> unreachable.  However, this doesn't seem to work.  I found this old issue 
>>> about it but apparently it hasn't been resolved.  
>>> https://github.com/ansible/ansible/issues/16475
>>>
>>> ---
>>> - name: Ping
>>>   hosts: all
>>>   gather_facts: false
>>>   any_errors_fatal: true
>>>   tasks:
>>> - name: Ping Servers
>>>   ping:
>>>
>>> I've purposely poisoned the inventory and yet it just says those hosts 
>>> are unreachable and continues on its way, it should fail at the first 
>>> unreachable host.
>>>
>>> Thanks,
>>> -Mark
>>>
>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/ansible-project/a8fdae92-0d13-4e80-a993-ba2e0b25e4bcn%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f55814f7-7b89-4503-b272-bac8b20c1ff6n%40googlegroups.com.


Re: [ansible-project] Re: Ansible upgrade cisco switch stack firmware

2021-03-11 Thread Ganesh Nalawade
You can use cli_command module to handle multiple prompts on network device.
Refer:
https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/cli_command_module.html

On Thu, 11 Mar 2021 at 8:37 PM, madd...@gmail.com 
wrote:

> I ended up running the following manually. I just need a way for ansible
> to wait for certain prompts and allow the process to complete without
> ansible failing the job. Again, any suggestions would be appreciated.
>
> Here is the manual command ran:
>
> 9200L-24T-4G-E_2#$*install add file
> flash:cat9k_lite_iosxe.16.12.04.SPA.bin activate commit*
> install_add_activate_commit: START Thu Mar 11 08:43:55 EST 2021
>
> System configuration has been modified.
> Press Yes(y) to save the configuration and proceed.
> Press No(n) for proceeding without saving the configuration.
> Press Quit(q) to exit, you may save configuration and re-enter the
> command. *[y/n/q]y*
> Modified configuration has been saved
> Mar 11 08:44:10.982 %INSTALL-5-INSTALL_START_INFO: R0/0: install_engine:
> Started install one-shot flash:cat9k_lite_iosxe.16.12.04.SPA.bin
> install_add_activate_commit: Adding PACKAGE
> install_add_activate_commit: Checking whether new add is allowed 
>
> --- Starting initial file syncing ---
> [1]: Copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin from switch 1 to
> switch 2
> [2]: Finished copying to switch 2
> Info: Finished copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin to the
> selected switch(es)
> Finished initial file syncing
>
> --- Starting Add ---
> Performing Add on all members
>   [1] Add package(s) on switch 1
>   [1] Finished Add on switch 1
>   [2] Add package(s) on switch 2
>   [2] Finished Add on switch 2
> Checking status of Add on [1 2]
> Add: Passed on [1 2]
> Finished Add
>
> Image added. Version: 16.12.4.0.4480
> install_add_activate_commit: Activating PACKAGE
>
> gzip: initramfs.cpio.gz: decompression OK, trailing garbage ignored
> Following packages shall be activated:
> /flash/cat9k_lite-webui.16.12.04.SPA.pkg
> /flash/cat9k_lite-srdriver.16.12.04.SPA.pkg
> /flash/cat9k_lite-rpboot.16.12.04.SPA.pkg
> /flash/cat9k_lite-rpbase.16.12.04.SPA.pkg
>
> This operation may require a reload of the system. *Do you want to
> proceed? [y/n]y*
> --- Starting Activate ---
> Performing Activate on all members
> Mar 11 08:53:53.512: %INSTALL-5-INSTALL_AUTO_ABORT_TIMER_PROGRESS: R0/0:
> rollback_timer: Install auto abort timer will expire in 7200 seconds
>   [1] Activate package(s) on switch 1
> --- Starting list of software package changes ---
> Old files list:
>   Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
>   Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
>   Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
>   Removed cat9k_lite-webui.16.12.03a.SPA.pkg
> New files list:
>   Added cat9k_lite-rpbase.16.12.04.SPA.pkg
>   Added cat9k_lite-rpboot.16.12.04.SPA.pkg
>   Added cat9k_lite-srdriver.16.12.04.SPA.pkg
>   Added cat9k_lite-webui.16.12.04.SPA.pkg
> Finished list of software package changes
>   [1] Finished Activate on switch 1
>   [2] Activate package(s) on switch 2
> --- Starting list of software package changes ---
> Old files list:
>   Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
>   Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
>   Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
>   Removed cat9k_lite-webui.16.12.03a.SPA.pkg
> New files list:
>   Added cat9k_lite-rpbase.16.12.04.SPA.pkg
>   Added cat9k_lite-rpboot.16.12.04.SPA.pkg
>   Added cat9k_lite-srdriver.16.12.04.SPA.pkg
>   Added cat9k_lite-webui.16.12.04.SPA.pkg
> Finished list of software package changes
>   [2] Finished Activate on switch 2
> Checking status of Activate on [1 2]
> Activate: Passed on [1 2]
> Finished Activate
>
> --- Starting Commit ---
> Performing Commit on all members
>   [1] Commit package(s) on switch 1
>   [1] Finished Commit on switch 1
>   [2] Commit package(s) on switch 2
>   [2] Finished Commit on switch 2
> Checking status of Commit on [1 2]
> Commit: Passed on [1 2]
> Finished Commit
>
> Install will reload the system now!
> SUCCESS: install_add_activate_commit  Thu Mar 11 08:55:16 EST 2021
> Mar 11 08:55:17.946 %INSTALL-5-INSTALL_COMPLETED_INFO: R0/0:
> install_engine: Completed install one-shot PACKAGE
> flash:cat9k_lite_iosxe.16.12.04.SPA.bin
> 9200L-24T-4G-E_2#
>
> On Thursday, March 11, 2021 at 12:17:13 AM UTC-5 madd...@gmail.com wrote:
>
>> I'm trying to update a cisco switch stack with ansible and I would like
>> to use the archive command, but that doesn't work with .bin files.
>>
>> For the 9200 series switches, I can only download .bin files.
>>
>> I have tried:
>> ios_command:
>>   commands:
>> - command: install add file
>> flash:cat9k_lite_iosxe.16.12.04.SPA.bin
>>   wait_for: result[0] contains SUCCESS
>>
>> That isn't working for me either. I may need to enter a timeout as well.
>>
>> Please let me know if you have any 

[ansible-project] Re: Ansible upgrade cisco switch stack firmware

2021-03-11 Thread madd...@gmail.com
I ended up running the following manually. I just need a way for ansible to 
wait for certain prompts and allow the process to complete without ansible 
failing the job. Again, any suggestions would be appreciated.

Here is the manual command ran:

9200L-24T-4G-E_2#$*install add file flash:cat9k_lite_iosxe.16.12.04.SPA.bin 
activate commit*
install_add_activate_commit: START Thu Mar 11 08:43:55 EST 2021

System configuration has been modified.
Press Yes(y) to save the configuration and proceed.
Press No(n) for proceeding without saving the configuration.
Press Quit(q) to exit, you may save configuration and re-enter the command. 
*[y/n/q]y*
Modified configuration has been saved
Mar 11 08:44:10.982 %INSTALL-5-INSTALL_START_INFO: R0/0: install_engine: 
Started install one-shot flash:cat9k_lite_iosxe.16.12.04.SPA.bin
install_add_activate_commit: Adding PACKAGE
install_add_activate_commit: Checking whether new add is allowed 

--- Starting initial file syncing ---
[1]: Copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin from switch 1 to 
switch 2
[2]: Finished copying to switch 2
Info: Finished copying flash:cat9k_lite_iosxe.16.12.04.SPA.bin to the 
selected switch(es)
Finished initial file syncing

--- Starting Add ---
Performing Add on all members
  [1] Add package(s) on switch 1
  [1] Finished Add on switch 1
  [2] Add package(s) on switch 2
  [2] Finished Add on switch 2
Checking status of Add on [1 2]
Add: Passed on [1 2]
Finished Add

Image added. Version: 16.12.4.0.4480
install_add_activate_commit: Activating PACKAGE

gzip: initramfs.cpio.gz: decompression OK, trailing garbage ignored
Following packages shall be activated:
/flash/cat9k_lite-webui.16.12.04.SPA.pkg
/flash/cat9k_lite-srdriver.16.12.04.SPA.pkg
/flash/cat9k_lite-rpboot.16.12.04.SPA.pkg
/flash/cat9k_lite-rpbase.16.12.04.SPA.pkg

This operation may require a reload of the system. *Do you want to proceed? 
[y/n]y*
--- Starting Activate ---
Performing Activate on all members
Mar 11 08:53:53.512: %INSTALL-5-INSTALL_AUTO_ABORT_TIMER_PROGRESS: R0/0: 
rollback_timer: Install auto abort timer will expire in 7200 seconds
  [1] Activate package(s) on switch 1
--- Starting list of software package changes ---
Old files list:
  Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
  Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
  Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
  Removed cat9k_lite-webui.16.12.03a.SPA.pkg
New files list:
  Added cat9k_lite-rpbase.16.12.04.SPA.pkg
  Added cat9k_lite-rpboot.16.12.04.SPA.pkg
  Added cat9k_lite-srdriver.16.12.04.SPA.pkg
  Added cat9k_lite-webui.16.12.04.SPA.pkg
Finished list of software package changes
  [1] Finished Activate on switch 1
  [2] Activate package(s) on switch 2
--- Starting list of software package changes ---
Old files list:
  Removed cat9k_lite-rpbase.16.12.03a.SPA.pkg
  Removed cat9k_lite-rpboot.16.12.03a.SPA.pkg
  Removed cat9k_lite-srdriver.16.12.03a.SPA.pkg
  Removed cat9k_lite-webui.16.12.03a.SPA.pkg
New files list:
  Added cat9k_lite-rpbase.16.12.04.SPA.pkg
  Added cat9k_lite-rpboot.16.12.04.SPA.pkg
  Added cat9k_lite-srdriver.16.12.04.SPA.pkg
  Added cat9k_lite-webui.16.12.04.SPA.pkg
Finished list of software package changes
  [2] Finished Activate on switch 2
Checking status of Activate on [1 2]
Activate: Passed on [1 2]
Finished Activate

--- Starting Commit ---
Performing Commit on all members
  [1] Commit package(s) on switch 1
  [1] Finished Commit on switch 1
  [2] Commit package(s) on switch 2
  [2] Finished Commit on switch 2
Checking status of Commit on [1 2]
Commit: Passed on [1 2]
Finished Commit

Install will reload the system now!
SUCCESS: install_add_activate_commit  Thu Mar 11 08:55:16 EST 2021
Mar 11 08:55:17.946 %INSTALL-5-INSTALL_COMPLETED_INFO: R0/0: 
install_engine: Completed install one-shot PACKAGE 
flash:cat9k_lite_iosxe.16.12.04.SPA.bin
9200L-24T-4G-E_2#

On Thursday, March 11, 2021 at 12:17:13 AM UTC-5 madd...@gmail.com wrote:

> I'm trying to update a cisco switch stack with ansible and I would like to 
> use the archive command, but that doesn't work with .bin files.
>
> For the 9200 series switches, I can only download .bin files.  
>
> I have tried:
> ios_command:
>   commands:
> - command: install add file 
> flash:cat9k_lite_iosxe.16.12.04.SPA.bin
>   wait_for: result[0] contains SUCCESS
>
> That isn't working for me either. I may need to enter a timeout as well. 
>
> Please let me know if you have any suggestions. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f5aa4119-9617-4077-b11b-8b9adb848ce1n%40googlegroups.com.