Hi Peter,
I am facing another issue with same i am trying to debug version only from
the results of show version using below method but it gives me variable
error. however when i run playbook -vvv i can see the show version command
is excuted and they are mapped to stdout and stdout_lines as you mention in
document. can you please help me with that or redirect me towards of link.
register: version
- debug: var = version.stdout[0].Version
Regards/surjeet
On Saturday, September 3, 2016 at 8:58:39 AM UTC+5:30, Peter Sprygada wrote:
>
> 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 <[email protected]
> <javascript:>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/6383da04-b68b-4a33-85e9-87318eb0a5b8%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/6383da04-b68b-4a33-85e9-87318eb0a5b8%40googlegroups.com?utm_medium=email&utm_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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/90ac7ce0-2187-4007-ad36-4f37219e486e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.