Skip to content
Snippets Groups Projects
Commit d13afbc8 authored by Simone Spinelli's avatar Simone Spinelli
Browse files

Merge branch 'cleanup_and_refactoring' into 'main'

Cleanup and refactoring

See merge request !10
parents 9e6b339a d264ed8b
No related branches found
No related tags found
1 merge request!10Cleanup and refactoring
Pipeline #84116 passed
# here we should put everything related with installing Ansible:
- pip dependencies
- ansible dependencies
- config files
### TODO
galaxy_info: galaxy_info:
author: your name author: Simone Spinelli for GOAT team
description: your role description description: Migrates a GEANT core link
company: your company (optional) company: GEANT
# If the issue tracker for your role is not on github, uncomment the # If the issue tracker for your role is not on github, uncomment the
# next line and provide a value # next line and provide a value
...@@ -14,9 +14,9 @@ galaxy_info: ...@@ -14,9 +14,9 @@ galaxy_info:
# - GPL-3.0-only # - GPL-3.0-only
# - Apache-2.0 # - Apache-2.0
# - CC-BY-4.0 # - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc) license: MIT
min_ansible_version: 2.1 min_ansible_version: "2.15.3"
# If this a Container Enabled role, provide the minimum Ansible Container version. # If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version: # min_ansible_container_version:
......
- name: Old side is sideA - name: Old side is sideA
ansible.builtin.set_fact: ansible.builtin.set_fact:
new_ipv4_address: "{{side_a_ipv4_address}}" new_ipv4_address: "{{ side_a_ipv4_address }}"
new_ipv6_address: "{{side_a_ipv6_address}}" new_ipv6_address: "{{ side_a_ipv6_address }}"
when: when:
(replace_index|int) == 0 (replace_index|int) == 0
- name: Old side is sideB - name: Old side is sideB
ansible.builtin.set_fact: ansible.builtin.set_fact:
new_ipv4_address: "{{side_b_ipv4_address}}" new_ipv4_address: "{{ side_b_ipv4_address }}"
new_ipv6_address: "{{side_b_ipv6_address}}" new_ipv6_address: "{{ side_b_ipv6_address }}"
when: when:
(replace_index|int) == 1 (replace_index|int) == 1
...@@ -15,4 +15,3 @@ ...@@ -15,4 +15,3 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
ansible_connection: "{{ netconf_access[local_side.iptrunk_side_node.router_vendor].ansible_connection }}" ansible_connection: "{{ netconf_access[local_side.iptrunk_side_node.router_vendor].ansible_connection }}"
ansible_network_os: "{{ netconf_access[local_side.iptrunk_side_node.router_vendor].ansible_network_os }}" ansible_network_os: "{{ netconf_access[local_side.iptrunk_side_node.router_vendor].ansible_network_os }}"
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
ansible_host: localhost ansible_host: localhost
when: when:
local_side is defined and ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true and local_side is defined and ( local_side.iptrunk_side_node.router_access_via_ts | ansible.builtin.bool ) is true and
(verb == "delete" or verb == "deactivate") (verb == "delete" or verb == "deactivate")
- name: Set ansible_host to terminal server when router is offline - name: Set ansible_host to terminal server when router is offline
ansible.builtin.set_fact: ansible.builtin.set_fact:
......
--- ---
- name: Deploy "{{config_object}}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER] - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [CHECK ONLY][JUNIPER]
juniper_junos_config: juniper_junos_config:
load: 'replace' load: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
and dry_run | ansible.builtin.bool and and dry_run | ansible.builtin.bool and
new_node.router.router_vendor == "juniper" new_node.router.router_vendor == "juniper"
- name: Deploy "{{config_object}}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER] - name: Deploy "{{ config_object }}" on "{{ inventory_hostname }}" [AND COMMIT][JUNIPER]
juniper_junos_config: juniper_junos_config:
load: 'replace' load: 'replace'
src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf" src: "/var/tmp/ansible_run_{{ opid }}/{{ config_object }}.conf"
......
...@@ -25,15 +25,15 @@ ...@@ -25,15 +25,15 @@
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ wfo_trunk }}" msg: "{{ wfo_trunk }}"
#- name: Lets take a look at trunk # - name: Lets take a look at trunk
# ansible.builtin.debug: # ansible.builtin.debug:
# msg: "{{ trunks[0] }}" # msg: "{{ trunks[0] }}"
- name: The old node is - name: The old node is
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ old_node }}" msg: "{{ old_node }}"
- name: The new node is - name: The new node is
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ new_node.router.router_fqdn }}" msg: "{{ new_node.router.router_fqdn }}"
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
ansible_connection: "{{ netconf_access[new_node.router.router_vendor].ansible_connection }}" ansible_connection: "{{ netconf_access[new_node.router.router_vendor].ansible_connection }}"
ansible_network_os: "{{ netconf_access[new_node.router.router_vendor].ansible_network_os }}" ansible_network_os: "{{ netconf_access[new_node.router.router_vendor].ansible_network_os }}"
when: when:
( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true verb == "deploy" and ( new_node.router.router_access_via_ts | ansible.builtin.bool ) is true
when: verb == "deploy"
- name: Print the ID - name: Print the ID
ansible.builtin.debug: ansible.builtin.debug:
......
...@@ -21,7 +21,7 @@ side_a_ipv6_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv6_network | ansible.utils. ...@@ -21,7 +21,7 @@ side_a_ipv6_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv6_network | ansible.utils.
side_b_ipv4_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv4_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}/31" side_b_ipv4_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv4_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('1') | ansible.utils.ipaddr('address') }}/31"
side_b_ipv6_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv6_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('2') | ansible.utils.ipaddr('address') }}/126" side_b_ipv6_address: "{{ wfo_trunk.iptrunk.iptrunk_ipv6_network | ansible.utils.ipaddr('net') | ansible.utils.ipaddr('2') | ansible.utils.ipaddr('address') }}/126"
old_node: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_node.router_fqdn }}" old_node: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_fqdn }}"
new_side: new_side:
id: "{{ wfo_trunk.iptrunk.geant_s_sid }}" id: "{{ wfo_trunk.iptrunk.geant_s_sid }}"
...@@ -30,10 +30,10 @@ new_side: ...@@ -30,10 +30,10 @@ new_side:
is_leased_line: false ## Fix it to use iptrunk_type is_leased_line: false ## Fix it to use iptrunk_type
isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}" isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}"
minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}" minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}"
name: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_node.router_fqdn }}" name: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_fqdn }}"
router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_node.router_access_via_ts }}" router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_access_via_ts }}"
loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_node.router_lo_ipv4_address }}" loopback: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_node.router_lo_ipv4_address }}"
ae_name: "{{ new_lag_interface }}" ae_name: "{{ new_lag_interface }}"
members: "{{ new_lag_member_interfaces }}" members: "{{ new_lag_member_interfaces }}"
members_descriptions: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_ae_members_description }}" members_descriptions: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_ae_members_description }}"
port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index|int].iptrunk_side_ae_geant_a_sid }}" port_sid: "{{ wfo_trunk.iptrunk.iptrunk_sides[replace_index | int].iptrunk_side_ae_geant_a_sid }}"
...@@ -67,4 +67,4 @@ ...@@ -67,4 +67,4 @@
when: > when: >
verb == "terminate" and verb == "terminate" and
not ( dry_run | ansible.builtin.bool ) and not ( dry_run | ansible.builtin.bool ) and
local_side.iptrunk_side_node.router_vendor == "nokia" local_side.iptrunk_side_node.router_vendor == "nokia"
\ No newline at end of file
...@@ -36,7 +36,7 @@ trunks: ...@@ -36,7 +36,7 @@ trunks:
is_leased_line: false ## Fix it to use iptrunk_type is_leased_line: false ## Fix it to use iptrunk_type
isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}" isis_metric: "{{ wfo_trunk.iptrunk.iptrunk_isis_metric }}"
minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}" minimum_links: "{{ wfo_trunk.iptrunk.iptrunk_minimum_links }}"
trunk_type: "{{wfo_trunk.iptrunk.iptrunk_type}}" trunk_type: "{{ wfo_trunk.iptrunk.iptrunk_type }}"
nodeA: nodeA:
name: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn }}" name: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_fqdn }}"
router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_access_via_ts }}" router_access_via_ts: "{{ wfo_trunk.iptrunk.iptrunk_sides[0].iptrunk_side_node.router_access_via_ts }}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment