pierky.arouteserver

ansible-role-arouteserver

A role for installing and setting up ARouteServer.

Description

This role:

  • Installs ARouteServer and bgpq4

  • Copies a local general policy definition file (general.yml) or creates one based on best practices

  • Copies a local list of clients (clients.yml) or imports it from an IX-F Member Export JSON file

  • Creates route server configuration files that can be deployed to actual route servers.

Please note: It does not set up the real route server hosts, just the host where ARouteServer will run.

The real route server hosts need to be in the group arouteserver_managed_routeservers for this role to find them.

Many behaviors of this role can be adjusted using variables that are detailed below.

Installation

ARouteServer is installed using pip from PyPI or from a local package on the control machine. When the Ansible variable arouteserver_upgrade is set to true (default is false), it will allow the installation to be upgraded.

Any local file in the role's templates/config directory is copied to ARouteServer's directory (Jinja2 templates can be used).

General Policy (general.yml)

The general policy can be copied from a local file (Jinja2 templates are supported) or created based on best practices.

A general.yml file will be generated for each route server host using details like ASN, router-id, and BGP daemon from the host variables.

Clients List (clients.yml)

The clients' list can come from a local file or imported from IX-F Member Export JSON files, which can be accessed via HTTP/HTTPS.

If the clients list changes, it triggers the building of route server configuration files.

Route Server Configuration Files Building

Configuration files for the route server are saved in ARouteServer's directory; their names will look like this: <hostname>-[bird4|bird6|openbgpd].cfg.

If set, an external handler is notified when the configuration files are updated.

Tags

  • configure_policy: Only builds the general policy file (general.yml).

  • configure_clients: Only updates the clients list. Changes here trigger configuration files to be rebuilt.

  • build_rs_config: Only builds the route server configuration files.

Requirements

No special requirements.

Role Variables

Variables used by this role are organized below by topic.

Package Installation

  • (optional) arouteserver_local_package_file: If set, the role installs ARouteServer from this local path; otherwise, it fetches the latest from PyPI (default).
  • (optional) arouteserver_upgrade: When set to true, it allows upgrades of the arouteserver Python package via PIP.

Route Server Configuration: General Policy (general.yml)

  • (optional) arouteserver_general_cfg_file: Path to the local general.yml file for ARouteServer configuration (can use a Jinja2 template). If not set, the configure command will create the policy using best practices (default).

Route Server Configuration: Client List (clients.yml)

One of the following three variables is required:

  • arouteserver_clients_cfg_file: Path to the clients.yml file.

  • arouteserver_clients_from_euroix_file: Path to a Euro-IX member list file to import clients.

  • arouteserver_clients_from_euroix_url: URL of a Euro-IX member list to import clients. Useful for integrating ARouteServer with IXP-Manager.

  • (required for Euro-IX import) arouteserver_clients_from_euroix_ixp_id: ID of the IXP mentioned in the Euro-IX member list file.

  • (optional) arouteserver_clients_from_euroix_extra_args: Any extra arguments for the clients-from-euroix command. Example: --merge-from-peeringdb as-set max-prefix --vlan-id 123.

Route Server Customization: Specific Configuration Files

The variables arouteserver_local_files_dir and arouteserver_use_local_files can be set to provide pointers to local custom files for ARouteServer via its --use-local-files command.

Route Server Operations: RFC8326 Graceful Shutdown

The variable arouteserver_perform_graceful_shutdown, when enabled, tells ARouteServer to create a configuration with the graceful shutdown option. This helps manage traffic during maintenance.

It's advised to use this setting only for the duration of maintenance and not permanently.

Integration with Other Roles

  • (optional) arouteserver_notify_on_rs_change: If set, the role will notify a handler when route server configuration files are updated.

Directories Layout

Here are default directories used to store role components:

  • arouteserver_venv_dir: ~/.virtualenvs/arouteserver.
  • arouteserver_bin: {{arouteserver_venv_dir}}/bin/arouteserver.
  • arouteserver_dir: ~/arouteserver.
  • arouteserver_var: ~/arouteserver_var.
  • bgpq4_dir: ~/bgpq4.

Host Variable Names

The following variables specify host-specific names used to gather information from route server hosts. For instance, the variable arouteserver_varname_rs_asn (default: rs_asn) must be defined for each route server host and should include the ASN of that server.

Refer to the Example Playbook section for a practical example.

  • arouteserver_varname_rs_asn: rs_asn, the ASN of the route server. For example, 64496.
  • arouteserver_varname_daemon: daemon, the BGP daemon used on that host. Either bird or openbgpd.
  • arouteserver_varname_daemon_version: daemon_version, the version of the BGP daemon. For example, 1.6.3.
  • arouteserver_varname_router_id: router_id, the router ID of the host. For example, 192.0.2.1.
  • arouteserver_varname_local_networks: local_networks, a list of local networks for the IXP (needed for filters to reject any announcements for the IXP's prefixes). For example, 192.0.2.0/24,2001:db8::/32.

The values for arouteserver_varname_daemon and arouteserver_varname_daemon_version should reflect the supported daemon and its version for ARouteServer.

They are used in executing commands like this:

arouteserver <daemon> --target-version <daemon_version>

You can use the help commands arouteserver --help and arouteserver <daemon> --help for a list of supported values.

Dependencies

Route server hosts must be part of the group arouteserver_managed_routeservers.

Variables from the Host Variable Names section must be configured on each route server host.

Refer to the Example Playbook section for a practical example.

Example Playbook

hosts file:

[arouteserver_hosts]
172.17.0.2      # The host where ARouteServer will be installed and
                # run to create route server configuration files.

[arouteserver_managed_routeservers]
rs1		# The hosts where the route servers will run.
rs2

group_vars/arouteserver_managed_routeservers file:

rs_asn: 64496
local_networks:
- 192.0.2.0/24
- 2001:db8::/32

host_vars/rs1 file:

daemon: bird
daemon_version: 1.6.3
router_id: 192.0.2.1

host_vars/rs2 file:

daemon: openbgpd
daemon_version: 6.2
router_id: 192.0.2.2

site.yml file:

---
- hosts: arouteserver_hosts
  gather_facts: False

  vars:
    arouteserver_clients_from_euroix_url: "http://ixp-manager.example.com/api/v4/member-export/ixf/0.6?apikey=123456"
    routeserver_clients_from_euroix_ixp_id: 1

  roles:
  - ansible-role-arouteserver
$ ansible-playbook -i hosts site.yml

License

GPLv3

Author Information

Pier Carlo Chiodi - https://pierky.com

Blog: https://blog.pierky.com Twitter: @pierky

Informazioni sul progetto

An Ansible role for installing ARouteServer.

Installa
ansible-galaxy install pierky.arouteserver
Licenza
Unknown
Download
73
Proprietario
Network Reliability Engineer. Interests: network automation, Internet measurement and IP accounting / network data analysis