Giter VIP home page Giter VIP logo

community.routeros's Introduction

Community RouterOS Collection

CI Codecov

Provides modules for Ansible to manage MikroTik RouterOS instances.

You can find documentation for the modules and plugins in this collection here.

Tested with Ansible

Tested with the current Ansible 2.9, ansible-base 2.10 and ansible-core 2.11 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.

External requirements

The exact requirements for every module are listed in the module documentation.

Supported connections

The collection supports the network_cli connection.

Included content

  • community.routeros.api
  • community.routeros.command
  • community.routeros.facts

You can find documentation for the modules and plugins in this collection here.

Using this collection

See Ansible Using collections for general detail on using collections.

There are two approaches for using this collection. The command and facts modules use the network_cli connection and connect with SSH. The api module connects with the HTTP/HTTPS API.

Prerequisites

The terminal-based modules in this collection (community.routeros.command and community.routeros.facts) do not support arbitrary symbols in router's identity. If you are having trouble connecting to your device, please make sure that your MikroTik's identity contains only alphanumeric characters and dashes. Also, the community.routeros.command module does not support nesting commands and expects every command to start with a forward slash (/). Running the following command will produce an error.

- community.routeros.command:
    commands:
      - /ip
      - print

Connecting with network_cli

Example inventory hosts file:

[routers]
router ansible_host=192.168.1.1

[routers:vars]
ansible_connection=ansible.netcommon.network_cli
ansible_network_os=community.routeros.routeros
ansible_user=admin
ansible_ssh_pass=test1234

Example playbook:

---
- name: RouterOS test with network_cli connection
  hosts: routers
  gather_facts: false
  tasks:

  # Run a command and print its output
  - community.routeros.command:
      commands:
        - /system resource print
    register: system_resource_print
  - debug:
      var: system_resource_print.stdout_lines

  # Retrieve facts
  - community.routeros.facts:
  - debug:
      msg: "First IP address: {{ ansible_net_all_ipv4_addresses[0] }}"

Connecting with HTTP/HTTPS API

Example playbook:

---
- name: RouterOS test with API
  hosts: localhost
  gather_facts: no
  vars:
    hostname: 192.168.1.1
    username: admin
    password: test1234
  tasks:
    - name: Get "ip address print"
      community.routeros.api:
        hostname: "{{ hostname }}"
        password: "{{ password }}"
        username: "{{ username }}"
        path: "ip address"
        ssl: true
      register: print_path

Contributing to this collection

We're following the general Ansible contributor guidelines; see Ansible Community Guide.

If you want to clone this repositority (or a fork of it) to improve it, you can proceed as follows:

  1. Create a directory ansible_collections/community;
  2. In there, checkout this repository (or a fork) as routeros;
  3. Add the directory containing ansible_collections to your ANSIBLE_COLLECTIONS_PATH.

See Ansible's dev guide for more information.

Release notes

See the changelog.

Roadmap

We plan to regularly release minor and patch versions, whenever new features are added or bugs fixed. Our collection follows semantic versioning, so breaking changes will only happen in major releases.

More information

Licensing

GNU General Public License v3.0 or later.

See COPYING to see the full text.

community.routeros's People

Contributors

felixfontein avatar andersson007 avatar renatoalmeidaoliveira avatar heuels avatar gundalow avatar nikolaydachev avatar jplitza avatar qaxi avatar adeptvin1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.