Re: [ansible-project] Re: Viptela Support on Ansible

2019-08-01 Thread Peter Sprygada
https://github.com/ciscodevnet/ansible-viptela

On Thu, Aug 1, 2019 at 3:41 PM 'Tcpip' via Ansible Project
 wrote:
>
> Hello,
>
> How can I configure the playbooks to work with multi-tenant.
>
> THanks.
>
> El jueves, 26 de julio de 2018, 9:47:04 (UTC-3), Eugene Wong escribió:
>>
>> Hi j-16375,
>>
>>
>> We are currently doing a POC with Viptela in the lab and I've written an 
>> Ansible Galaxy module for it.
>>
>> Do you want to try that?
>>
>> Installation is by these commands:
>>
>> pip install viptela-python --upgrade --force
>> ansible-galaxy install eugene_ky_wong.viptela_ansible --force
>>
>> To get the result you need the commands needed are:
>>
>> - cd to the directory which ansible-galaxy installed to
>> - modify variables.yml file to change the 'vManage_server' IP address and 
>> the 'ip_address' of your vEdge, and modify vault.yml for your login 
>> credentials.
>> - run 'ansible-playbook 4_get_interface_stats.yml'
>>
>> Do let me know how that goes!
>>
>>
>> Eugene
>>
>>
>> On Thursday, June 28, 2018 at 3:11:30 AM UTC+8, j-16375 wrote:
>>>
>>> Does anyone have any experience using Ansible with Viptela SD-WAN products 
>>> (vEdge mostly)?  The ios_command module seems to work at a basic level for 
>>> running simple commands but runs into issues with more complex commands.
>>>
>>> For example, using Ansible 2.5.5 and running the following command against 
>>> a vEdge-1000:
>>>
>>> #show interface detail | display xml | nomore
>>>
>>> Partial output is returned, but although the xml format appears correct 
>>> when running command on the device, it appears to get mangled in the 
>>> ansible output.  What are the best ways to approach troubleshooting an 
>>> issue like this?
>>>
>>> Sample output:
>>>
>>> ok: [HOSTNAME] => {
>>> "print_output.stdout_lines": [
>>> [
>>> ""
>>> ],
>>> [
>>> "http://tail-f.com/ns/config/1.0\;>",
>>> "  http://viptela.com/oper-vpn\;>",
>>> "0",
>>> "ge0/0",
>>> "ipv4",
>>> "x.x.x.x/29",
>>> "Up",
>>> "Up",
>>> "NA",
>>> "WAN",
>>> "",
>>> "  0",
>>> "  x.x.x.x/29",
>>> "  x.x.x.x",
>>> "  false",
>>> "",
>>> "null",
>>> "transport",
>>> "1",
>>> "1500",
>>> "80:b7:b9:c7:28:13",
>>> "1000",
>>> "full",
>>> "true",
>>> "tx_pause rx_pause",
>>> "1360",
>>> "16:04:48:50",
>>> "dhcp dns icmp",
>>> "114578914",
>>> "34723478373",
>>> "0",
>>> "14697761",
>>> "110381996",
>>> "20019647115"
>>> ],  <== OUTPUT GETS CORRUPTED HERE
>>> [
>>> "0",
>>> "2",
>>> "258",
>>> "1255",
>>> "234",
>>> "441",
>>> "36925",
>>> "36935",
>>> "139781",
>>> "139204",
>>> "353520",
>>> "0",
>>> "0"
>>> ]
>>> ]
>>> }
>
> --
> 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/036fe650-97ed-4854-803e-f69cb3dd843e%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/CAKEs6acNBO63mzEpW-f-1B4ADBhHf7tfFsV2n-xp%3DfDybiLL8A%40mail.gmail.com.


Re: [ansible-project] manage linux system policy routing?

2018-05-21 Thread Peter Sprygada
net_static_route is designed to be used with traditional routers and
switches and will not work with Linux hosts

On Mon, May 21, 2018 at 6:08 AM, cava cavamagie  wrote:

> i'm aunable to use the module net_static_route
> other ways?
>
> --
> 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/8b6bd35f-af68-49de-ad9c-a6429d199b1e%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Issues connecting when using the ios_facts module

2018-05-18 Thread Peter Sprygada
Few things that need to be corrected here

1) use connection=network_cli

2) set the ansible_network_os=asa

3) use the asa_facts module, not ios_facts

http://docs.ansible.com/ansible/latest/network/index.html



On Fri, May 18, 2018 at 4:18 PM, Matt Hickok 
wrote:

> Also, I just turned on debug and this is what I see:
>
>   1492 1526674321.92274: stderr chunk (state=3):
> >>>debug3: receive packet: type 91
> debug2: callback start
> debug2: client_session2_setup: id 2
> debug1: Sending environment.
> debug1: Sending env LANG = en_US.UTF-8
> debug2: channel 2: request env confirm 0
> debug3: send packet: type 98
> debug1: Sending command: /bin/sh -c 'echo ~ && sleep 0'
> debug2: channel 2: request exec confirm 1
> debug3: send packet: type 98
> debug3: mux_session_confirm: sending success reply
> debug2: callback done
> debug2: channel 2: open confirm rwindow 1024 rmax 4096
> debug1: mux_client_request_session: master session id: 2
> <<<
>
>   1492 1526674321.95154: stderr chunk (state=3):
> >>>debug3: receive packet: type 99
> debug2: channel_input_status_confirm: type 99 id 2
> debug2: exec request accepted on channel 2
> <<<
>
>   1492 1526674321.95220: stdout chunk (state=3):
> >>>Type help or '?' for a list of available commands.
> ciscoasa> /b<<<
>
>   1492 1526674321.95442: stdout chunk (state=3):
> >>>in/sh -c 'echo ~ &&<<<
>
>   1492 1526674321.97577: stdout chunk (state=3):
> >>> sleep 0'<<<
>
>   1492 1526674366.99164: stderr chunk (state=3):
> >>>debug3: send packet: type 1
> <<<
>
>   1492 1526674366.99776: stderr chunk (state=3):
> >>>debug1: channel 0: free: /root/.ansible/cp/a0709b0bd0, nchannels 3
> debug3: channel 0: status: The following connections are open:
>   #1 mux-control (t16 r2 i0/0 o0/0 fd 5/5 cc -1)
>   #2 client-session (t4 r3 i0/0 o0/0 fd 6/7 cc 1)
>
> debug1: channel 1: free: mux-control, nchannels 2
> debug3: channel 1: status: The following connections are open:
>   #1 mux-control (t16 r2 i0/0 o0/0 fd 5/5 cc -1)
>   #2 client-session (t4 r3 i0/0 o0/0 fd 6/7 cc 1)
>
> debug1: channel 2: free: client-session, nchannels 1
> debug3: channel 2: status: The following connections are open:
>   #2 client-session (t4 r3 i0/0 o0/0 fd 6/7 cc 1)
>
> debug3: fd 0 is not O_NONBLOCK
> debug3: fd 1 is not O_NONBLOCK
> debug1: fd 2 clearing O_NONBLOCK
> Connection to 10.0.2.5 closed by remote host.
> Transferred: sent 2072, received 1984 bytes, in 45.1 seconds
> Bytes per second: sent 45.9, received 44.0
> debug1: Exit status -1
> debug3: mux_client_read_packet: read header failed: Broken pipe
> debug2: Control master terminated unexpectedly
> <<<
>
>   1492 1526674367.01129: stderr chunk (state=3):
> >>><<<
>
>   1492 1526674367.01299: stdout chunk (state=3):
> >>><<<
>
>
>
> On Friday, May 18, 2018 at 3:11:07 PM UTC-5, Matt Hickok wrote:
>>
>> Hey folks, I'm trying to gather some facts from a Cisco ASA. The ASA is
>> configured as simply as possible and here are the relevant settings for the
>> ASA
>>
>> ASA Software Version: 9.2(2)
>> Hardware: ASA5515
>> Management IP: 10.0.2.5
>> SSH DH Key Exchange: Group 1 (diffie-hellman-group1-sha1)
>>
>> I made sure that I can SSH into the device directly from the Ansible VM
>> before anything, and this was sucessful.
>>
>> Ansible version is 2.5.2 (being run using the official ansible awx docker
>> images)
>>
>> Here is my inventory:
>>
>> [cisco]
>> 10.0.2.5
>>
>> [cisco:vars]
>> ansible_user=myuseraccount
>> ansible_ssh_pass=mypass
>> ansible_ssh_common_args: '-o KexAlgorithms=diffie-hellman-group1-sha1'
>>
>> Here is my playbook:
>> ---
>> - hosts: cisco
>>   tasks:
>> - name: "ssh facts"
>>   ios_facts:
>>
>> So it is incredibly basic. Now the error I am getting is that the device
>> is unreachable, but it looks like some sot of ssh multiplexing error. I
>> don't really know how to read these logs.
>>
>> fatal: [10.0.2.5]: UNREACHABLE! => {
>> "changed": false,
>> "msg": "Failed to connect to the host via ssh: OpenSSH_7.4p1, OpenSSL
>> 1.0.2k-fips  26 Jan 2017\r\ndebug1: Reading configuration data
>> /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying
>> options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1:
>> Control socket \"/root/.ansible/cp/a0709b0bd0\" does not
>> exist\r\ndebug2: resolving \"10.0.2.5\" port 22\r\ndebug2:
>> ssh_connect_direct: needpriv 0\r\ndebug1: Connecting to 10.0.2.5 [10.0.2.5]
>> port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing
>> O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 9970 ms
>> remain after connect\r\ndebug1: permanently_set_uid: 0/0\r\ndebug1:
>> key_load_public: No such file or directory\r\ndebug1: identity file
>> /root/.ssh/id_rsa type -1\r\ndebug1: key_load_public: No such file or
>> directory\r\ndebug1: identity file /root/.ssh/id_rsa-cert type
>> -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1:
>> identity file /root/.ssh/id_dsa type -1\r\ndebug1: 

Re: [ansible-project] Command timeout adjustment in 2.5 with new network modules?

2018-03-27 Thread Peter Sprygada
For network_cli connections, we do not support a per command timeout
today.  This is something we are looking at adding but as of 2.5, there is
only the global timeout parameter.

On Mon, Mar 26, 2018 at 4:18 AM 'Scott Pettit' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Hello,
>
> I have a number of network tasks that take a long time to run, for example
> firmware update tasks. In Ansible 2.4 I extended the command_timeout by
> using the timeout variable on an individual task basis per
> https://docs.ansible.com/ansible/2.5/network/user_guide/network_debug_troubleshooting.html
>
> *Option 2: Increase command timeout per task basis. All network modules
> support a timeout value that can be set on a per task basis. The timeout
> value controls the amount of time in seconds before the task will fail if
> the command has not returned.*
>
> This doesn't seem to be the case in Ansible 2.5 once you move to the new
> network_cli connection type as the provider options go away and Ansible
> throws an error that you're trying to set the timeout variable, but can't.
>
> I don't want to globally adjust the command_timeout in ansible.cfg as that
> has other implications when I'm hitting several hundred devices at once and
> they aren't always available, so timing out quickly is a correct outcome.
>
> I can workaround the issue by using export
> ANSIBLE_PERSISTENT_COMMAND_TIMEOUT=xxx prior to running the playbooks I
> know need additional time, but what's the correct way to adjust the command
> timeout on a per task basis in Ansible 2.5?
>
> -Scott
>
> --
> 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/5a5a5d44-7375-498b-ba3a-290745b568b5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] napalm-ansible...NXOS

2018-03-21 Thread Peter Sprygada
The NAPALM library does not support connecting to NXOS devices using SSH,
only NXAPI.If you want to connect using SSH, I would recommend using
the nxos core modules instead.

On Tue, Mar 20, 2018 at 11:01 PM Sunil6057  wrote:

> hi
>
> ---
> - hosts: leaf
>   connection: local
>   tasks:
> - napalm_install_config:
> hostname: "{{ inventory_hostname }}"
> username: "{{ username }}"
> password: "{{ password }}"
> dev_os: "{{ nxos }}"
> config_file: leaf.conf
> commit_changes: True
> diff_file: initial.diff
>
>
> This is the yml file. By default it tries to connect using HTTPS (NXAPI). How 
> do i bypass this and make it connect using SSH
>
> --
> 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/135ca6c8-7427-42ae-94e5-53ed2c77b425%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Unable to Open Shell

2017-11-28 Thread Peter Sprygada
That looks like a paramiko issue.  Could you open an issue at
github.com/ansible/ansible and provide this output along with the output
from `pip freeze`?  From there we can further troubleshoot the bug.

On Tue, Nov 28, 2017 at 9:57 AM Lukas M  wrote:

> Yes, I looked through this link and through the log file but the suggested
> errors and solutions didn't work for me either..
> Here is the log file content:
>
> ##
>
>
> 2017-11-28 09:29:37,505 p=24401 u=lukasm |   24401 1511879377.50471:
> starting run
> 2017-11-28 09:29:37,635 p=24401 u=lukasm |  ansible-playbook 2.4.1.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path =
> [u'/home/lukasm/.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, Aug  4 2017, 00:39:18) [GCC 4.8.5
> 20150623 (Red Hat 4.8.5-16)]
> 2017-11-28 09:29:37,635 p=24401 u=lukasm |  Using /etc/ansible/ansible.cfg
> as config file
> 2017-11-28 09:29:37,635 p=24401 u=lukasm |   24401 1511879377.63537: Added
> group all to inventory
> 2017-11-28 09:29:37,635 p=24401 u=lukasm |   24401 1511879377.63552: Added
> group ungrouped to inventory
> 2017-11-28 09:29:37,635 p=24401 u=lukasm |   24401 1511879377.63565: Group
> all now contains ungrouped
> 2017-11-28 09:29:37,636 p=24401 u=lukasm |   24401 1511879377.63652:
> Loading CacheModule 'memory' from
> /usr/lib/python2.7/site-packages/ansible/plugins/cache/memory.py
> 2017-11-28 09:29:37,636 p=24401 u=lukasm |  setting up inventory plugins
> 2017-11-28 09:29:37,637 p=24401 u=lukasm |   24401 1511879377.63782:
> Loading InventoryModule 'host_list' from
> /usr/lib/python2.7/site-packages/ansible/plugins/inventory/host_list.py
> 2017-11-28 09:29:37,638 p=24401 u=lukasm |   24401 1511879377.63808:
> Loading InventoryModule 'script' from
> /usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.py
> 2017-11-28 09:29:37,638 p=24401 u=lukasm |   24401 1511879377.63837:
> Loading InventoryModule 'yaml' from
> /usr/lib/python2.7/site-packages/ansible/plugins/inventory/yaml.py
> 2017-11-28 09:29:37,638 p=24401 u=lukasm |   24401 1511879377.63871:
> Loading InventoryModule 'ini' from
> /usr/lib/python2.7/site-packages/ansible/plugins/inventory/ini.py
> 2017-11-28 09:29:37,638 p=24401 u=lukasm |   24401 1511879377.63887:
> Examining possible inventory source: /etc/ansible/hosts
> 2017-11-28 09:29:37,639 p=24401 u=lukasm |   24401 1511879377.63899:
> Attempting to use plugin host_list
> (/usr/lib/python2.7/site-packages/ansible/plugins/inventory/host_list.py)
> 2017-11-28 09:29:37,639 p=24401 u=lukasm |   24401 1511879377.63911:
> /etc/ansible/hosts did not meet host_list requirements
> 2017-11-28 09:29:37,639 p=24401 u=lukasm |   24401 1511879377.63922:
> Attempting to use plugin script
> (/usr/lib/python2.7/site-packages/ansible/plugins/inventory/script.py)
> 2017-11-28 09:29:37,639 p=24401 u=lukasm |   24401 1511879377.63938:
> /etc/ansible/hosts did not meet script requirements
> 2017-11-28 09:29:37,639 p=24401 u=lukasm |   24401 1511879377.63950:
> Attempting to use plugin yaml
> (/usr/lib/python2.7/site-packages/ansible/plugins/inventory/yaml.py)
> 2017-11-28 09:29:37,640 p=24401 u=lukasm |   24401 1511879377.64045:
> Loading data from /etc/ansible/hosts
> 2017-11-28 09:29:37,642 p=24401 u=lukasm |   24401 1511879377.64277:
> /etc/ansible/hosts did not meet yaml requirements
> 2017-11-28 09:29:37,643 p=24401 u=lukasm |   24401 1511879377.64318:
> Attempting to use plugin ini
> (/usr/lib/python2.7/site-packages/ansible/plugins/inventory/ini.py)
> 2017-11-28 09:29:37,647 p=24401 u=lukasm |   24401 1511879377.64778: Added
> group switches to inventory
> 2017-11-28 09:29:37,648 p=24401 u=lukasm |   24401 1511879377.64862: set
> inventory_file for 3850-TEST
> 2017-11-28 09:29:37,649 p=24401 u=lukasm |   24401 1511879377.64906: set
> inventory_dir for 3850-TEST
> 2017-11-28 09:29:37,649 p=24401 u=lukasm |   24401 1511879377.64939: Added
> host 3850-TEST to inventory
> 2017-11-28 09:29:37,649 p=24401 u=lukasm |   24401 1511879377.64968: Added
> host 3850-TEST to group switches
> 2017-11-28 09:29:37,650 p=24401 u=lukasm |   24401 1511879377.64999: set
> ansible_host for 3850-TEST
> 2017-11-28 09:29:37,650 p=24401 u=lukasm |  Parsed /etc/ansible/hosts
> inventory source with ini plugin
> 2017-11-28 09:29:37,650 p=24401 u=lukasm |   24401 1511879377.65072:
> Reconcile groups and hosts in inventory.
> 2017-11-28 09:29:37,651 p=24401 u=lukasm |   24401 1511879377.65108: Group
> all now contains switches
> 2017-11-28 09:29:37,651 p=24401 u=lukasm |   24401 1511879377.65145: Group
> all now contains 3850-TEST
> 2017-11-28 09:29:37,651 p=24401 u=lukasm |   24401 1511879377.65164:
> Loading CacheModule 'memory' from
> 

Re: [ansible-project] No output from Cisco router

2017-10-30 Thread Peter Sprygada
run with -v (or -vvv) to see the output of the task on the command line

use register to further process the output (
http://docs.ansible.com/ansible/latest/playbooks_variables.html#registered-variables
)

On Thu, Oct 26, 2017 at 9:41 AM,  wrote:

>
>
> On Thursday, October 26, 2017 at 9:39:37 AM UTC-4, pateld...@gmail.com
> wrote:
>>
>> Hello Friends,
>>
>> I've just picked up network automation with ansible and this is my first
>> attempt to build a very simple playbook to run "show version" on Cisco IOS
>> router.Although, playbook runs successfully but i can't see any output from
>> the router when playbook runs
>>
>> > ansible-playbook -i inventory config.yml
>> [DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading
>> as it can also be a list of
>> hosts, a directory or a list of paths . This feature will be removed in
>> version 2.8. Deprecation warnings
>>  can be disabled by setting deprecation_warnings=False in ansible.cfg.
>>
>> PLAY [RUNNING CONFIG] **
>> **
>>
>> TASK [SHOW CONFIGURATION] **
>> **
>>  [WARNING]: argument username has been deprecated and will be removed in
>> a future version
>>
>>  [WARNING]: argument host has been deprecated and will be removed in a
>> future version
>>
>>  [WARNING]: argument password has been deprecated and will be removed in
>> a future version
>>
>> ok: [switch1]
>>
>> PLAY RECAP 
>> ***
>> switch1: ok=1changed=0unreachable=0
>> failed=0
>>
>>
>> *My YAML file:-*
>>
>> cat config.yml
>> ---
>>
>>  - name: RUNNING CONFIG
>>hosts: ios
>>gather_facts: no
>>connection: local
>>
>>tasks:
>>
>>- name: SHOW CONFIGURATION
>>  ios_command:
>>   commands:
>> - show version
>> - show interface summary
>>   username: "{{ un }}"
>>   password: "{{ pwd }}"
>>   host: "{{ inventory_hostname }}"
>>
>> Am i missing something? Appreciate your support.
>>
>> Thanks,
>> Dipak
>>
> --
> 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/49b14432-3fbb-4342-9671-962e3e2bfd4a%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Telnet Module inside 2.4

2017-10-18 Thread Peter Sprygada
There are no plans to add prompt introspection and response to the telnet
module.  It could be an opportunity for someone to take on as a project if
so desired.

On Wed, Oct 18, 2017 at 4:20 PM, Rodrigo  wrote:

> Hello Everyone,
>
> Is there any idea for this subject?
>
> Att,
> Rodrigo Rovere
> www.ciscoredes.com.br
> Twitter: @rar_21
>
> 2017-09-27 18:56 GMT-03:00 Rodrigo Rovere :
>
>> Hello Everyone,
>>
>> I am handling new functionality inside module 2.4 version. According
>> documentation we have " prompts " to manage points to execute next command.
>>
>> However, I am thinking some alternatives of customer only has telnet
>> implementation in your environment and work to change to DevOps inside
>> Ansible, however will be good opportunity for the customer take opportunity
>> to migrate for SSH and work correctly.
>>
>> I was trying to manage the action inside " Cisco IOS " to generate
>> "crypto key", however some devices will request action to answer about key
>> generate ( 512, 1024 ). What's the best approach to manage this
>> implementation inside Ansible to accept the key automatically?
>>
>> Kind Regards,
>> Rodrigo
>>
>> --
>> 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/29bf6d22-baed-4685-a2df-09e6c6a4aaa8%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAC1_Jao60VDB-D7Rx4N3catO%
> 3DTBG8TWoCgoa7sdgPLPdqqsCww%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/CAKEs6ac_zZvz3Cub7ZvAnVuYXkNaNNrfqr7TGf031eAQWaRsYA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Queries regarding IOS_CONFIG module

2017-10-12 Thread Peter Sprygada
Hi Harkanwal,

1. example below

ios_config:
  lines:
- logging ...
- logging size ..
  parents:
- archive
- log config

2. yes, it uses the same connection for multiple tasks by default

3. the configuration lines in ios_config must match the same as the running
config, do not use shortened commands or abbreviations.

On Thu, Oct 12, 2017 at 7:12 AM,  wrote:

> Hello
>
> I am aware of parents attribute while defining the configuration. I have
> queries
>
> 1. how to accomplish below scenario:
>
> archive
>   log config
>  logging ...
>  logging size ..
>   path bootflash:zxvf/cfg
>   maximum 4
>
>
> 2.  It is possible to use same connection for multiple tasks.
>
> Like :
>
> - name: Configure X
>   ios_config:
> lines:
>  - version 12.2
> provider: "{{ user_credentials }}"
>
> - name: Configure Y
>   ios_config:
> lines:
>  - login delay 50
> provider: "{{ user_credentials }}"
>
> For above separate SSH connection.
>
> 3.  How to make configuration idempotent using
>
>
> Best Regards,
>
> Harkanwal
>
> --
> 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/c162dc08-c2e1-4df9-9c7d-007ae2b03cf6%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Help with Basic IOS Command module

2017-05-08 Thread Peter Sprygada
Hi Sergey, can you provide more details about what isn't working in py3.5?



On Sat, May 6, 2017 at 8:19 AM,  wrote:

> Hi Bain,
>
> It seems the ios_command module doesn't work with Python3.5. Try running
> it with Python2.7.
>
> Regards,
> Sergey
>
>
> On Friday, 5 May 2017 01:15:02 UTC+10, bain wrote:
>>
>> If anyone is able to assist i would really appreciate it, I have spent
>> hours looking around ,fixing random things and still cannot find why my
>> script errors out on a 'type error"
>>
>>
>> /etc/ansible/cisco$ cat tasks.yml
>> - hosts: all
>>   gather_facts: no
>>   tasks:
>>- name: ios command
>>  ios_command:
>>commands:
>> - terminal length 0
>> - show interfaces
>>
>>
>> /etc/ansible/cisco$ cat hosts
>> [ios]
>> coreswitch ansible_host=10.0.99.2 ansible_ssh_pass=password
>> ansible_user=ansible
>>
>> --
>>
>> Currently, i have default connection to ssh, because using 'smart' caused
>> issues... however ios_command states it wants connection: local, but when i
>> do that this is the error I receive:
>>
>> /etc/ansible/cisco$ ansible-playbook tasks.yml -i hosts -vvv
>> Using /etc/ansible/ansible.cfg as config file
>>
>> PLAYBOOK: tasks.yml **
>> 
>> 
>> **
>> 1 plays in tasks.yml
>>
>> PLAY [all] 
>> 
>> 
>> *
>> META: ran handlers
>>
>> TASK [ios command] **
>> 
>> 
>> ***
>> task path: /home/abear/Dropbox/ansible/cisco/tasks.yml:5
>> The full traceback is:
>> Traceback (most recent call last):
>>   File 
>> "/usr/local/lib/python3.5/dist-packages/ansible/executor/task_executor.py",
>> line 125, in run
>> res = self._execute()
>>   File 
>> "/usr/local/lib/python3.5/dist-packages/ansible/executor/task_executor.py",
>> line 521, in _execute
>> result = self._handler.run(task_vars=variables)
>>   File 
>> "/usr/local/lib/python3.5/dist-packages/ansible/plugins/action/ios.py",
>> line 69, in run
>> rc, out, err = connection.exec_command('open_shell()')
>>   File 
>> "/usr/local/lib/python3.5/dist-packages/ansible/plugins/connection/persistent.py",
>> line 70, in exec_command
>> return self._do_it('EXEC: ' + cmd)
>>   File 
>> "/usr/local/lib/python3.5/dist-packages/ansible/plugins/connection/persistent.py",
>> line 56, in _do_it
>> cPickle.dump(self._play_context.serialize(), src)
>> TypeError: string argument expected, got 'bytes'
>> fatal: [coreswitch]: FAILED! => {
>> "failed": true,
>> "msg": "Unexpected failure during module execution.",
>> "stdout": ""
>> }
>> to retry, use: --limit @/home/abear/Dropbox/ansible/c
>> isco/tasks.retry
>>
>> PLAY RECAP 
>> 
>> 
>> *
>> coreswitch : ok=0changed=0unreachable=0
>>  failed=1
>>
>>
>> If anyone can assist, i'd greatly appreciate it...
>>
>> Thanks,
>>
>> bain
>>
>>
>> --
> 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/c21a4c7d-508b-4e5d-a715-f31d958951cb%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Help with Basic IOS Command module

2017-05-05 Thread Peter Sprygada
Hi bain,

Looks like your missing connection: local in your playbook.  See updated
below:

- hosts: all
  gather_facts: no
  tasks:
   - name: ios command
 ios_command:
   connection: local
   commands:
- terminal length 0
- show interfaces




On Thu, May 4, 2017 at 1:12 AM, bain  wrote:

> If anyone is able to assist i would really appreciate it, I have spent
> hours looking around ,fixing random things and still cannot find why my
> script errors out on a 'type error"
>
>
> /etc/ansible/cisco$ cat tasks.yml
> - hosts: all
>   gather_facts: no
>   tasks:
>- name: ios command
>  ios_command:
>commands:
> - terminal length 0
> - show interfaces
>
>
> /etc/ansible/cisco$ cat hosts
> [ios]
> coreswitch ansible_host=10.0.99.2 ansible_ssh_pass=password
> ansible_user=ansible
>
> --
>
> Currently, i have default connection to ssh, because using 'smart' caused
> issues... however ios_command states it wants connection: local, but when i
> do that this is the error I receive:
>
> /etc/ansible/cisco$ ansible-playbook tasks.yml -i hosts -vvv
> Using /etc/ansible/ansible.cfg as config file
>
> PLAYBOOK: tasks.yml **
> 
> 
> **
> 1 plays in tasks.yml
>
> PLAY [all] 
> 
> 
> *
> META: ran handlers
>
> TASK [ios command] **
> 
> 
> ***
> task path: /home/abear/Dropbox/ansible/cisco/tasks.yml:5
> The full traceback is:
> Traceback (most recent call last):
>   File 
> "/usr/local/lib/python3.5/dist-packages/ansible/executor/task_executor.py",
> line 125, in run
> res = self._execute()
>   File 
> "/usr/local/lib/python3.5/dist-packages/ansible/executor/task_executor.py",
> line 521, in _execute
> result = self._handler.run(task_vars=variables)
>   File "/usr/local/lib/python3.5/dist-packages/ansible/plugins/action/ios.py",
> line 69, in run
> rc, out, err = connection.exec_command('open_shell()')
>   File 
> "/usr/local/lib/python3.5/dist-packages/ansible/plugins/connection/persistent.py",
> line 70, in exec_command
> return self._do_it('EXEC: ' + cmd)
>   File 
> "/usr/local/lib/python3.5/dist-packages/ansible/plugins/connection/persistent.py",
> line 56, in _do_it
> cPickle.dump(self._play_context.serialize(), src)
> TypeError: string argument expected, got 'bytes'
> fatal: [coreswitch]: FAILED! => {
> "failed": true,
> "msg": "Unexpected failure during module execution.",
> "stdout": ""
> }
> to retry, use: --limit @/home/abear/Dropbox/ansible/
> cisco/tasks.retry
>
> PLAY RECAP 
> 
> 
> *
> coreswitch : ok=0changed=0unreachable=0
>  failed=1
>
>
> If anyone can assist, i'd greatly appreciate it...
>
> Thanks,
>
> bain
>
>
> --
> 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/53d8b615-21c1-4c14-a89a-d1b053544ee5%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] junos_command

2017-04-25 Thread Peter Sprygada
HI Asif, junos_command requires netconf to be enabled on the remote device.

On Tue, Apr 25, 2017 at 3:31 PM, Asif Iqbal  wrote:

> I am failing to make junos_command work
>
> 2017-04-25 15:28:49,152 p=4058 u=user |  PLAY [sdwan-routers]
> 
> 
> 2017-04-25 15:28:49,171 p=4058 u=user |  TASK [junos_command]
> 
> 
> 2017-04-25 15:28:49,572 p=4084 u=user |  creating new control socket for
> host router.example.net:830 as user None
> 2017-04-25 15:28:49,572 p=4084 u=user |  control socket path is
> /home/user/.ansible/pc/c08d46d021
> 2017-04-25 15:28:49,572 p=4084 u=user |  current working directory is
> /home/user/ansible/sdwan
> 2017-04-25 15:28:49,572 p=4084 u=user |  using connection plugin netconf
> 2017-04-25 15:28:49,629 p=4084 u=user |  network_os is set to junos
> 2017-04-25 15:28:49,629 p=4084 u=user |  ssh connection done, stating
> ncclient
> 2017-04-25 15:28:59,694 p=4084 u=user |  failed to create control socket
> for host router.example.net
> 2017-04-25 15:28:59,695 p=4084 u=user |  Traceback (most recent call last):
>   File "/usr/bin/ansible-connection", line 298, in main
> server = Server(sf_path, pc)
>   File "/usr/bin/ansible-connection", line 135, in __init__
> self.conn._connect()
>   File 
> "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/netconf.py",
> line 95, in _connect
> device_params={'name': self._network_os}
>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 149,
> in connect
> return connect_ssh(*args, **kwds)
>   File "/usr/lib/python2.7/dist-packages/ncclient/manager.py", line 118,
> in connect_ssh
> session.connect(*args, **kwds)
>   File "/usr/lib/python2.7/dist-packages/ncclient/transport/ssh.py", line
> 372, in connect
> raise SSHError("Could not open socket to %s:%s" % (host, port))
> SSHError: Could not open socket to router.example.net:830
>
> 2017-04-25 15:29:19,598 p=4084 u=user |  number of connection attempts
> exceeded, unable to connect to control socket
> 2017-04-25 15:29:19,599 p=4084 u=user |  persistent_connect_interval=1,
> persistent_connect_retries=30
> 2017-04-25 15:29:19,625 p=4058 u=user |  fatal: [router.example.net]:
> FAILED! => {"changed": false, "failed": true, "msg": "unable to open shell.
> Please see: https://docs.ansible.com/ansible/network_debug_
> troubleshooting.html#unable-to-open-shell", "rc": 255}
> 2017-04-25 15:29:19,626 p=4058 u=user |  PLAY RECAP
> 
> **
> 2017-04-25 15:29:19,626 p=4058 u=user |  router.example.net : ok=0
>  changed=0unreachable=0failed=1
>
> I can only ssh to the router through a proxy host and the router does not
> have any port 830 open and I verified.
>
> Please advise a workaround..
>
> 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/c11d6f3a-c468-4c41-a097-bdd511cf0cf5%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Network Modules - dealing with Interactive prompts

2017-03-14 Thread Peter Sprygada
In Ansible 2.2 you can encode the prompt / response in the task as such:

eos_command:
  commands:
- command: command to run
  prompt: Do you want to continue?
  response: yes


On Mon, Mar 13, 2017 at 4:33 PM, <jb795...@gmail.com> wrote:

>
> Using version - ansible 2.2.0.0
>
> On Sunday, March 12, 2017 at 8:23:09 PM UTC, Peter Sprygada wrote:
>>
>> which version of ansible are you running?
>>
>> On Fri, Mar 10, 2017 at 9:29 AM, <jb79...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> What is the best approach to dealing with interactive commands. I am
>>> attempting to use ansible to download a software file to a switch using a 
>>> "copy
>>> scp://admin@1.1.1.1/sw/software_file flash:software_file".
>>>
>>> I have attempted to store the response to a variable and send another
>>> task with the password if the password prompt is listed in the variable, but
>>> ansible hangs on the password prompt.
>>>
>>> Is this a correct approach? is there a better method to working with
>>> interactive commands?
>>>
>>>
>>> ---
>>>
>>> - hosts: arista
>>>
>>>   gather_facts: no
>>>
>>>   connection: local
>>>
>>>   strategy: free
>>>
>>>   tasks:
>>>
>>> - name: download software
>>>
>>>   ignore_errors: yes
>>>
>>>   eos_command:
>>>
>>>  host: arista
>>>
>>>  username: admin
>>>
>>>  password: xyz
>>>
>>>  authorize: yes
>>>
>>>  commands:
>>>
>>>   - copy scp://admin@1.1.1.1/sw/software_file
>>> flash:software_file
>>>
>>>   register: test
>>>
>>> - name: password enter
>>>
>>>   ignore_errors: yes
>>>
>>>   eos_command:
>>>
>>>  host: admin
>>>
>>>  username: admin
>>>
>>>  password: xyz
>>>
>>>  ignore_errors: yes
>>>
>>>  authorize: yes
>>>
>>>  commands:
>>>
>>>   - the_password
>>>
>>>   when: “’password_prompt’ in test"
>>>
>>>
>>>
>>>
>>> thanks.
>>>
>>> jb
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/ansible-project/fc55eed2-32d3-4b56-934a-055a64004a5f%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/fc55eed2-32d3-4b56-934a-055a64004a5f%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/645bec83-b5b1-45be-9dc7-73c918ea7184%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/645bec83-b5b1-45be-9dc7-73c918ea7184%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAEkdrMiBNzAkg-1Ds57KjYOHEq66tmOAP7apVRphOhOO5buxMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Network Modules - dealing with Interactive prompts

2017-03-12 Thread Peter Sprygada
which version of ansible are you running?

On Fri, Mar 10, 2017 at 9:29 AM,  wrote:

> Hello,
>
> What is the best approach to dealing with interactive commands. I am
> attempting to use ansible to download a software file to a switch using a 
> "copy
> scp://admin@1.1.1.1/sw/software_file flash:software_file".
>
> I have attempted to store the response to a variable and send another task
> with the password if the password prompt is listed in the variable, but
> ansible hangs on the password prompt.
>
> Is this a correct approach? is there a better method to working with
> interactive commands?
>
>
> ---
>
> - hosts: arista
>
>   gather_facts: no
>
>   connection: local
>
>   strategy: free
>
>   tasks:
>
> - name: download software
>
>   ignore_errors: yes
>
>   eos_command:
>
>  host: arista
>
>  username: admin
>
>  password: xyz
>
>  authorize: yes
>
>  commands:
>
>   - copy scp://admin@1.1.1.1/sw/software_file flash:software_file
>
>   register: test
>
> - name: password enter
>
>   ignore_errors: yes
>
>   eos_command:
>
>  host: admin
>
>  username: admin
>
>  password: xyz
>
>  ignore_errors: yes
>
>  authorize: yes
>
>  commands:
>
>   - the_password
>
>   when: “’password_prompt’ in test"
>
>
>
>
> thanks.
>
> jb
>
> --
> 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/fc55eed2-32d3-4b56-934a-055a64004a5f%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: junos_template in Ansible 2.1

2017-03-12 Thread Peter Sprygada
only include configuration statements in your file (config.j2), not cli
commands.  remove the configure and commit statements

On Sun, Mar 12, 2017 at 11:39 AM, Dat Dao  wrote:

> Hi IAN,
> I am a newbie in ansible sector, I wrote the playbook in which I used
> junos_template module, but when I run playbook, I got this error:
> he error is "msg": "Unable to load config: ConfigLoadError(severity:
> error, bad_element: junos.set, message: error: unknown command)" which is
> odd since using the juniper_config module with the lines: - set system
> host-name {{ inventory_hostname }} works fine.
>
> This is my jinja2 file:
>
> configure
> set system hostname DAT123
> commit
>
> and here is my playbook:
> ---
> - name: cau hinh doi hostname
>   hosts: juniper
>
>
>  tasks:
>  - name: tai config
>junos_template:
>  src: config.j2
>  host: 100.100.100.100
>
> Please help me fix this issue.
>
>
> Vào 00:10:44 UTC+7 Thứ Sáu, ngày 13 tháng 5 năm 2016, Ian Cote đã viết:
>>
>> I've been kicking the tires on 2.1, specifically to start managing
>> network equipment.  I've had success with the junos_command and
>> junos_config modules, but cannot get the junos_template module to work for
>> even a trivial example.  I've tried the set and text formats -
>>
>> config.set:
>> set system host-name {{ inventory_hostname }}
>>
>> config.j2 (which according to the -vvv output was treated as text):
>> system {
>> host-name {{ inventory_hostname }}
>> }
>>
>> The error is "msg": "Unable to load config: ConfigLoadError(severity:
>> error, bad_element: junos.set, message: error: unknown command)" which is
>> odd since using the juniper_config module with the lines: - set system
>> host-name {{ inventory_hostname }} works fine.
>>
>> Could someone post a (preferably text form) juniper template that they
>> have had success with?  I'm looking to merge the config here at first.
>>
>> Thanks,
>> -ian
>>
> --
> 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/c34975a6-0c04-491e-b20a-259115e73ca7%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios_config: match confusion

2017-02-15 Thread Peter Sprygada
match=line

* Simple line matching against the running config with respect to context
(parents).  If the line is in the config, then nothing will be done.  If
the line isn't in the config, it will be added

match=none

* Ignore the running config all together and push the config lines into the
device running config

match=strict

* Strict line matching, for instance an ACL.  Ensures the statements are
ordered as per the module definition

* Example

running-config:
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - passes
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4

module - fails (although match=line would pass)
permit 10 1.1.1.1
permit 20 4.4.4.4
permit 30 2.2.2.2
permit 40 3.3.3.3

match=exact

* Strict line matching with absolute entries, again most common with ACL

* Example

running-config:
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - passes
permit 1.1.1.1
permit 2.2.2.2
permit 3.3.3.3
permit 4.4.4.4
permit 5.5.5.5

module - fails (config has 5 total items, module definition expects only 4)
permit 10 1.1.1.1
permit 20 2.2.2.2
permit 30 2.2.2.2
permit 40 4.4.4.4

HTH



On Tue, Feb 14, 2017 at 5:01 PM, Adam Wilkins  wrote:

> I'm a little confused on the various match clauses in the 'ios_config'
> module. I understand IOS very well. I'm trying to find use cases for the
> different options here.
>
> Does anyone have any example of when each would be used?
>
>
> Here are the options:
>
>
>- line
>   - strict
>   - exact
>   - none
>
>
>
> Here is the definition:
>
> Instructs the module on the way to perform the matching of the set of
> commands against the current device config. If match is set to *line*,
> commands are matched line by line. If match is set to *strict*, command
> lines are matched with respect to position. If match is set to *exact*,
> command lines must be an equal match. Finally, if match is set to *none*,
> the module will not attempt to compare the source configuration with the
> running configuration on the remote device.
>
> --
> 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/1035eb9c-3e0f-4009-bd9d-cb74acc6c915%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios_config module questions

2017-01-18 Thread Peter Sprygada
Hi Stijn:

For the host argument use the following syntax: host: "{{
inventory_hostname }}"
That will replace the value for host based on the node defined in inventory.


For the using the env var you need to set that in your shell environment,
not the inventory file.  If you want to keep the password in the inventory
file, then reference in your playbook as such:

[ios]
ios01

[ios:vars]
ios_password=mysecret

ios_config
  commands: show version
  host: "{{ inventory_hostname }}"
  username: cisco
  password: "{{ ios_password }}"


Lastly, with regards to how Ansible makes decisions about how to push
config.  Its based on what is in the running config with exact string
matching.  In other words, the values in lines must match exactly what is
reflected in the device running-config otherwise Ansible thinks it needs to
push the command.


On Tue, Jan 17, 2017 at 4:54 PM, Stijn Vrijdag 
wrote:

> Hey everyone,
>
> I'm giving Ansible a try and I'm quite impressed.
> I have a couple of questions regarding the ios_config module.
>
> ---
> - name: Configure ACL
>   hosts: routers
>   gather_facts: false
>   connection: local
>
>   tasks:
> - name: load new acl into device
>   ios_config:
> host: 192.168.1.1
> password: ***
> lines:
>   - 10 permit ip host 1.1.1.1 any log
>   - 20 permit ip host 2.2.2.3 any log
>   - 30 permit ip host 3.3.3.3 any log
>   - 40 permit ip host 4.4.4.4 any log
>   - 50 permit ip host 5.5.5.5 any log
> parents: ip access-list extended test
> before: no ip access-list extended test
> match: exact
>
> This is the code I'm using to push a simple ACL to a Cisco router.
> However I would like to put the password in my hosts file. When I do, it
> doesn't work.
> According to the documentation
> 
> putting ANSIBLE_NET_PASSWORD in the environment variables should do the
> trick. But it doesn't seem to work.
>
> [routers]
> router-one ansible_host=192.168.1.1
> [routers:vars]
> ANSIBLE_NET_PASSWORD=***
>
>
> It also seems to be necessary to specify the host keyword, which is not
> great as I would like to manage the ACL on multiple devices, I thought
> that's why we had the hosts file so we can put all the hosts there?
>
> Also when I run this code it works great, but when I run it again the ACL
> is already on the router and Ansible is unable to detect this and pushes it
> again.
>
> Geef de code hier op...PLAY [Configure ACL] **
> *
>
>
> TASK [load new acl into device] **
> **
>
> changed: [router-one]
>
>
> PLAY RECAP 
> *
>
> router-one : ok=1changed=1unreachable=0
> failed=0
>
> I would expect Ansible to say nothing was changed.
>
> Any help would be greatly appreciated.
> Thanks
> Stijn
>
>
> --
> 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/1664cd6e-eef6-4d68-9b88-13b00271f5f9%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios_command does not seem to be working

2017-01-18 Thread Peter Sprygada
What version of Ansible are you running?

On Wed, Jan 18, 2017 at 4:05 PM, Mohamed Lrhazi  wrote:

