From ed0c7d377e977fd176e772441deb0d448283ac2f Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Wed, 28 Oct 2020 08:22:02 +0100 Subject: [PATCH] More docs updates (#4) * Fix names. * Remove superfluous tasks:. --- plugins/modules/api.py | 17 ++++++++-------- plugins/modules/command.py | 41 +++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/plugins/modules/api.py b/plugins/modules/api.py index b86fab7..05bf19d 100644 --- a/plugins/modules/api.py +++ b/plugins/modules/api.py @@ -96,7 +96,7 @@ options: EXAMPLES = ''' --- -- name: Test api +- name: Use RouterOS API hosts: localhost gather_facts: no vars: @@ -153,11 +153,12 @@ EXAMPLES = ''' ansible.builtin.debug: msg: '{{ queryout }}' - - ansible.builtin.set_fact: - query_id : "{{ queryout['msg'][0]['.id'] }}" + - name: Store query_id for later usage + ansible.builtin.set_fact: + query_id: "{{ queryout['msg'][0]['.id'] }}" - name: Update ".id = {{ query_id }}" taken with custom fact "fquery_id" - api: + community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" @@ -170,7 +171,7 @@ EXAMPLES = ''' msg: '{{ updateout }}' - name: Remove ips - stage 1 - query ".id" for "{{ ip2 }}" and "{{ ip3 }}" - api: + community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" @@ -181,7 +182,7 @@ EXAMPLES = ''' - "{{ ip2 }}" - "{{ ip3 }}" - - name: set fact for ".id" from "Remove ips - stage 1 - query" + - name: Set fact for ".id" from "Remove ips - stage 1 - query" ansible.builtin.set_fact: to_be_remove: "{{ to_be_remove |default([]) + [item['msg'][0]['.id']] }}" loop: "{{ id_to_remove.results }}" @@ -192,7 +193,7 @@ EXAMPLES = ''' # Remove "{{ rmips }}" with ".id" by "to_be_remove" from query - name: Remove ips - stage 2 - remove "{{ ip2 }}" and "{{ ip3 }}" by '.id' - api: + community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" @@ -206,7 +207,7 @@ EXAMPLES = ''' msg: '{{ remove }}' - name: Arbitrary command example "/system identity print" - api: + community.routeros.api: hostname: "{{ hostname }}" password: "{{ password }}" username: "{{ username }}" diff --git a/plugins/modules/command.py b/plugins/modules/command.py index c180895..82331a5 100644 --- a/plugins/modules/command.py +++ b/plugins/modules/command.py @@ -58,30 +58,29 @@ options: ''' EXAMPLES = """ -tasks: - - name: Run command on remote devices - community.routeros.command: - commands: /system routerboard print +- name: Run command on remote devices + community.routeros.command: + commands: /system routerboard print - - name: Run command and check to see if output contains routeros - community.routeros.command: - commands: /system resource print - wait_for: result[0] contains MikroTik +- name: Run command and check to see if output contains routeros + community.routeros.command: + commands: /system resource print + wait_for: result[0] contains MikroTik - - name: Run multiple commands on remote nodes - community.routeros.command: - commands: - - /system routerboard print - - /system identity print +- name: Run multiple commands on remote nodes + community.routeros.command: + commands: + - /system routerboard print + - /system identity print - - name: Run multiple commands and evaluate the output - community.routeros.command: - commands: - - /system routerboard print - - /interface ethernet print - wait_for: - - result[0] contains x86 - - result[1] contains ether1 +- name: Run multiple commands and evaluate the output + community.routeros.command: + commands: + - /system routerboard print + - /interface ethernet print + wait_for: + - result[0] contains x86 + - result[1] contains ether1 """ RETURN = """