If you're trying to make ansible make reports, rather than doing the debug
calls, *maybe* you would want to make a template for the report instead.

Just a thought...




On Sun, Jun 8, 2014 at 11:53 AM, Jason Edelman <[email protected]> wrote:

> Brent, sorry!  Here is what I have working right now.
> Michael et al, feel free to comment on this "hack" and let me know what
> else could be done to simplify.
>
> ---
> #-----------------------PLAY 1 ------------------------------------------#
>
> - name: collecting ospf data
>   hosts: routers
>   connection: local
>   gather_facts: no
>
> # note: routers only has two hosts/devices in it.  Basically, the two I
> want to compare
>
>   tasks:
>
>   - name: get ospf facts
>     ospf_facts: device={{inventory_hostname}} interface={{ ospf_interface
> }}
>     register: ospf_data
>
> # just a bunch of debug messages displaying some facts on each device
> during the run
>
>   - name: interface ip addresses used for OSPF peering
>     debug: msg="local router interface IP address- {{
> ospf_data.ofacts.oif_ip }} on {{ ospf_data.ofacts.oif }}"
>
>   - name: is ospf active on interface?
>     debug: msg="ospf active on interface = {{
> ospf_data.ofacts.ospf_active_on_intf }}"
>
>   - name: process id check
>     debug: msg="at least one ospf process configurd on router = {{
> ospf_data.ofacts.processExists }}"
>
>   - name: MTUs of interfaces
>     debug: msg="MTU = {{ ospf_data.ofacts.oif_mtu }}"
>
>   - name: ospf network type
>     debug: msg="network type = {{ ospf_data.ofacts.network_type }}"
>
>   - name: ospf timers on interface
>     debug: msg="{{ ospf_data.ofacts.timers }}"
>
>   - name: interface status
>     debug: msg="interface status={{
> ospf_data.ofacts.interface_status.status }} and line protocol = {{
> ospf_data.ofacts.interface_status.line_proto}}"
>
>   - name: display neighbors and state
>     debug: msg="{{ospf_data.ofacts.oif_neighbors}}"
>
> #-----------------------PLAY 2 ------------------------------------------#
>
> # local is just 127.0.0.1, so it runs just once
>
> - name: ospf config validation & automated re-configuration
>   hosts: local
>   connection: local
>   gather_facts: no
>
> #to simplify a bit, using "root" as what the "other" device will be
> compared to...10.1.1.110 and 10.1.1.1.120 are both devices from routers in
> the first play
>   vars:
>     root: "{{ hostvars['10.1.1.110'].inventory_hostname }}"
>     other: "{{ hostvars['10.1.1.120'].inventory_hostname }}"
>
> # creating new short name variables to simplify the calling of them in
> this play. Contents of the vars file is below too.
>   vars_files:
>     - vars/simple_vars.yml
>
>   tasks:
>
>   - debug: msg="{{ root }} mtu = {{ r1_mtu }} && {{ other }} mtu = {{
> r2_mtu }}"
>
>   - debug: msg="*******MTU mismatch*******"
>     when: r1_mtu != r2_mtu
>
>   - debug: msg="*******MTUs match*********"
>     when: r1_mtu == r2_mtu
>
>   - name: auto re-config of MTU by increasing lower MTU to be equal to
> higher MTU value
>     mtu: dev1={{ r1_ip }} dev2={{ r2_ip }} mtu1={{ r1_mtu }} mtu2={{
> r2_mtu }} int1={{ r1_oif }} int2={{ r2_oif }}
>     when: r1_mtu != r2_mtu
>
>
> VARS FILE:
> ---
> r1_mtu: "{{ hostvars[root].ospf_data.ofacts.oif_mtu }}"
> r2_mtu: "{{ hostvars[other].ospf_data.ofacts.oif_mtu }}"
> r1_ip: "{{ hostvars[root].inventory_hostname }}"
> r2_ip: "{{ hostvars[other].inventory_hostname }}"
> r1_oif: "{{ hostvars[root].ospf_data.ofacts.oif }}"
> r2_oif: "{{ hostvars[other].ospf_data.ofacts.oif }}"
>
>
> On Sun, Jun 8, 2014 at 11:33 AM, Michael DeHaan <[email protected]>
> wrote:
>
>> Hmm, if you are trying to build a "how are these various servers
>> different" kind of solution in Ansible, I'll say that doesn't really exist
>> yet, so what you are going to create if attempting to use ansible as a
>> programming language (it's not) may feel a little hackish.
>>
>>
>>
>>
>>
>>
>> On Fri, Jun 6, 2014 at 12:21 PM, Brent Langston <[email protected]>
>> wrote:
>>
>>>
>>> On Thu, Jun 5, 2014 at 7:52 PM, Jason Edelman <[email protected]>
>>> wrote:
>>>
>>>>  Have an alternative solution working now.
>>>
>>>
>>> secrets don't make friends! mind closing the loop by sharing what you
>>> came up with?
>>>
>>> --------
>>> Brent
>>> --------
>>>
>>> --
>>> 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/CABta7G2H4NognkHLmwyMc-COYQN1D%3DAJ12tD%3D96c1uqwGQNSEA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CABta7G2H4NognkHLmwyMc-COYQN1D%3DAJ12tD%3D96c1uqwGQNSEA%40mail.gmail.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 a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/ansible-project/SzvQN2zex-E/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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/CA%2BnsWgwG9GXCryjASBvmsEum9QnOyLfU8%2Bp%3D7ExuBa%3D8-bk5Vg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwG9GXCryjASBvmsEum9QnOyLfU8%2Bp%3D7ExuBa%3D8-bk5Vg%40mail.gmail.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/CA%2B_m3%2Bb-G8u0Y5opqNMUy%3DOW7F01pVKiob6sTkQbnkCbBf6nYQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CA%2B_m3%2Bb-G8u0Y5opqNMUy%3DOW7F01pVKiob6sTkQbnkCbBf6nYQ%40mail.gmail.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/CA%2BnsWgyJnObw6uF_oSCWJaxRqoSwoEDcaOWQK63i_cvhKeMAyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to