> Hello,
>
> am trying ansible and ios_command module for the first time... it seems as
> if ansible is trying to execute normal unix commands instead of ios... what
> am I missing?
>
>
> ➜  cisco cat pb.yaml
> ---
> - hosts: ios
>   gather_facts: no
>   connection: local
>
>   tasks:
> - name: RUN 'SHOW VERSION'
>   register: version
>   ios_command:
> commands: "show version"
>
> - debug: var=version.stdout_lines
> ➜  cisco
>
>
> Output:
> ➜  cisco ansible-playbook -i hosts -vvv pb.yaml
> Using /etc/ansible/ansible.cfg as config file
>
> PLAYBOOK: pb.yaml **
> 
> 1 plays in pb.yaml
>
> PLAY [ios] 
> *
>
> TASK [RUN 'SHOW VERSION'] **
> 
> task path: /home/admin/cisco/pb.yaml:7
> Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/
> network/ios/ios_command.py
> <192.168.40.5> ESTABLISH SSH CONNECTION FOR USER: cisuser
> Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/
> network/ios/ios_command.py
> <192.168.40.3> ESTABLISH SSH CONNECTION FOR USER: cisuser
> <192.168.40.3> SSH: EXEC sshpass -d15 ssh -C -o ControlMaster=auto -o
> ControlPersist=60s -o Port=22 -o User=cisuser -o ConnectTimeout=10 -o
> ControlPath=/home/admin/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.40.3
> '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-
> tmp-1484773198.47-54177158686784 `" && echo 
> ansible-tmp-1484773198.47-54177158686784="`
> echo $HOME/.ansible/tmp/ansible-tmp-1484773198.47-54177158686784 `" ) &&
> sleep 0'"'"''
> <192.168.40.5> SSH: EXEC sshpass -d14 ssh -C -o ControlMaster=auto -o
> ControlPersist=60s -o Port=22 -o User=cisuser -o ConnectTimeout=10 -o
> ControlPath=/home/admin/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.40.5
> '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-
> tmp-1484773198.47-114173880435726 `" && echo 
> ansible-tmp-1484773198.47-114173880435726="`
> echo $HOME/.ansible/tmp/ansible-tmp-1484773198.47-114173880435726 `" ) &&
> sleep 0'"'"''
> <192.168.40.3> PUT /tmp/tmpmaV5qI TO % Invalid input detected at '^'
> marker./ios_command.py
> <192.168.40.5> PUT /tmp/tmpGdwMLJ TO Line has invalid autocommand "/bin/sh
> -c ( umask 77 && mkdir -p ""/ios_command.py
> <192.168.40.3> SSH: EXEC sshpass -d15 scp -C -o ControlMaster=auto -o
> ControlPersist=60s -o Port=22 -o User=cisuser -o ConnectTimeout=10 -o
> ControlPath=/home/admin/.ansible/cp/ansible-ssh-%h-%p-%r /tmp/tmpmaV5qI
> '[192.168.40.3]:'"'"'% Invalid input detected at
> '"'"'"'"'"'"'"'"'^'"'"'"'"'"'"'"'"' marker./ios_command.py'"'"''
> <192.168.40.5> SSH: EXEC sshpass -d14 scp -C -o ControlMaster=auto -o
> ControlPersist=60s -o Port=22 -o User=cisuser -o ConnectTimeout=10 -o
> ControlPath=/home/admin/.ansible/cp/ansible-ssh-%h-%p-%r /tmp/tmpGdwMLJ
> '[192.168.40.5]:'"'"'Line has invalid autocommand "/bin/sh -c ( umask 77 &&
> mkdir -p ""/ios_command.py'"'"''
> fatal: [aquinas-2960-40.5]: FAILED! => {
> "failed": true,
> "msg": "failed to transfer file to Line has invalid autocommand
> \"/bin/sh -c ( umask 77 && mkdir -p \"\"/ios_command.py:\n\nAdministratively
> disabled.\n"
> }
> fatal: [aquinas-3750-40.3]: FAILED! => {
> "failed": true,
> "msg": "failed to transfer file to % Invalid input detected at '^'
> marker./ios_command.py:\n\nAdministratively disabled.\n"
> }
> to retry, use: --limit @/home/admin/cisco/pb.retry
>
> PLAY RECAP 
> *
> aquinas-2960-40.5  : ok=0changed=0unreachable=0failed=1
> aquinas-3750-40.3  : ok=0changed=0unreachable=0failed=1
>
> ➜
>
>
> Thanks a lot,
> Mohamed.
>
> --
> 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/351298d4-67e8-4b44-89a1-93c194bb7912%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 

Re: [ansible-project] Invalid input detected at '^' marker (Ansible 2.2 using ios_config)

2017-01-06 Thread Peter Sprygada
hm thats strange. i dont see anything glaringly obvious.  I see it fails to
execute the command "configure terminal".  What version of IOS are you
running against?  Is AAA involved?  Can you replicate the steps manually
when logged via the same user/password combination?

On Tue, Dec 27, 2016 at 2:57 PM, Kyle Patton  wrote:

> ---
>
> - name: provider for logging into switches / routers
>   set_fact:
> cli:
>   host: "{{ inventory_hostname }}"
>   username: "{{ ios_username }}"
>   password: "{{ ios_password }}"
>   auth_pass: "{{ ios_password }}"
>   authorize: yes
>   no_log: True
>
>
> - name: force push a configuration onto the device
>   ios_config:
> src: test.j2
> match: none
> provider: "{{ cli }}"
>
>
> test.j2 contains the following
>
> interface Gi5/8
> shutdown
>
> "msg": "matched error in response: configure terminal\r\n
> ^\r\n% Invalid input detected at '^' marker.
>
> --
> 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/134e298a-b1e8-4eec-90d1-98a2ce2073a6%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios_command module fails to enter previledge mode

2017-01-06 Thread Peter Sprygada
Use iosxr_command not ios_command when configuring IOS-XR devices

On Wed, Dec 21, 2016 at 3:09 PM, Eliezer Rodriguez 
wrote:

> Hi,
>
> I'm using the ios_command and it seems it's not entering privileged mode,
> the traceback shows it issuing a "term length 0" commands that fails,
> because it's being issued in EXEC mode I believe.
>
> The trace follows:
>
>  An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 237, in 
> main()
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 139, in receive
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 186, in find_prompt
> ansible.module_utils.shell.ShellError: matched error in response:
> terminal length 0
> ^
> % Invalid input detected at '^' marker.
>
> m1.dca2>
>
> fatal: [m1.dca2.plx]: FAILED! => {
> "changed": false,
> "failed": true,
> "invocation": {
> "module_name": "ios_command"
> },
> "module_stderr": "Traceback (most recent call last):\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 237, in \nmain()\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 200, in main\nrunner.add_command(**cmd)\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/netcli.py\", line 147, in add_command\n
> File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 117, in cli\n  File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 148, in connect\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 181, in connect\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 153, in send\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 139, in receive\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 186, in
> find_prompt\nansible.module_utils.shell.ShellError: matched error in
> response: terminal length 0\r\n^\r\n% Invalid input detected at '^'
> marker.\r\n\r\nm1.dca2>\n",
> "module_stdout": "",
> "msg": "MODULE FAILURE"
> }
> An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 237, in 
> main()
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
>   File 

Re: [ansible-project] ENCOUNTERING MODULE FAILURE Error while using IOS_template module

2017-01-06 Thread Peter Sprygada
template files need to be structured as config files.  shubham.j2 should
look like this:

interface FastEthernet0/0
 ip address 1.1.1.1 255.255.255.0
 no shutdown

With indents... no need to add configure terminal as the module will handle
that for you

On Fri, Jan 6, 2017 at 4:48 AM,  wrote:

> Hello,
>
>   I am writing simple playbook to add configuration in Cisco 2800
> router using jinja2 templates,Where I am able to generate Configuration
> file using Template module.But after generating the configuration file i.e.
> shubham.J2  i am getting the following  error while pushing configurations
> to device.
>
> An exception occurred during task execution. To see the full traceback,
> use -vvv. The error was: cnlabs(config)#
> fatal: [192.168.3.65]: FAILED! => {"changed": false, "failed": true,
> "module_stderr": "Traceback (most recent call last):\n  File
> \"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 174, in
> \nmain()\n  File 
> \"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\",
> line 165, in main\nresponse = module.config(commands)\n  File
> \"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/netcfg.py\",
> line 54, in __call__\n  File \"/tmp/ansible_HV_5qu/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 194, in configure\n  File
> \"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/shell.py\",
> line 250, in execute\nansible.module_utils.network.NetworkError: matched
> error in response: configure terminal\r\n ^\r\n%
> Invalid input detected at '^' marker.\r\n\r\ncnlabs(config)#\n",
> "module_stdout": "", "msg": "MODULE FAILURE"}
>
>  my configuration file looks like:(shubham.j2)
>
> configure terminal
> interface fastEthernet 0/0
> ip address 1.1.1.1 255.255.255.0
> no shutdown
> exit
>
>   Using this configuration file I am trying to assign the above mentioned
> IP address to Fa 0/0 interface of my cisco device. And I am using
> ios_template module in my playbook to push configurations in to Device.Can
> anyone help me to solve this error.
>
> --
> 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/5063a923-be72-4af7-852c-7eb67bc360ff%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] trouble using sros modules to log in with a specific user

2016-12-12 Thread Peter Sprygada
Hi Nick,

Not sure if you figure this out yet or not but you need to add connection:
local to your playbook. Your updated playbook should look like this:

https://gist.github.com/privateip/2482751b36b30eb60151e94e16c905ea

Peter

On Tue, Nov 29, 2016 at 7:47 PM, Nick Keeling  wrote:

> First of all, I am still learning Ansible, so there is a very real
> possibility this is user error, but here is my issue:
>
> When I try to log in using the sros module, regardless of the username I
> am using in the yml file, it is using my username from the ansible host
> machine
>
> Here is the yml:
>
> ---
> - name: Test SROS in lab
>   hosts: lab-12e
>   vars:
> cli:
>   host: "{{ inventory_hostname }}"
>   username: ansible
>   ssh_keyfile: /home/nkeeling/ansible/rsa-keys/ansible_rsa.pub
>   transport: cli
>   tasks:
> - name: run show version on remote devices
>   sros_command:
> commands: show version
> provider: "{{ cli }}"
>
> This was taken directly from the examples for the module. When I run the
> module, I get a failure:
>
> nkeeling@eng-tools:~/ansible$ ansible-playbook sros_test.yml
>
>
> PLAY [Test SROS in lab] **
> **
>
>
> TASK [setup] 
> ***
> fatal: [192.168.253.137]: UNREACHABLE! => {"changed": false, "msg": "Failed
> to connect to the host via ssh: TiMOS-C-13.0.R4 cpm/hops64 ALCATEL SR 7750
> Copyright (c) 2000-2015 Alcatel-Lucent.\r\nAll rights reserved. All use
> subject to applicable license agreements.\r\nBuilt on Wed Jul 29 16:27:26
> PDT 2015 by builder in /rel13.0/b1/R4/panos/main\r\nThis computer system
> is the property of x Networks. It is for authorized use only. Users
> (authorized or unauthorized) have no explicit or implicit expectation of
> privacy. Unauthorized or improper use of this system may result in
> administrative disciplinary action and civil and criminal penalties. 
> \r\nPermission
> denied (publickey,password).\r\n", "unreachable": true}
> to retry, use: --limit @/home/nkeeling/ansible/sros_test.retry
>
>
> PLAY RECAP 
> *
> 192.168.253.137: ok=0changed=0unreachable=1failed=
> 0
>
> When I look at the security log on my SR-OS device, I see:
>
> 64 2001/02/23 22:41:40.17 PST MINOR: SECURITY #2011 Base nkeeling
> "User nkeeling from 172.17.25.236 failed authentication"
>
> I have tried setting the username in multiple places in the yml file, with
> no change in the result. If anyone is able to steer me in the right
> direction, it would be VERY much appreciated!
>
>
> --
> 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/7a2fb8ea-c77c-4b8d-a2aa-7caed9ced2ae%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: How to save stdout_lines to a file without losing the newlines

2016-11-07 Thread Peter Sprygada
Write the stdout var instead.

- name: Saving "{{ item }}" into local file
  local_action: copy content="{{ table.stdout[0] }}" dest="{{ dest_file }}"

On Mon, Nov 7, 2016 at 12:10 PM, jean-christophe manciot <
actionmysti...@gmail.com> wrote:

> I suppose it depends on how the data are returned by the target device,
> which is not a Linux server here, but a Cisco IOS networking device, which
> is a very specific beast.
>
> --
> 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/9cdbfee1-8335-45fe-8c57-95656c3c30f6%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Running ios_template on mac osx under virtualenv

2016-10-17 Thread Peter Sprygada
You are most likely picking up the wrong Python interpreter.  Add the
following line to your inventory file:

[all:vars]
ansible_python_interpreter=python


On Sun, Oct 16, 2016 at 12:30 AM, Dustin Dean  wrote:

> Hello Everyone,
>
> I am getting the following error below when I try to run the ios_command
> module.
>
> fatal: [switch]: FAILED! => {"changed": false, "failed": true, "msg": 
> "paramiko
> is required but does not appear to be installed"}
>
> Ive tried updating paramiko to the latest version and it still doesn't
> work. I am running ansible on a macbook pro under virtualenv.
>
> ansible (2.1.2.0)
> cffi (1.8.3)
> cryptography (1.5.2)
> enum34 (1.1.6)
> Glances (2.6.2)
> idna (2.1)
> ipaddress (1.0.17)
> Jinja2 (2.8)
> MarkupSafe (0.23)
> netaddr (0.7.18)
> netmiko (0.5.6)
> paramiko (2.0.2)
> pip (8.1.2)
> psutil (4.3.0)
> pyasn1 (0.1.9)
> pycparser (2.14)
> pycrypto (2.6.1)
> PyYAML (3.11)
> requests (2.11.1)
> scp (0.10.2)
> setuptools (28.5.0)
> six (1.10.0)
> speedtest-cli (0.3.4)
> virtualenv (15.0.3)
> wheel (0.30.0a0)
>
>
> --
> 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/64e78665-781a-44e7-8c8e-f3d103066eb8%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Module Paths for junos-eznc

2016-10-13 Thread Peter Sprygada
Are you attempting to run Ansible in a virtualenv?

On Tue, Oct 11, 2016 at 3:16 PM, Zod  wrote:

> Trying to setup Ansible on Mac OS X 10.10.3
> Have ansible 2.1.1.0 python 2.7.12
> installed junos-eznc
> Testing uploading a conf file to a juniper device and getting:
> fatal: [srx]: FAILED! => {"changed": false, "failed": true, "msg":
> "junos-eznc >= 1.2.2 is required for this module"}
>
> I did install that:
> Successfully installed MarkupSafe-0.23 PyYAML-3.12 cffi-1.8.3
> cryptography-1.5.2 enum34-1.1.6 idna-2.1 ipaddress-1.0.17 jinja2-2.8
> junos-eznc-2.0.1 lxml-3.6.4 ncclient-0.5.2 netaddr-0.7.18 paramiko-2.0.2
> pyasn1-0.1.9 pycparser-2.14 pyserial-3.1.1 scp-0.10.2 six-1.10.0
>
> Don't know how to tell it where to look for these modules and don't know
> where to go from here.
>
> Here is my simple yaml file:
> ---
> - name: "Prepare"
> connection: local
> hosts: juniper
> gather_facts: no
>
> tasks:
> - name: "Push Config"
> junos_install_config:
> host={{ inventory_hostname }}
> file=roles/srx.conf
> tags: -load
>
> --
> 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/d71fdb6d-905e-475b-a16b-167346917ad2%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] How to configure Vyatta router using ansible 2.0 version?

2016-10-06 Thread Peter Sprygada
The answer today is to use 2.2.  There is no plans to backport the vyos
modules to 2.0

On Wed, Oct 5, 2016 at 7:11 AM, Mick st john 
wrote:

> I am trying to configure vyatta router using modules provided by ansible
> 2.0 version. However, the commands such as "configure" are not supported by
> shell module as it is the configure command is not executed from /bin/sh.
> I am aware of the fact that ansible latest version 2.2 has a "vyos" module
> which supports vyatta configuration. But, what can I do to make it possible
> for me to configure vyatta router using modules provided in 2.0 version?
>
>
> --
> 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/7b1d19ea-58be-4564-a63b-a3480d1dab06%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Network switch module questions

2016-10-04 Thread Peter Sprygada
Hi Don,

Ansible 2.2 adds support for Dell OS6, OS9 (I believe this is the old
Force10 stuff) and OS10.  Please see the modules here:
https://github.com/ansible/ansible-modules-core/tree/devel/network/dellos9

Creating modules is not difficult.  See here for details:
http://docs.ansible.com/ansible/dev_guide/developing_modules.html

For non-API (ie CLI driven) devices, I would recommend that you use the
ios/* modules as a guide for how you can implemented modules for those
types of devices.

HTH,
Peter



On Mon, Oct 3, 2016 at 2:18 PM, Don Jackson  wrote:

> I've been experimenting with the new-ish network switch modules.
>
> We have a heterogenous network switch inventory.
> Not all of our current switches are supported by existing Ansible network
> modules, most significantly the Force10/Dell S4810.
>
> Is there any plan to support the F10 S4810 via an Ansible module?
>
> A somewhat related question:  For switches that do not have Ansible
> modules, how much effort does it take to create a new
> network module?  Where/how would I start on a project like that?
>
> And what if the switch in question doesn't support an API, (presumably
> similar to the Cisco IOS switches)?
> For example, at home, I have several Netgear enterprise switches, but they
> don't support anything but CLI access/control, AFAICT.
>
>
> --
> 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/6725c761-720a-4238-9569-6b5fd4e4587c%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Cisco IOS backup and write to file with timestamp

2016-10-01 Thread Peter Sprygada
Hi James,

This should accomplish what you are trying to do:

https://gist.github.com/privateip/d0fd3c6459c5e1a4c1f9dceeb018b109

Peter



On Fri, Sep 30, 2016 at 8:44 PM, James Baird  wrote:

> I looked into going that route but the concern is that is only available
> in 2.2 and I may have a hard time pushing the team to upgrade Ansoble to
> facilitate that change when we will be using this in production.
>
> --
> 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/7561f2e8-004b-48e0-8f73-9e385f55e1b3%40googlegroups.
> com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios clear command expect confirm

2016-09-22 Thread Peter Sprygada
In 2.1 there is no way to handle this.

We added a new capability in 2.2 (current devel branch) that will allow you
to do this.  The new task would look like this:

- name: Clear counters
  connection: local

  tasks:
- ios_command:
  host: "{{ inventory_hostname }}"
  commands:
- command: "clear counters {{ item }} "
  prompt: 'Clear "show interface" counters on this interface
[confirm]'
  response: c
  with_items:
- "{{ lan_int }}"
  when:
- '"ce" in group_names'


On Wed, Sep 21, 2016 at 11:42 AM, Valérie P  wrote:

> Hi,
>
> I have a question regarding the network core module "ios_command". I want
> to clear counters on some interfaces through a play. When I send the
> command directly through an SSH connection, the process is the following :
>
> rtr-site6#clear counters GigabitEthernet 0/0
> Clear "show interface" counters on this interface [confirm]c
>
> The router expects me to confirm the action. I tried to do it with the
> following play:
>
> ---
>
> - name: Clear counters
>   connection: local
>   ios_command:
> host: "{{ inventory_hostname }}"
> commands:
>   - "clear counters {{ item }} "
>   with_items:
> - "{{ lan_int }}"
>   when:
> - '"ce" in group_names'
>
>
> But I received this error
>
> failed: [rtr-site6] (item=GigabitEthernet0/0) => {"failed": true, "item":
> "GigabitEthernet0/0", "msg": "timeout trying to send command: clear
> counters GigabitEthernet0/0 \r"}
>
> Is there a way to "confirm" this command with any network modules? I am
> using this on a Cisco 2921, here is the version.
> Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
> 15.5(3)M1, RELEASE SOFTWARE (fc2)
>
> Kind regards!
>
> Valerie
>
> --
> 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/fa4e7132-b296-460e-851a-d2f92f65bf78%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] How Network Modules using openssh controlpersist feature?

2016-09-22 Thread Peter Sprygada
If I want to use openssh ControlPersist function or similar feature, I
can't use module_util/shell.y & basic.y, I have to write myself basc
library?

> Yes, it would require a completely new SSH library (or changes to
paramiko) to support the same functionality as ControlPersist.  The updates
would also have to account for each channel being able to invoke an
emulated shell connection.

Is there any other featuca to avoid SSH authentication for each task?

> Yes, for devices that provide alternative API transports such as eAPI for
EOS or NXAPI for NXOS (HTTP based transports).  Unfortunately the number of
devices that support alternative transports are very few and it doesn't
really solve the authentication problem.

On Wed, Sep 21, 2016 at 7:24 AM, <jacky.gao2...@gmail.com> wrote:

>
> *If I want to use openssh ControlPersist function or similar feature, I
> can't use module_util/shell.y & basic.y, I have to write myself basc
> library? *
>
>
> *Is there any other featuca to avoid SSH authentication for each task?*
>
> 在 2016年9月21日星期三 UTC+8上午3:26:33,Peter Sprygada写道:
>>
>> No, there is no support for ControlPersist (or similar) in the paramiko
>> library.
>>
>> On Tue, Sep 20, 2016 at 9:48 AM, <jacky@gmail.com> wrote:
>>
>>> I find that the Network Modules must use paramiko, does paramiko support
>>> openssh ControlPersist similar feature?
>>>
>>>
>>> building ssh connection by paramiko: Code in module_util/shell.py
>>>
>>>
>>> def open(self, host, port=22, username=None, password=None,
>>> timeout=10, key_filename=None, pkey=None, look_for_keys=None,
>>> allow_agent=False):
>>>
>>> self.ssh = paramiko.SSHClient()
>>> self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/ansible-project/ed3f80a3-35b1-4eb7-a344-e38bfac76165%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/ed3f80a3-35b1-4eb7-a344-e38bfac76165%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/372cd5ca-b24f-4342-9b92-7e2f9af8a4b6%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/372cd5ca-b24f-4342-9b92-7e2f9af8a4b6%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAEkdrMhxu%3D_Ww5JjT1Yo68mcRFZB75rY97YUDwsNxj%2BCEqLdAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How do I use openSSH instead of paramiko (i.e. no connection:local) for IOS modules?

2016-09-22 Thread Peter Sprygada
The short answer is you don't.

Traditional network devices that dump an authenticated session to the "CLI"
effectively prevent you from being able to use OpenSSH as a programmable
transport in the way that is implemented for other systems.

WRT point #2.  SSH connections being made by network modules *should* be
cleaning up the connections behind themselves.  If that is not the case,
then its a bug and we need to get it fixed.

On Thu, Sep 22, 2016 at 1:40 AM, Johann Lo  wrote:

> I'm trying to use the ios networking modules (ios_config, ios_template
> etc.) and the only way I can get them to work properly is via connection:
> local and passing the parameters to each task via something like this
>
> - hosts: all
>   connection: local
>   gather_facts: no
>
>   tasks:
>   - name: define provider
> set_fact:
>   provider:
> host: "{{ inventory_hostname }}"
> username: "{{ username }}"
> password: "{{ password }}"
> auth_pass: "{{ auth_pass }}"
> authorize: "{{ authorize }}"
> backup: "{{ backup }}"
>
> 1.) Is there a way to use standard SSH AND pass the ios module specific
> parameters such as auth_pass? Whatever I do, whether I place the username,
> password or auth_pass variables in inventory, play or host variables, it
> ignores them and connects with no user.
>
> 2.) Using the current method I understand its paramiko under the hood.
> This has a MAJOR problem where each task keeps its SSH connection open and
> does not close it. How do I get it to close the SSH connection and not fill
> uip my devices? This is a major issue as network devices normally restrict
> to several concurrent connections.
>
> Note this is also relevant to the Arista (EOS) templates.
>
> 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/ae7111dc-3485-4111-9fb5-c1cb2be7207b%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] How Network Modules using openssh controlpersist feature?

2016-09-20 Thread Peter Sprygada
No, there is no support for ControlPersist (or similar) in the paramiko
library.

On Tue, Sep 20, 2016 at 9:48 AM,  wrote:

> I find that the Network Modules must use paramiko, does paramiko support
> openssh ControlPersist similar feature?
>
>
> building ssh connection by paramiko: Code in module_util/shell.py
>
>
> def open(self, host, port=22, username=None, password=None,
> timeout=10, key_filename=None, pkey=None, look_for_keys=None,
> allow_agent=False):
>
> self.ssh = paramiko.SSHClient()
> self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>
> --
> 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/ed3f80a3-35b1-4eb7-a344-e38bfac76165%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Anyone using ansible to manage nexus and ios-xr devices?

2016-09-19 Thread Peter Sprygada
HI Ryan,

There are a number of organizations that are currently using both nxos and
iosxr modules in production today.  We went through a fairly significant
refactor for 2.2 which means we are presently tracking down lots of bugs
but the code base is stabilizing quickly and is definitely the preferred
train to be on.  Of course goes without saying, do you own due diligence.
Happy to help out where we can.

Peter

On Mon, Sep 19, 2016 at 4:39 PM, Ryan Jones  wrote:

> Thanks. I still haven't started working on this project yet but I was
> curious as how good the support was.
>
> On Friday, September 16, 2016 at 1:04:00 PM UTC-4, Steven Carter wrote:
>>
>> I am trying to use the NXOS modules, but they seem to be in a state of
>> Flux.  The NXOS modules for Ansible 2.1 are lacking, and I am having having
>> trouble getting the modules for 2.2 working (posted the problem just a bit
>> ago).
>>
>> Thanks,
>>
>> Steven.
>>
>> On Thursday, September 15, 2016 at 3:43:26 PM UTC-4, Ryan Jones wrote:
>>>
>>> I'm trying to put together a poc. The issue is i have no idea where to
>>> start. I'm somewhat familiar with ansible for servers but I'd like to start
>>> managing my network infra with ansible. O e of the questions i have is how
>>> so you test a change is valid? And how to automate these tests. I'd like to
>>> get to the point where a change is reviewed then automatically tested and
>>> deployed.
>>
>> --
> 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/2548bc6d-357f-4799-90ed-554d91058f22%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Unable to insert sshkey with nxos_command in Ansible 2.1

2016-09-18 Thread Peter Sprygada
Strange, I just tested with the the stable-2.1 branch and I am not seeing
these issues.  Both Cli and Nxapi transports are working just fine.

Could you provide the output of both "ansible --version" as well as "show
version" from your device?

On Sat, Sep 17, 2016 at 1:10 PM, Steven Carter  wrote:

> I have the following two plays to create users with ssh keys in NXOS:
>
>   - name: Create User
> nxos_config:
>   lines:
> - username "{{ item }}" role network-admin
>   provider: "{{ cli }}"
> with_items: "{{ cil_network_admins }}"
>
>   - name: Create User's SSH Keys
> nxos_config:
>   lines:
> - username "{{ item }}" sshkey "{{ user_data[item].ssh_key }}"
>   provider: "{{ cli }}"
> with_items: "{{ cil_network_admins }}"
>
> The data structures are:
>
> user_data:
>   stevenca:
> name: "Steven Carter"
> uid: 2000
> group: admin
> ssh_key: "ssh-rsa  Rest of SSH Key..."
>
> cil_network_admins:
>   - stevenca
>
> I do not get any errors:
>
> TASK [Create User] **
> ***
> changed: [XXX.XXX.XXX.129] => (item=stevenca)
> changed: [XXX.XXX.XXX.128] => (item=stevenca)
>
> TASK [Create User's SSH Keys] **
> 
> changed: [XXX.XXX.XXX.129] => (item=stevenca)
> changed: [XXX.XXX.XXX.128] => (item=stevenca)
>
> PLAY RECAP 
> *
> XXX.XXX.XXX.128: ok=4changed=2unreachable=0failed=0
> XXX.XXX.XXX.129: ok=4changed=2unreachable=0failed=0
>
> But it does not work.  I get 'username stevenca role network-admin' in the
> switch's config, but no ssh key.  Is there a length limit that silently
> eats the SSH key?
>
> The above is using 'cli' for transport.  When I use 'nxapi', I get:
>
> TASK [Create User] **
> ***
> changed: [XXX.XXX.XXX.128] => (item=stevenca)
> failed: [XXX.XXX.XXX.129] (item=stevenca) => {"clierror": "% String failed
> to match token pattern\n", "code": "400", "failed": true, "item":
> "stevenca", "msg": "CLI execution error"}
>
> TASK [Create User's SSH Keys] **
> 
> failed: [XXX.XXX.XXX.128] (item=stevenca) => {"clierror": "invalid SSH key
> format\n", "code": "400", "failed": true, "item": "stevenca", "msg": "CLI
> execution error"}
>
> I verified the key by adding manually, and it worked fine.  It seems like
> the above could come from truncation as well.
>
> Thanks,
>
> Steven.
>
> --
> 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/1dcf205e-29df-4f0c-9c11-e95fa1473b44%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Problems with NXOS Modules in Ansible 2.2

2016-09-16 Thread Peter Sprygada
That looks like a bug in the module... would you mind filing an issue at
http://github.com/ansible/ansible-modules/core with this information so we
can track it?

On Fri, Sep 16, 2016 at 12:38 PM, Steven Carter  wrote:

> When I run:
>
>- name: Configure the port channels for the VPCs
>   nxos_portchannel:
> provider: "{{ cli }}"
> group: 99
> members: ['Ethernet1/1/1']
> mode: 'active'
> state: present
> I get:
>
> An exception occurred during task execution. To see the full traceback,
> use -vvv. The error was: AttributeError: 'NetworkModule' object has no
> attribute 'configure'
> fatal: [192.133.148.128]: FAILED! => {"changed": false, "failed": true,
> "module_stderr": "Traceback (most recent call last):\n  File
> \"/tmp/ansible_X4FZEp/ansible_module_nxos_portchannel.py\", line 733, in
> \nmain()\n  File 
> \"/tmp/ansible_X4FZEp/ansible_module_nxos_portchannel.py\",
> line 714, in main\noutput = execute_config_command(cmds, module)\n
>  File \"/tmp/ansible_X4FZEp/ansible_module_nxos_portchannel.py\", line
> 328, in execute_config_command\noutput = 
> module.configure(commands)\nAttributeError:
> 'NetworkModule' object has no attribute 'configure'\n", "module_stdout":
> "", "msg": "MODULE FAILURE"}
>
> It seems like I have some dependency problems, but I cannot figure them
> out.  Anyone have any ideas?
>
> Thanks,
>
> Steven.
>
> --
> 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/6a0b9804-4864-4a41-ac06-bba962bcb6ed%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] iosxr_config load config question

2016-09-13 Thread Peter Sprygada
Hi Radoslav,

Can you post the output of ansible --version?

One of two things is happening here:

1) you are not running Ansible from source (the src argument is being added
in the upcoming 2.2 release)
2) you are running from source but the module cannot find the file
"fabric.cfg".  If you are running from
the latest commit on devel, we recently added a check that would alert you
if the file specified in src could not be found

On Sun, Sep 11, 2016 at 8:42 AM, Radoslav Mitov 
wrote:

> Hi All,
> I have a problem with uploading a config file to ios XR box.
> When i run the play the error is:
>
> fatal: [pe2]: FAILED! => {"changed": false, "failed": true, "invocation":
> {"module_args": {"backup": false, "host": "192.168.1.21", "provider":
> {"host": "192.168.1.21", "ssh_keyfile": "/home/rado/.ssh/z-id_rsa",
> "transport": "cli", "username": "rado"}, "src": "fabric.cfg",
> "ssh_keyfile": "/home/rado/.ssh/z-id_rsa", "username": "rado"},
> "module_name": "iosxr_config"}, "msg": "unsupported parameter for module:
> src"}
>
> below is the role:
> ---
> - name: transfer generated file to IOS
>   hosts: cisco
>   gather_facts: no
>   vars:
> cli:
>   host: "{{ ansible_ssh_host }}"
>   username: rado
>   transport: cli
>   ssh_keyfile: /home/rado/.ssh/z-id_rsa
>   tasks:
>   - name: load a config from disk and replace the current config
> iosxr_config:
>   src: "fabric.cfg"
>   update: replace
>   backup: no
>   provider: "{{ cli }}"
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/a39e7229-bbb5-49ea-9ae0-36c515ba9a69%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Simple cisco IOS show version

2016-09-02 Thread Peter Sprygada
Hi Valerie,

Since network devices such as IOS do not provide a shell environment nor
the ability to download and run arbitrary executables, we are fairly
constrained from using the current connection plugin module implemented in
core.  So in order to build modules that work with network devices, we
build an integration that effectively treats SSH or more appropriately
said, CLI over SSH like an API.  During module execute, we build an SSH
session to the remote device for the purposes of sending and receiving
commands and output.  That is way we must specify connection=local.

Peter

On Fri, Sep 2, 2016 at 7:55 AM, Valérie P  wrote:

> Hello John,
>
> I've had a little bit of trouble with the ios_* modules and thanks to the
> source found in this sample it is now functional, anyhow I do not
> understand every line of it, and particularly the "connection: local" one.
> What is it used for? The ansible documentation refer to the connection:
> local as a way to make the playbook play locally.
>
> "It may be useful to use a playbook locally, rather than by connecting
> over SSH. This can be useful for assuring the configuration of a system by
> putting a playbook in a crontab. This may also be used to run a playbook
> inside an OS installer, such as an Anaconda kickstart.
>
> To run an entire playbook locally, just set the “hosts:” line to “hosts:
> 127.0.0.1” and then run the playbook like so:
>
> ansible-playbook playbook.yml --connection=local
>
> Alternatively, a local connection can be used in a single playbook play,
> even if other plays in the playbook use the default remote connection type:
>
> - hosts: 127.0.0.1
>   connection: local
>
> "
> Why is the connection: local parameters a must for it to work?
>
> Thanks in advance!
> Valerie
>
>
> Le mercredi 24 août 2016 09:20:15 UTC+2, John Barker a écrit :
>>
>> I've added a comment with the the corrected playbook sample
>>
>> https://gist.github.com/privateip/11b042e569585ee9248a
>>
>> Regards,
>> John Barker
>>
>> On Wednesday, 10 August 2016 15:32:23 UTC+1, Bharath Bharadwaj wrote:
>>>
>>> Hi All,
>>>
>>> I'm new to Ansible and yml, my goal is to automate a part of network
>>> operation, I just want to start with a very simple output, copied below is
>>> my playbook, I'm trying to run a show version, but i'm getting error when
>>> executing the output, yet when i try the same yml script through yml
>>> validator, there is no errors.
>>>
>>> My Playbook
>>>
>>> vars:
>>> cli:
>>> host: "{{ network }}"
>>> username: admin
>>> password: test@123
>>> transport: cli
>>>
>>> tasks:
>>> - name: run multiple commands on remote nodes
>>>   ios_command:
>>>   - commands: show version
>>>   - provider: "{{ cli }}"
>>>   - transport: cli
>>>
>>> Error:
>>> "ERROR! playbooks must be a list of plays
>>>
>>> The error appears to have been in '/etc/ansible/playbooks/cisco_ios.yml':
>>> line 1, column 1, but may
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>> The offending line appears to be:
>>>
>>>
>>> vars:
>>> ^ 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/6383da04-b68b-4a33-85e9-87318eb0a5b8%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ansible 2.2.0 - ios_facts module

2016-08-29 Thread Peter Sprygada
Hi Rukka,

See sample playbook here:
https://gist.github.com/privateip/f473d9ce25dd699b14c9987264159616



On Mon, Aug 29, 2016 at 5:23 AM, Rukka Pal  wrote:

> I am a newbie and would like to use Ansible to automate network operation
> tasks, right now I am only interested in fact collection. I have been using
> the "raw" module which is not very flexible, hence I decided to install
> (from GitHub) ansible 2.2.0 to try the "ios_facts" module. First I was
> using paramiko, but it failed to open SFTP connection. Then I tried default
> ansible config, but it was complaining about SSH ("SSH Error: data could
> not be sent to the remote host. Make sure this host can be reached over
> ssh") so I changed "scp_if_ssh" to true. Now it says ""failed to transfer
> file to Line has invalid autocommand \"/bin/sh -c ( umask 77 && mkdir -p
> \"\"/ios_facts.py:\n\nPrivilege denied.\n" and the command won't run.
>
> What am I missing here? Could someone provide an example ad-hoc command or
> an example playbook?
>
> Environment: 3.13.0-93-generic Ubuntu 14, Perl 5.18.2-2ubuntu1.1
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/1cee5cad-6ce4-4dfe-b99b-73ebb1a87e6f%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] stdout looks empty, but 'when' thinks it isn't?

2016-08-23 Thread Peter Sprygada
Also, I noticed you are using ios_command to send configuration
statements.  Please switch to using ios_config.  In 2.2, ios_command will
no longer allow you to send configuration commands

On Tue, Aug 23, 2016 at 5:49 AM, 'Steve Kersley' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> Aha - yes, had missed that in the output.  Have been trying to work out
> why it differed from the example use of 'when' to check for empty stdout in
> the documentation, but I now see in the module docs for ios_command, that
> since it takes a list of commands as input, it also returns a list of
> stdout values rather than a single value.  That makes sense and explains
> the difference.
>
> Many thanks for pointing me the right way.
>
> On Monday, 22 August 2016 14:48:08 UTC+1, Kai Stian Olstad wrote:
>>
>>
>>
>> It's not empty, it does contain a list.
>> So if you do this I think it should work
>> when: syslog.stdout[0] != ""
>>
>> --
>> 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/7f4354fc-df5f-4992-b480-595b05a25f43%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-11 Thread Peter Sprygada
Thats really strange... I just rebuilt an Ansible env using the latest from
source and everything works fine.

https://gist.github.com/privateip/88b68576d7c0dd8d8e566ce3ec75e4a8

Will try to look at exactly which commit the asa_* modules showed up in the
submodule a bit later but it definitely is working with the latest.



On Thu, Aug 11, 2016 at 2:01 PM, jean-christophe manciot <
actionmysti...@gmail.com> wrote:

>
> @Tony Reveal
> @ Peter Sprygada
> Tony is right, I've just tried the asa_command and experienced the same
> issue:
>
> TASK [asa_pull_config : Fetching config from the remote node]
> **
> fatal: [172.21.100.252]: FAILED! => {"failed": true, "msg": "Could not
> find imported module support code for asa_command.  Looked for either * or
> asa"}
>
> despite having the "library" variable from /etc/ansible/ansible.cfg
> pointing at the right folder containing the cloned https://github.com/
> ansible/ansible-modules-extras.
> The issue is the same whatever the asa_* call is: acl, config, template or
> command.
>
> --
> 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/7e7d5823-8087-4789-8771-0b85381f9c74%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/7e7d5823-8087-4789-8771-0b85381f9c74%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAEkdrMg02s42KAw4DZw0LdhiVMb%3DjByc49g0ByX%2Bdy4YyerWwg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Simple cisco IOS show version

2016-08-10 Thread Peter Sprygada
See example here: https://gist.github.com/privateip/11b042e569585ee9248a

On Wed, Aug 10, 2016 at 11:12 AM, pixel fairy  wrote:

> start with
>
> - hosts: routers
>   vars:
> ...
>   tasks:
> ...
>
>
>
> On Wednesday, August 10, 2016 at 7:32:23 AM UTC-7, Bharath Bharadwaj wrote:
>>
>> Hi All,
>>
>> I'm new to Ansible and yml, my goal is to automate a part of network
>> operation, I just want to start with a very simple output, copied below is
>> my playbook, I'm trying to run a show version, but i'm getting error when
>> executing the output, yet when i try the same yml script through yml
>> validator, there is no errors.
>>
>> My Playbook
>>
>> vars:
>> cli:
>> host: "{{ network }}"
>> username: admin
>> password: test@123
>> transport: cli
>>
>> tasks:
>> - name: run multiple commands on remote nodes
>>   ios_command:
>>   - commands: show version
>>   - provider: "{{ cli }}"
>>   - transport: cli
>>
>> Error:
>> "ERROR! playbooks must be a list of plays
>>
>> The error appears to have been in '/etc/ansible/playbooks/cisco_ios.yml':
>> line 1, column 1, but may
>> be elsewhere in the file depending on the exact syntax problem.
>>
>> The offending line appears to be:
>>
>>
>> vars:
>> ^ 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/0e2c7491-cd53-4d07-8b20-c6870c600fc4%40googlegroups.
> com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-09 Thread Peter Sprygada
Currently that is the case.  The asa_* modules were added last month and
will be part of the Ansible 2.2 release later this year.

On Tue, Aug 9, 2016 at 11:21 AM, Tony R  wrote:

> Yes I see the instructions on how to install.  I've done the install of
> the latest release from Apt a few times. And I've done an install of the
> latest devel once.
>
> So what is everyone saying  that asa_command is only supported with
> the latest devel?
>
> On Aug 9, 2016 10:43 AM, "jean-christophe manciot" <
> actionmysti...@gmail.com> wrote:
>
>> To install from official PPA for Ubuntu: http://docs.ansible.co
>>> m/ansible/intro_installation.html#latest-releases-via-apt-ubuntu
>>>
>> Another way is through pip: sudo pip install ansible
>>
>> --
>> 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/to
>> pic/ansible-project/QWMQJCUavV0/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/ms
>> gid/ansible-project/e78db62c-0fc2-4837-895c-e37b0400a4a8%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAM8dj%3D23bBK6Mc3Fw8g-24zroz54pN0Zsm3-Xyto-
> EXicTXcOQ%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/CAEkdrMiHfNbNTDUzND0YuP06dKn0PWD9fvnpUW4ZG0DGtc%2BozQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-09 Thread Peter Sprygada
can you paste a copy of ansible --version into this thread?  I suspect you
are not running the latest version from devel

On Mon, Aug 8, 2016 at 12:35 PM, Tony R  wrote:

> OK, any other ideas?  I cloned the repository.  I edited ansible.cfg.  I
> also tried the --module-path command line parameter.  But all I get is this
> error about not being able to find the asa_command module:
>
> TASK [asa_command] **
> ***
> fatal: [asa5505]: FAILED! => {"failed": true, "msg": "Could not find
> imported module support code for asa_command.  Looked for either * or asa"}
>
>
>
> On Sun, Aug 7, 2016 at 9:38 AM, jean-christophe manciot <
> actionmysti...@gmail.com> wrote:
>
>> The asa_* commands are not part of latest Ansible version (2.1.1.0) yet.
>>>
>> You need to clone the repository https://github.com/ansible/ans
>> ible-modules-extras and modify ansible's configuration to point to your
>> local folder in /etc/ansible/ansible.cfg with "library= ..."
>>
>> --
>> 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/to
>> pic/ansible-project/QWMQJCUavV0/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/ms
>> gid/ansible-project/c80fd3d5-634e-4bfe-ad4d-17d116f95a15%
>> 40googlegroups.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/CAM8dj%3D1UdM1-aCppUhiojwsEsut7pyBRAzWyE%
> 3Di5PoLBYFX_%3Dg%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/CAEkdrMiPe2bMzuZ133z2086KKz%3DUHAP-GoQzDuY2_ZFaFA1DsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-08-03 Thread Peter Sprygada
The ASA modules in extras are CLI based not REST based so there is no
dependency on REST API.   Not sure about the 9.3 requirement, I don't see
that anywhere in the module docstring.

Agreed that the modules are currently part of devel and not ready for
production use yet (as in still be tested) but going down the path of force
fitting ios_command to fill that role is no more or no less ready for
production as it isn't tested against ASA devices

On Fri, Jul 22, 2016 at 5:54 PM, Tony Reveal <arev...@gmail.com> wrote:

> Yes, there are ASA specific modules.  But those modules require ASA v9.3
> and use Cisco's REST API introduced in ASA v9.3.  For anyone not wishing to
> use the REST API or who does not have ASA v9.3, those ASA modules do not
> work.  In addition, it doesn't appear that those modules are ready for
> "production" use yet.  According to the developer on his own website - he
> is still testing, asking for help testing, He's still finding bugs (normal
> even after release).  Some his own, and some are bugs in Cisco's REST API.
>
> Now - to post what I found wrong because you didn't publish it the first
> time
>
> Ansible's ios_command module tries to run the command "terminal length 0"
> to disable breaks which would require the user to interact and "continue"
> the output.  The problem with this is that the "terminal length 0" command
> only works on Cisco routers and switches.  The appropriate command for an
> ASA is "terminal pager 0".
>
>
> On Friday, July 22, 2016 at 2:01:14 PM UTC-5, Peter Sprygada wrote:
>>
>> There are now ASA specific modules available in extras (
>> https://github.com/ansible/ansible-modules-extras/tree/devel/network/asa)
>>  I would recommend using those for management of ASA devices.
>>
>> On Fri, Jul 22, 2016 at 12:25 PM, Tony Reveal <are...@gmail.com> wrote:
>>
>>> Did you ever find a fix for this?  I'm seeing the same error when
>>> connecting to an ASA 5505.
>>>
>>>
>>> On Wednesday, June 1, 2016 at 1:59:34 AM UTC-5, Ludi Fang wrote:
>>>>
>>>> *I could login the cisco device with SSH and run the show version
>>>> successfully.*
>>>>
>>>> -
>>>> [root@peklnelh03 ansible]# ssh ...@10.106.65.xxx
>>>> x...@10.106.65.xxx's password:
>>>> **
>>>> This is a private property facility to be accessed and used for Lenovo
>>>> internal systems. Unauthorized Access Prohibited!
>>>> **
>>>> ***
>>>> *  Warning Notice:*
>>>> *ip verify reverse-path interface is not supported  *
>>>> Type help or '?' for a list of available commands.
>>>> CNSHPFW5510-01> show version
>>>>
>>>> Cisco Adaptive Security Appliance Software Version 8.2(5)51
>>>> Device Manager Version 5.2(4)
>>>>
>>>> -
>>>> *However, I run the ios_command with ansible, I got this error:*
>>>>
>>>>
>>>> **
>>>> TASK [ios_command]
>>>> *
>>>> fatal: [10.106.65.xxx]: FAILED! => {"changed": false, "commands":
>>>> "terminal length 0", "failed": true, "msg": "terminal length 0\r\n
>>>> ^\r\nERROR: % Invalid input detected at '^' marker.\r\n\r> "}
>>>>
>>>> - hosts: ios
>>>>   gather_facts: no
>>>>   connection: local
>>>>
>>>>   tasks:
>>>>   - name: LOGIN
>>>> include_vars: secrets.yaml
>>>>
>>>>   - name: PROVIDER
>>>> set_fact:
>>>>   provider:
>>>> host: "{10.106.65.xxx}"
>>>> username: "{xxx}"
>>>> password: "{6785493@bcdD}"
>>>> auth_pass: "{cisco}"
>>>>   - ios_command:
>>>>   host: "10.106.65.x

Re: [ansible-project] Network Modules Parents: as a list

2016-08-02 Thread Peter Sprygada
I think there is a little confusion here.   Parents refers to hierarchy in
the configuration file but what you have described here is separate
blocks.  Your example playbook would try to build the config as such:

interface GigabitEthernet1/0/2
  interface GigabitEthernet1/0/30
switchport access vlan 10

Which of course explains why you only see the second interface configured.
In order to achieve what you are attempting to do, you need to loop over
the task as follows:

- name: vlan 10
  ios_config:
host: "A-NODE"
username: admin
password: password
lines:
  - switchport access vlan 10
parents: "{{ item }}"
authorize: yes
  with_items:
- interface GigabitEthernet1/0/2
- interface GigabitEthernet1/0/30


On Tue, Aug 2, 2016 at 3:40 AM,  wrote:

> Hello,
>
> I am trying to setup a file as shown below. Where the command "switchport
> access vlan 10" is required on two separate parts of the configuration
> "GigabitEthernet1/0/2" and "GigabitEthernet1/0/30". However it only ever
> applies the command to the last item in the Parents list. Is this a valid
> approach/ syntax for this. I have tried against ansible 2.1.0.0 and 2.1.1.0
> but each time the same result.
>
> thanks
>
> ---
>
> - hosts: cisco_switches
>
>   gather_facts: no
>
>   connection: local
>
>   strategy: free
>
>   tasks:
>
>   - name: vlan 10
>
> ios_config:
>
>  host: "A-NODE"
>
>  username: admin
>
>  password: password
>
>  lines:
>
>- switchport access vlan 10
>
>  parents:
>
>- interface GigabitEthernet1/0/2
>
>- interface GigabitEthernet1/0/30
>
>  authorize: yes
>
> --
> 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/8f48ebf8-efd5-485a-ac7f-8e38f987951a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: ansible 2.0.1.0 run show version with Cisco ASA-55x0

2016-07-22 Thread Peter Sprygada
There are now ASA specific modules available in extras (
https://github.com/ansible/ansible-modules-extras/tree/devel/network/asa)
 I would recommend using those for management of ASA devices.

On Fri, Jul 22, 2016 at 12:25 PM, Tony Reveal  wrote:

> Did you ever find a fix for this?  I'm seeing the same error when
> connecting to an ASA 5505.
>
>
> On Wednesday, June 1, 2016 at 1:59:34 AM UTC-5, Ludi Fang wrote:
>>
>> *I could login the cisco device with SSH and run the show version
>> successfully.*
>>
>> -
>> [root@peklnelh03 ansible]# ssh ...@10.106.65.xxx
>> x...@10.106.65.xxx's password:
>> **
>> This is a private property facility to be accessed and used for Lenovo
>> internal systems. Unauthorized Access Prohibited!
>> **
>> ***
>> *  Warning Notice:*
>> *ip verify reverse-path interface is not supported  *
>> Type help or '?' for a list of available commands.
>> CNSHPFW5510-01> show version
>>
>> Cisco Adaptive Security Appliance Software Version 8.2(5)51
>> Device Manager Version 5.2(4)
>>
>> -
>> *However, I run the ios_command with ansible, I got this error:*
>>
>>
>> **
>> TASK [ios_command]
>> *
>> fatal: [10.106.65.xxx]: FAILED! => {"changed": false, "commands":
>> "terminal length 0", "failed": true, "msg": "terminal length 0\r\n
>> ^\r\nERROR: % Invalid input detected at '^' marker.\r\n\r> "}
>>
>> - hosts: ios
>>   gather_facts: no
>>   connection: local
>>
>>   tasks:
>>   - name: LOGIN
>> include_vars: secrets.yaml
>>
>>   - name: PROVIDER
>> set_fact:
>>   provider:
>> host: "{10.106.65.xxx}"
>> username: "{xxx}"
>> password: "{6785493@bcdD}"
>> auth_pass: "{cisco}"
>>   - ios_command:
>>   host: "10.106.65.x"
>>   username: "xx"
>>   password: "6785493@bcdD"
>>   port: "22"
>>   commands:
>> - show version
>> register: version
>>   - debug: var=version.stdout_lines
>>
>> -
>> *Could someone give me some advice to fix this issue?*
>>
>> --
> 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/5cc05fda-51a7-4b68-b24d-e47acdd2aff3%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Stdout processing

2016-07-19 Thread Peter Sprygada
Use a registered variable to access the return data.

See example here:
https://gist.github.com/privateip/6d3c2eb6a7301a4d20eda17af2b19be0

More about registered variables here:
http://docs.ansible.com/ansible/playbooks_variables.html#sts=Registered
Variables%C2%B6


On Mon, Jul 18, 2016 at 8:52 AM, Eric Marquez  wrote:

> Simple question, what’s the best way to capture stdout from a task that is
> performed?  For example I want to run a command to gather some telemetry
> from a switch but is using the debug the best way to get the stdout data?
> I feel like there is a different way to do this without using debug.
>
>
>
>
>
> ---
>
> - name: show mac address-table
>
>   register: output
>
>   nxos_command:
>
> commands:
>
>   - show mac address-table | json
>
> provider: "{{ cli }}"
>
> - name: output debug for mac address-table
>
>   debug: var=output
>
>
>
>
>
> - name: copy output to file
>
>   copy:
>
> content: "{{ output.stdout_lines }}\n"
>
> dest: /var/tmp/macaddress.txt
>
>
>
>
>
> Sent from Mail  for
> Windows 10 [14393 - 16.0.7167.4026]
>
>
>
> --
> 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/CY1PR0301MB12609B3A9DA5F3E17B7B4C39DD360%40CY1PR0301MB1260.namprd03.prod.outlook.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/CAEkdrMh%3DN%2BEOT_Joj_ou7hZ2qMF3WmtiVVWPJRb6KCaWOJVmfA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Which Cisco module to configure interfaces?

2016-07-17 Thread Peter Sprygada
Kyle,

Take a look here:
https://gist.github.com/privateip/a83443dfe301255fa4648933e8ab7f61

Peter

On Tue, Jul 12, 2016 at 6:15 PM, Kyle White 
wrote:

> Hello all!
>
> I have been trying to modify my VTY interfaces on all the devices in my
> district, but do not know which module will be the best for this? I tried
> the ios_command and ios_config modules with no success (I think they can
> only modify win global config).
>
> Could anybody please point me in the right direction?
>
> --
> 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/4438eef9-4834-40d9-a7c3-152136dec41a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Netconf module for Ansible

2016-06-09 Thread Peter Sprygada

https://github.com/ansible/ansible-modules-extras/tree/devel/network/netconf

On 6/8/16 9:43 PM, K. Krishna wrote:

Hi,
Is there a generic Netconf module support ?
Is there any plan to add such as module ?
Thanks,
Krishna



--
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/161daddd-0866-4bac-bad2-541e561e671b%40ansible.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ios_template, nxos_template breaking order of src config

2016-06-08 Thread Peter Sprygada
ios_template and nxos_template work by reading in the input file, 
parsing it and comparing it against a parsed copy of the running config 
of the network device.  In order for the template module to work 
effectively, the input file must match the same block syntax as the 
target device.  Since ios and nxos use different configuration file 
syntax, you must supply two different input files (one for each OS).


In your example, you would need an input file for ios using single space 
block indents and a second input file for nxos using two space block 
indents.


Also, can you confirm what version of Ansible you are running.  There as 
an issue with global ordering statements that was fixed before the final 
2.1 was released.


On 6/8/16 4:11 AM, David Vávra wrote:

Hi, I would like to clarify how network template modules are handling given
src configuration because so far I've found out several cases where its
breaking the order of configuration commands.
This is my used playbook
.

For example:

tmplconfig.j2 :
vlan 901
name 0901-vlan
vlan 902
name 0902-vlan
vlan 903
name 0903-vlan
vlan 411
name 0411-vlan
vlan 427
name 0427-vlan
vlan 419
name 0419-vlan
vlan 870
name 0870-vlan
vlan 550
name 0550-vlan
vlan 554
name 0554-vlan


for ios_template and nxos_template returns something like this:


TASK [debug]
***
ok: [switch-test] => {
"template": {
"changed": true,
"updates": [
"vlan 411",
"vlan 413",
"vlan 415",
"name 0415-vlan",
"name 0552-vlan",
"name 0413-vlan",
"vlan 551",
"name 0551-vlan",
"vlan 552",
"vlan 870 ",
"name 0870-vlan",
"name 0411-vlan"
]
}
}

Single space intendation corrects this for IOS, doublespace for NXOS.

So, I have to use something like this:
vlan 901
 name 0901-vlan

which is not optimal, because it looks like that it then does not match any
existing configuration for the vlans (because of the two leading spaces
before name vlan configuration subcommand).



When I try to configure SNMP community and ACL, I get the followint
results:

tmplconfig.j2:
ip access-list standard SNMP
 permit 10.4.6.14
 permit 10.3.5.14
snmp-server community public RO SNMP

IOS is basically fine, but SNMP community configuration and ACL are applied
in the different order.

TASK [debug]
***
ok: [switch-ios] => {
"template": {
"changed": true,
"updates": [
"snmp-server community public RO SNMP",
"ip access-list standard SNMP",
" permit 10.4.6.14",
" permit 10.3.5.14"
]
}
}

NXOS is broken:
ok: [switch-nxos] => {
"template": {
"changed": true,
"updates": [
"snmp-server community public RO SNMP",
" permit 10.4.6.14",
" permit 10.4.6.14",
"ip access-list standard SNMP",
" permit 10.3.5.14",
" permit 10.3.5.14"
]
}
}











--
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/4954c137-50ef-ecfa-a054-c5e593bd34ef%40ansible.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] No Networking Working Group IRC Meeting today

2016-06-01 Thread Peter Sprygada

We will resume at our regular time next week.

--
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/09a5ca2d-8d91-4237-6934-8dc3762bd4ac%40ansible.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Ansible 2.2 ios modules are failing with message "Failed to connect to the host via ssh."

2016-05-25 Thread Peter Sprygada

Add connection: local to your playbook

On 5/24/16 1:19 PM, davis mathew kuriakose wrote:

I'm not able to run ios_command module in Ansible 2.1 for executing
commands on my cisco routers.


I've written a playbook for testing ios_command module on cisco routers.

Following is the playbook I wrote


---
  - hosts: router2

   tasks:

 - ios_command:

username: cisco

password: cisco

# host: router2.3node.example.com

commands:

  - show version

register: output

 - debug: msg="Hello World! {{ output.stdout }}"


But the playbook fails with the following message :


*fatal: [router2.3node.example.com]: UNREACHABLE! => {"changed": false,
"msg": "Failed to connect to the host via ssh.", "unreachable": true}*


and value *unreachable=1*


Also find the output while run on debug mode




TASK [setup]
***

Using module file
/home/cisco/ansible_dev/ansible/lib/ansible/modules/core/system/setup.py

 ESTABLISH SSH CONNECTION FOR USER: None

 SSH: EXEC ssh -C -q -o ControlMaster=auto -o
ControlPersist=60s -o KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 -o
ControlPath=/home/cisco/.ansible/cp/ansible-ssh-%h-%p-%r
router2.3node.example.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1464109982.9-18150317646623 `" && echo
ansible-tmp-1464109982.9-18150317646623="` echo
$HOME/.ansible/tmp/ansible-tmp-1464109982.9-18150317646623 `" ) && sleep
0'"'"''



fatal: [router2.3node.example.com]: UNREACHABLE! => {"changed": false,
"msg": "Failed to connect to the host via ssh.", "unreachable": true}


Please let me know if someone has tried the same and solved this problem.

Thanks & Regards,
Davis



--
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/1c5d6e77-0a5c-f2ad-14d2-ebe7b57f2290%40ansible.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ios_template making changes when router config already exists

2016-05-18 Thread Peter Sprygada
ahh thanks for the reminder... will take a look at it this week yet

On Tue, May 17, 2016 at 11:44 PM, Luke Russell <lukeruss...@hotmail.com.au>
wrote:

> Hi Peter,
>
> Is there any follow up on this? Do you need anything further?
>
>
> On Friday, April 15, 2016 at 10:13:07 PM UTC+10, Peter Sprygada wrote:
>>
>> Hi Luke, We don't actually screen scrape the configuration in this case.
>> Can you post the full playbook via a gist? (or at least the full task?)
>>
>> On Wed, Apr 13, 2016 at 8:45 PM, Luke Russell <luker...@hotmail.com.au>
>> wrote:
>>
>>> I am using ios_template to deploy some DMVPN tunnels. For some reason it
>>> is not recognising two commands that already exist on the router - *ip
>>> nhrp map a.a.a.a b.b.b.b* and* ip nhrp nhs a.a.a.a*. I'm not really
>>> sure what is unique about these two commands to produce this affect, and it
>>> isn't currently stopping me from doing anything. It just throws a spanner
>>> in the idea of being idempotent. My guess would be a problem with the
>>> underlying regex doing the screen scraping.
>>>
>>> Running the playbook with -vvv option produces this output (cleaned up):
>>>
>>>
>>> "src":
>>> !
>>> interface Tunnel10
>>>  description primary tunnel
>>>  ip vrf forwarding VRF-A
>>>  ip address 10.0.0.11 255.255.240.0
>>>  no ip redirects
>>>  ip mtu 1400
>>>  ip nhrp authentication 10
>>>  ip nhrp map multicast 172.16.0.11
>>>  ip nhrp map 10.0.0.1 172.16.0.11
>>>  ip nhrp network-id 10
>>>  ip nhrp holdtime 360
>>>  ip nhrp nhs 10.0.0.1
>>>  ip nhrp shortcut
>>>  ip tcp adjust-mss 1360
>>>  load-interval 30
>>>  delay 600
>>>  qos pre-classify
>>>  tunnel source Loopback1
>>>  tunnel mode gre multipoint
>>>  tunnel key 10
>>> end
>>>
>>> "updates":
>>> interface Tunnel10
>>> ip nhrp map 10.0.0.1 172.16.0.11
>>> ip nhrp ohs 10.0.0.1
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/837e4cc8-d4cb-4091-998d-d0470f06372b%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/837e4cc8-d4cb-4091-998d-d0470f06372b%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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/a48934e5-099d-43de-bd73-10b1729b0b10%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/a48934e5-099d-43de-bd73-10b1729b0b10%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAEkdrMjwT_RfPALnUE5vQ-AQLxBWwS-gHD%3DB8%2Bk5xNpWdDbt9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Hosts file and ansible.cfg for Cisco IOS

2016-04-26 Thread Peter Sprygada
Take a look here for an example...
https://gist.github.com/privateip/11b042e569585ee9248a

On Tue, Apr 26, 2016 at 4:41 AM, Iñigo Esteban Oleaga <
i.esteban.ole...@gmail.com> wrote:

> Hi everyone,
>
> I am completely new with Ansible and I haven't been able yet to do nothing
> with my Cisco test switch. My Cisco switch is a C2960S with Cisco IOS
> Version 12.2(55) SE7. The switch has SSH server enabled. I have tried a lot
> of configuration files and many diferents ways of writing my host file but
> I haven't achivied anything (no ping module, no raw module).
>
> ¿Can anybody propose my how to configure my ansible.cfg and "hosts" files?
>
> Thank you in advance.
>
> (If more info needed I will provide it)
>
> --
> 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/02091d71-552a-430b-8427-c922f8bd7f0a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] ios_template making changes when router config already exists

2016-04-15 Thread Peter Sprygada
Hi Luke, We don't actually screen scrape the configuration in this case.
Can you post the full playbook via a gist? (or at least the full task?)

On Wed, Apr 13, 2016 at 8:45 PM, Luke Russell 
wrote:

> I am using ios_template to deploy some DMVPN tunnels. For some reason it
> is not recognising two commands that already exist on the router - *ip
> nhrp map a.a.a.a b.b.b.b* and* ip nhrp nhs a.a.a.a*. I'm not really sure
> what is unique about these two commands to produce this affect, and it
> isn't currently stopping me from doing anything. It just throws a spanner
> in the idea of being idempotent. My guess would be a problem with the
> underlying regex doing the screen scraping.
>
> Running the playbook with -vvv option produces this output (cleaned up):
>
>
> "src":
> !
> interface Tunnel10
>  description primary tunnel
>  ip vrf forwarding VRF-A
>  ip address 10.0.0.11 255.255.240.0
>  no ip redirects
>  ip mtu 1400
>  ip nhrp authentication 10
>  ip nhrp map multicast 172.16.0.11
>  ip nhrp map 10.0.0.1 172.16.0.11
>  ip nhrp network-id 10
>  ip nhrp holdtime 360
>  ip nhrp nhs 10.0.0.1
>  ip nhrp shortcut
>  ip tcp adjust-mss 1360
>  load-interval 30
>  delay 600
>  qos pre-classify
>  tunnel source Loopback1
>  tunnel mode gre multipoint
>  tunnel key 10
> end
>
> "updates":
> interface Tunnel10
> ip nhrp map 10.0.0.1 172.16.0.11
> ip nhrp ohs 10.0.0.1
>
>
>
>
> --
> 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/837e4cc8-d4cb-4091-998d-d0470f06372b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Questions about Ansible NXOS command

2016-04-01 Thread Peter Sprygada
You need to pass the required arguments to the module in order for it to
run properly.  Below is an example of running Ansible to collect the output
from show running-config.

ansible -m nxos_command -a "host=nxos01 username=admin password=admin
commands='show running-config'" localhost --connection local

An example playbook with output can be found here:
https://gist.github.com/privateip/cd979aff53d7f4ba6fec854580e18a1d



On Thu, Mar 31, 2016 at 10:13 PM, Ludi Fang  wrote:

> Hello support team,
>
> when I enter this command,
>
> ansible test -m nxos_command
>
> it gives me the following error:
>
> 10.122.234.253 | FAILED! => {
> "changed": false,
> "failed": true,
> "msg": "missing required arguments: username,host"
> }
>
> It seems lack of some parameters, however, there's no more information
> about how to put the parameters in the command.
> We want to excute "'show version'" and "'show running-config'" , can you
> help me, 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/544701e8-564b-4440-a8f5-f63891291f8b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: Error handling in ios_config module

2016-03-29 Thread Peter Sprygada
​Should now be fixed in ansible/ansible devel.

no plan as of right now for higher order modules that scrap the cli.  you
should be able to accomplish most of these tasks with roles today using the
current modules as the foundation​

On Tue, Mar 29, 2016 at 2:12 AM, Uroš Bajželj <bajzelj.u...@gmail.com>
wrote:

> Ok great. Just to note, it is the same problem with ios_command and
> ios_template.
>
> BTW: Are you planning to add additional modules to networking section to
> handle for example access-list only, crypto settings, etc...? I mean like
> ios_access_list to handle ACLs from high level perspective.
>
> BR,
>
> Uros
>
>
> Dne torek, 29. marec 2016 01.25.44 UTC+2 je oseba Peter Sprygada napisala:
>>
>> Its a bug in ios_config not properly handling the return prompt. Should
>> have a fix committed soon to address this
>>
>> On Mon, Mar 28, 2016 at 3:55 PM, Uroš Bajželj <bajzel...@gmail.com>
>> wrote:
>>
>>> Hello
>>>
>>> Thanks for the answer. I tried your suggested solution but it does not
>>> help.
>>>
>>> The problem is that if task fails in the block section, then the rescue
>>> section is initiated. But the task fails here as well.
>>>
>>> Trying to find other solution... :)
>>>
>>> BR,
>>>
>>> Uros
>>>
>>>
>>> Dne sobota, 26. marec 2016 15.49.30 UTC+1 je oseba Roger Gomez napisala:
>>>
>>>> Maybe you can try blocks Ansible Blocks
>>>> <http://docs.ansible.com/ansible/playbooks_blocks.html>, they work
>>>> pretty similar to Python Try/Except/Finally.
>>>> Thanks.
>>>>
>>>> On Friday, March 25, 2016 at 10:41:29 AM UTC-4, Uroš Bajželj wrote:
>>>>>
>>>>> Hello
>>>>>
>>>>> I am using ios_config module to configure crypto map on the router.
>>>>>
>>>>> When you configure the empty crypto map statement the router display
>>>>> the following note:
>>>>>
>>>>> HQ(config)#crypto map CMAP 10 ipsec-isakmp
>>>>>
>>>>> % NOTE: This new crypto map will remain disabled until a peer
>>>>>
>>>>> and a valid access list have been configured.
>>>>>
>>>>>
>>>>> The problem here is that this error fails the task and ansible does
>>>>> not execute all commands in list. Is there anyway to tell the ansible to
>>>>> ignore this message?
>>>>>
>>>>>
>>>>> This is my task:
>>>>>
>>>>>
>>>>> - name: Configure crypto map
>>>>>
>>>>>   ios_config:
>>>>>
>>>>> host: "{{ ansible_ssh_host }}"
>>>>>
>>>>> username: "{{ username }}"
>>>>>
>>>>> password: "{{ password }}"
>>>>>
>>>>> lines:
>>>>>
>>>>>   - match address GRE-IPSEC
>>>>>
>>>>> parents: ['crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>>>
>>>>> before: ['no crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>>>
>>>>> match: strict
>>>>>
>>>>>   with_indexed_items: '{{ groups.remote }}'
>>>>>
>>>>>   when: "inventory_hostname in groups.hq"
>>>>>
>>>>>
>>>>> I also tried to add "ignore_errors: yes". But still it does not
>>>>> execute all commands in the lines.
>>>>>
>>>>>
>>>>> I was reading about failed_when attribute but I was not able to
>>>>> implement this in the correct way.
>>>>>
>>>>> (failed_when: "'FAILED' in command_result.msg)
>>>>>
>>>>>
>>>>> Any ideas?
>>>>>
>>>>>
>>>>> BR,
>>>>>
>>>>>
>>>>> Uros
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ansible-proje...@googlegroups.com.
>>> To post to this group, send email to ansible...@googlegroups.com.
>>> To view this discussion on t

Re: [ansible-project] Re: Error handling in ios_config module

2016-03-28 Thread Peter Sprygada
Its a bug in ios_config not properly handling the return prompt. Should
have a fix committed soon to address this

On Mon, Mar 28, 2016 at 3:55 PM, Uroš Bajželj 
wrote:

> Hello
>
> Thanks for the answer. I tried your suggested solution but it does not
> help.
>
> The problem is that if task fails in the block section, then the rescue
> section is initiated. But the task fails here as well.
>
> Trying to find other solution... :)
>
> BR,
>
> Uros
>
>
> Dne sobota, 26. marec 2016 15.49.30 UTC+1 je oseba Roger Gomez napisala:
>
>> Maybe you can try blocks Ansible Blocks
>> , they work
>> pretty similar to Python Try/Except/Finally.
>> Thanks.
>>
>> On Friday, March 25, 2016 at 10:41:29 AM UTC-4, Uroš Bajželj wrote:
>>>
>>> Hello
>>>
>>> I am using ios_config module to configure crypto map on the router.
>>>
>>> When you configure the empty crypto map statement the router display the
>>> following note:
>>>
>>> HQ(config)#crypto map CMAP 10 ipsec-isakmp
>>>
>>> % NOTE: This new crypto map will remain disabled until a peer
>>>
>>> and a valid access list have been configured.
>>>
>>>
>>> The problem here is that this error fails the task and ansible does not
>>> execute all commands in list. Is there anyway to tell the ansible to ignore
>>> this message?
>>>
>>>
>>> This is my task:
>>>
>>>
>>> - name: Configure crypto map
>>>
>>>   ios_config:
>>>
>>> host: "{{ ansible_ssh_host }}"
>>>
>>> username: "{{ username }}"
>>>
>>> password: "{{ password }}"
>>>
>>> lines:
>>>
>>>   - match address GRE-IPSEC
>>>
>>> parents: ['crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>
>>> before: ['no crypto map CMAP {{ item.0 + 1 }} ipsec-isakmp']
>>>
>>> match: strict
>>>
>>>   with_indexed_items: '{{ groups.remote }}'
>>>
>>>   when: "inventory_hostname in groups.hq"
>>>
>>>
>>> I also tried to add "ignore_errors: yes". But still it does not execute
>>> all commands in the lines.
>>>
>>>
>>> I was reading about failed_when attribute but I was not able to
>>> implement this in the correct way.
>>>
>>> (failed_when: "'FAILED' in command_result.msg)
>>>
>>>
>>> Any ideas?
>>>
>>>
>>> BR,
>>>
>>>
>>> Uros
>>>
>> --
> 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/501de10e-e29c-44c2-8f21-5e85825b9dd1%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] Re: eos_command module waitfor - IP address in json structure

2016-03-23 Thread Peter Sprygada
My pleasure, glad you found it helpful.

On Wed, Mar 23, 2016 at 3:41 PM, Martin Baro <martin.baro...@gmail.com>
wrote:

> Thanks Peter, much appreciated.
> Also thanks for the great network webinar, was really informative.
>
> Martin
>
> On Wednesday, March 23, 2016 at 7:40:56 AM UTC+1, Peter Sprygada wrote:
>>
>> (ansible)[ansible-eos]$ cat route.yaml
>> ---
>> - hosts: veos01
>>   gather_facts: no
>>
>>   vars:
>> route: 1.1.1.1/32
>>
>>   tasks:
>> - eos_command:
>> commands:
>>   - show ip route | json
>> waitfor:
>>   - "result[0].vrfs.default.routes[{{ route
>> }}].hardwareProgrammed eq true"
>> provider: "{{ cli }}"
>>
>>
>> (ansible)[ansible-eos]$ ansible-playbook route.yaml
>>
>> PLAY [veos01]
>> **
>>
>> TASK [eos_command]
>> *
>> ok: [veos01]
>>
>> PLAY RECAP
>> *
>> veos01 : ok=1changed=0unreachable=0
>>  failed=0
>>
>> On Wed, Mar 23, 2016 at 2:39 AM, Peter Sprygada <pspr...@ansible.com>
>> wrote:
>>
>>> Ignore the request for filing an issue, I committed a change that should
>>> fix this problem. The fix is available for testing in ansible/ansible devel
>>>
>>> On Tue, Mar 22, 2016 at 4:25 PM, Peter Sprygada <pspr...@ansible.com>
>>> wrote:
>>>
>>>> Thats a bug... could you file an issue at
>>>> github.com/ansible/ansible-modules-core please?
>>>>
>>>> On Tue, Mar 22, 2016 at 2:17 PM, Martin Baro <martin@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Uditha,
>>>>>
>>>>> Thanks for the reply.
>>>>> I've simplified the problem a bit (just removed the variable) and with
>>>>> removing the "" around the whole statement I managed to preserve the 
>>>>> quotes.
>>>>> Unfortunately it didn't solve the problem:
>>>>>
>>>>> waitfor:
>>>>>- result[0].vrfs.default.routes[\'
>>>>> 1.2.3.4/30\'].hardwareProgrammed
>>>>> <http://1.2.3.4/30%5C'%5D.hardwareProgrammed> eq true
>>>>>
>>>>> The error was: ValueError: result[0].vrfs.default.routes['
>>>>> 1.2.3.4/30'].hardwareProgrammed
>>>>> <http://1.2.3.4/30'%5D.hardwareProgrammed>
>>>>>
>>>>> The issue is the same with double quotes around the IP address.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, March 22, 2016 at 2:50:05 PM UTC+1, Uditha Desilva wrote:
>>>>>>
>>>>>> It may need more protection for those quotes -- perhaps this?
>>>>>>
>>>>>>- "result[0].vrfs.default.routes[\'{{ route 
>>>>>> }}\'].hardwareProgrammed
>>>>>> eq true"
>>>>>>
>>>>>>>
>>>>>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Ansible Project" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to ansible-proje...@googlegroups.com.
>>>>> To post to this group, send email to ansible...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/ansible-project/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/ansible-project/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>> 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/b0ae52f7-b3a7-4f4d-820a-4389a4921e1b%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/b0ae52f7-b3a7-4f4d-820a-4389a4921e1b%40googlegroups.com?utm_medium=email_source=footer>
> .
>
> 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/CAEkdrMg-2gOc_oQbMkSiUrW-hUq5JJqYzmmX%2BDjwC0ua_SLz5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: eos_command module waitfor - IP address in json structure

2016-03-23 Thread Peter Sprygada
(ansible)[ansible-eos]$ cat route.yaml
---
- hosts: veos01
  gather_facts: no

  vars:
route: 1.1.1.1/32

  tasks:
- eos_command:
commands:
  - show ip route | json
waitfor:
  - "result[0].vrfs.default.routes[{{ route }}].hardwareProgrammed
eq true"
provider: "{{ cli }}"


(ansible)[ansible-eos]$ ansible-playbook route.yaml

PLAY [veos01]
**

TASK [eos_command]
*
ok: [veos01]

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

On Wed, Mar 23, 2016 at 2:39 AM, Peter Sprygada <pspryg...@ansible.com>
wrote:

> Ignore the request for filing an issue, I committed a change that should
> fix this problem. The fix is available for testing in ansible/ansible devel
>
> On Tue, Mar 22, 2016 at 4:25 PM, Peter Sprygada <pspryg...@ansible.com>
> wrote:
>
>> Thats a bug... could you file an issue at
>> github.com/ansible/ansible-modules-core please?
>>
>> On Tue, Mar 22, 2016 at 2:17 PM, Martin Baro <martin.baro...@gmail.com>
>> wrote:
>>
>>> Hi Uditha,
>>>
>>> Thanks for the reply.
>>> I've simplified the problem a bit (just removed the variable) and with
>>> removing the "" around the whole statement I managed to preserve the quotes.
>>> Unfortunately it didn't solve the problem:
>>>
>>> waitfor:
>>>- result[0].vrfs.default.routes[\'
>>> 1.2.3.4/30\'].hardwareProgrammed
>>> <http://1.2.3.4/30%5C'%5D.hardwareProgrammed> eq true
>>>
>>> The error was: ValueError: result[0].vrfs.default.routes['
>>> 1.2.3.4/30'].hardwareProgrammed
>>> <http://1.2.3.4/30'%5D.hardwareProgrammed>
>>>
>>> The issue is the same with double quotes around the IP address.
>>>
>>>
>>>
>>>
>>> On Tuesday, March 22, 2016 at 2:50:05 PM UTC+1, Uditha Desilva wrote:
>>>>
>>>> It may need more protection for those quotes -- perhaps this?
>>>>
>>>>- "result[0].vrfs.default.routes[\'{{ route }}\'].hardwareProgrammed
>>>> eq true"
>>>>
>>>>>
>>>>>>> --
>>> 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/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/ansible-project/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>>> 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/CAEkdrMjeNF_BG%2BHdMtr-rXX3EscTtEFkUr-wgEjuOE75WrBTRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: eos_command module waitfor - IP address in json structure

2016-03-23 Thread Peter Sprygada
Ignore the request for filing an issue, I committed a change that should
fix this problem. The fix is available for testing in ansible/ansible devel

On Tue, Mar 22, 2016 at 4:25 PM, Peter Sprygada <pspryg...@ansible.com>
wrote:

> Thats a bug... could you file an issue at
> github.com/ansible/ansible-modules-core please?
>
> On Tue, Mar 22, 2016 at 2:17 PM, Martin Baro <martin.baro...@gmail.com>
> wrote:
>
>> Hi Uditha,
>>
>> Thanks for the reply.
>> I've simplified the problem a bit (just removed the variable) and with
>> removing the "" around the whole statement I managed to preserve the quotes.
>> Unfortunately it didn't solve the problem:
>>
>> waitfor:
>>- result[0].vrfs.default.routes[\'1.2.3.4/30\'].hardwareProgrammed
>> <http://1.2.3.4/30%5C'%5D.hardwareProgrammed> eq true
>>
>> The error was: ValueError: result[0].vrfs.default.routes['
>> 1.2.3.4/30'].hardwareProgrammed
>> <http://1.2.3.4/30'%5D.hardwareProgrammed>
>>
>> The issue is the same with double quotes around the IP address.
>>
>>
>>
>>
>> On Tuesday, March 22, 2016 at 2:50:05 PM UTC+1, Uditha Desilva wrote:
>>>
>>> It may need more protection for those quotes -- perhaps this?
>>>
>>>- "result[0].vrfs.default.routes[\'{{ route }}\'].hardwareProgrammed
>>> eq true"
>>>
>>>>
>>>>>> --
>> 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/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>> 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/CAEkdrMi%2BY8sJjFmWF%3DosrHAkCCRwOB0s9ex%3D2qwyg9A52-odBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: eos_command module waitfor - IP address in json structure

2016-03-22 Thread Peter Sprygada
Thats a bug... could you file an issue at
github.com/ansible/ansible-modules-core please?

On Tue, Mar 22, 2016 at 2:17 PM, Martin Baro 
wrote:

> Hi Uditha,
>
> Thanks for the reply.
> I've simplified the problem a bit (just removed the variable) and with
> removing the "" around the whole statement I managed to preserve the quotes.
> Unfortunately it didn't solve the problem:
>
> waitfor:
>- result[0].vrfs.default.routes[\'1.2.3.4/30\'].hardwareProgrammed
>  eq true
>
> The error was: ValueError: result[0].vrfs.default.routes['
> 1.2.3.4/30'].hardwareProgrammed 
>
> The issue is the same with double quotes around the IP address.
>
>
>
>
> On Tuesday, March 22, 2016 at 2:50:05 PM UTC+1, Uditha Desilva wrote:
>>
>> It may need more protection for those quotes -- perhaps this?
>>
>>- "result[0].vrfs.default.routes[\'{{ route }}\'].hardwareProgrammed
>> eq true"
>>
>>>
> --
> 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/7f5a3e93-84cc-43c7-b11f-50ccb849971a%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: [ansible-project] action_plugin/ vs library/ module

2016-01-22 Thread Peter Sprygada
>From the sounds of it, developing a callback might be more appropriate.

http://docs.ansible.com/ansible/developing_plugins.html#callbacks

On Fri, Jan 22, 2016 at 1:13 PM, Mike Biancaniello 
wrote:

> So, it looks like, in my case, I'll want an action plugin since I don't
> really need anything run on a remote machine and I'll need access to the
> results of the playbook.
>
> --
> 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/50c9e5cb-3182-425a-a83f-a0b7a9b96bc5%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

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


[ansible-project] Re: [ansible-devel] Updating an object that exists within ansible_facts across modules

2015-12-20 Thread Peter Sprygada
Hi Jason,

No way to do what you are asking for today.  You would have to build a
"running fact" in the playbook to achieve this.  I think the better and
more preferred way would be to prepend your facts (nxos_neighbors,
nxos_interfaces, etc).

Peter

On Sun, Dec 20, 2015 at 7:52 AM, Jason Edelman  wrote:

> Hi,
>
> I'm looking to return ansible_facts from multiple modules but have the
> results be updated to be in a common value within ansible_facts.  (just
> like ansible_facts already does)
>
> For example, in module 1, I want to have;
>
> results = {}
> results['nxos'] = dict(neighbors=neighbors)
> module.exit_json(ansible_facts=results)
>
> and module 2, I'd like to have:
>
> results = {}
> results['nxos'] = dict(interfaces=interfaces)
> module.exit_json(ansible_facts=results)
>
> But it seems the second overwrites the first so I'm just left with nxos
> having a single key which is interfaces.  Is it possible to _update_ the
> 'nxos' dictionary in this example and not treat it as a new object?
> Clearly, I can just use ansible_facts, but it would be preferred to keep
> them within the same "key" here.
>
> Or is there another way to accomplish this?
>
> Thanks,
> Jason
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-devel+unsubscr...@googlegroups.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/CAEkdrMigvoTsiuO7B8c5h55imvUivUGXPXhvOm2_CFAvzoaRSQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.