mirror of
https://github.com/ansible-collections/community.routeros.git
synced 2025-06-27 03:59:05 +02:00
parent
3c0df4b343
commit
ed0c7d377e
2 changed files with 29 additions and 29 deletions
|
@ -96,7 +96,7 @@ options:
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
---
|
---
|
||||||
- name: Test api
|
- name: Use RouterOS API
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
|
@ -153,11 +153,12 @@ EXAMPLES = '''
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: '{{ queryout }}'
|
msg: '{{ queryout }}'
|
||||||
|
|
||||||
- ansible.builtin.set_fact:
|
- name: Store query_id for later usage
|
||||||
query_id : "{{ queryout['msg'][0]['.id'] }}"
|
ansible.builtin.set_fact:
|
||||||
|
query_id: "{{ queryout['msg'][0]['.id'] }}"
|
||||||
|
|
||||||
- name: Update ".id = {{ query_id }}" taken with custom fact "fquery_id"
|
- name: Update ".id = {{ query_id }}" taken with custom fact "fquery_id"
|
||||||
api:
|
community.routeros.api:
|
||||||
hostname: "{{ hostname }}"
|
hostname: "{{ hostname }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
username: "{{ username }}"
|
username: "{{ username }}"
|
||||||
|
@ -170,7 +171,7 @@ EXAMPLES = '''
|
||||||
msg: '{{ updateout }}'
|
msg: '{{ updateout }}'
|
||||||
|
|
||||||
- name: Remove ips - stage 1 - query ".id" for "{{ ip2 }}" and "{{ ip3 }}"
|
- name: Remove ips - stage 1 - query ".id" for "{{ ip2 }}" and "{{ ip3 }}"
|
||||||
api:
|
community.routeros.api:
|
||||||
hostname: "{{ hostname }}"
|
hostname: "{{ hostname }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
username: "{{ username }}"
|
username: "{{ username }}"
|
||||||
|
@ -181,7 +182,7 @@ EXAMPLES = '''
|
||||||
- "{{ ip2 }}"
|
- "{{ ip2 }}"
|
||||||
- "{{ ip3 }}"
|
- "{{ 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:
|
ansible.builtin.set_fact:
|
||||||
to_be_remove: "{{ to_be_remove |default([]) + [item['msg'][0]['.id']] }}"
|
to_be_remove: "{{ to_be_remove |default([]) + [item['msg'][0]['.id']] }}"
|
||||||
loop: "{{ id_to_remove.results }}"
|
loop: "{{ id_to_remove.results }}"
|
||||||
|
@ -192,7 +193,7 @@ EXAMPLES = '''
|
||||||
|
|
||||||
# Remove "{{ rmips }}" with ".id" by "to_be_remove" from query
|
# Remove "{{ rmips }}" with ".id" by "to_be_remove" from query
|
||||||
- name: Remove ips - stage 2 - remove "{{ ip2 }}" and "{{ ip3 }}" by '.id'
|
- name: Remove ips - stage 2 - remove "{{ ip2 }}" and "{{ ip3 }}" by '.id'
|
||||||
api:
|
community.routeros.api:
|
||||||
hostname: "{{ hostname }}"
|
hostname: "{{ hostname }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
username: "{{ username }}"
|
username: "{{ username }}"
|
||||||
|
@ -206,7 +207,7 @@ EXAMPLES = '''
|
||||||
msg: '{{ remove }}'
|
msg: '{{ remove }}'
|
||||||
|
|
||||||
- name: Arbitrary command example "/system identity print"
|
- name: Arbitrary command example "/system identity print"
|
||||||
api:
|
community.routeros.api:
|
||||||
hostname: "{{ hostname }}"
|
hostname: "{{ hostname }}"
|
||||||
password: "{{ password }}"
|
password: "{{ password }}"
|
||||||
username: "{{ username }}"
|
username: "{{ username }}"
|
||||||
|
|
|
@ -58,30 +58,29 @@ options:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = """
|
EXAMPLES = """
|
||||||
tasks:
|
- name: Run command on remote devices
|
||||||
- name: Run command on remote devices
|
community.routeros.command:
|
||||||
community.routeros.command:
|
commands: /system routerboard print
|
||||||
commands: /system routerboard print
|
|
||||||
|
|
||||||
- name: Run command and check to see if output contains routeros
|
- name: Run command and check to see if output contains routeros
|
||||||
community.routeros.command:
|
community.routeros.command:
|
||||||
commands: /system resource print
|
commands: /system resource print
|
||||||
wait_for: result[0] contains MikroTik
|
wait_for: result[0] contains MikroTik
|
||||||
|
|
||||||
- name: Run multiple commands on remote nodes
|
- name: Run multiple commands on remote nodes
|
||||||
community.routeros.command:
|
community.routeros.command:
|
||||||
commands:
|
commands:
|
||||||
- /system routerboard print
|
- /system routerboard print
|
||||||
- /system identity print
|
- /system identity print
|
||||||
|
|
||||||
- name: Run multiple commands and evaluate the output
|
- name: Run multiple commands and evaluate the output
|
||||||
community.routeros.command:
|
community.routeros.command:
|
||||||
commands:
|
commands:
|
||||||
- /system routerboard print
|
- /system routerboard print
|
||||||
- /interface ethernet print
|
- /interface ethernet print
|
||||||
wait_for:
|
wait_for:
|
||||||
- result[0] contains x86
|
- result[0] contains x86
|
||||||
- result[1] contains ether1
|
- result[1] contains ether1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
RETURN = """
|
RETURN = """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue