ansible-role-frrouting/molecule/default/molecule.yml
Dmitriy Rabotyagov 32dc34c70b Make role INJECT_FACTS_AS_VARS friendly
Enabled INJECT_FACTS_AS_VARS[1] (which is default behaviour) has very
negative impact on Ansible performance [2].

In order to be able to reduce amount of variables and performance
penalty, role is being adopted to be used with no injected facts

[1] https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_vars_facts.html#ansible-facts
[2] https://github.com/ansible/ansible/issues/73654

Change-Id: I71a326964be7597ebaad0183c3a774321885c6f5
2024-02-23 17:34:50 +01:00

72 lines
2.4 KiB
YAML

---
dependency:
name: galaxy
# options:
# requirements-file: requirements.yml
# role-file: requirements.yml
driver:
name: docker
platforms:
- name: primary
groups:
- frr
image: "${docker_user:-quay.io/gotmax23}/${docker_image_tag:-debian-systemd:buster}"
command: ${docker_command:-""}
privileged: true
pre_build_image: true
networks:
- name: frr
- name: noop
docker_networks:
- name: noop
ipam_config:
- subnet: 192.168.1.0/24
- name: secondary
groups:
- frr
image: "${docker_user:-quay.io/gotmax23}/${docker_image_tag:-debian-systemd:buster}"
command: ${docker_command:-""}
privileged: true
pre_build_image: true
networks:
- name: frr
provisioner:
name: ansible
lint:
name: ansible-lint
inventory:
host_vars:
primary:
frr_staticd_routes:
- ip route 10.0.0.0/24 192.168.1.10
frr_bgpd_config:
- router bgp 1234
- "bgp router-id {{ hostvars['primary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }}"
- "neighbor {{ hostvars['secondary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }} remote-as 5678"
- network 192.168.1.0/24
- address-family ipv4 unicast
- " neighbor {{ hostvars['secondary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }} prefix-list pl-allowed-adv out"
- "exit-address-family"
- ip prefix-list pl-allowed-adv seq 5 permit 192.168.1.0/24
- ip prefix-list pl-allowed-adv seq 10 deny any
secondary:
frr_bgpd_config:
- router bgp 5678
- "bgp router-id {{ hostvars['secondary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }}"
- "neighbor {{ hostvars['primary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }} remote-as 1234"
- address-family ipv4 unicast
- " neighbor {{ hostvars['primary']['ansible_facts'][bridge_name | replace('-', '_')]['ipv4']['address'] }} prefix-list pl-allowed-adv in"
- exit-address-family
- ip prefix-list pl-allowed-adv seq 5 permit 192.168.1.0/24
- ip prefix-list pl-allowed-adv seq 10 deny any
playbooks:
prepare: prepare.yml
converge: playbook.yml
verify: verify.yml
config_options:
defaults:
inject_facts_as_vars: false
scenario:
name: default