From fd106f6d1046dfb4b044bcc2a6dc80963a1c36e9 Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Tue, 12 Jul 2022 21:39:23 -0600 Subject: [PATCH 1/3] `monitorInterface`: Whether Traffic Monitor collects stats for this interface --- .../ansible/roles/dataset_loader/tasks/dataset_loader.yml | 2 ++ .../ansible/roles/dataset_loader/tasks/update_mso_servers.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml b/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml index 0a5f88f640..5117329ce6 100644 --- a/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml +++ b/infrastructure/ansible/roles/dataset_loader/tasks/dataset_loader.yml @@ -739,6 +739,7 @@ ip6Address: "{{ hostvars[item].not_autoconf_default_ipv6_address | default(hostvars[item].ansible_default_ipv6.address) | default(omit) }}" ip6IsService: true ip6Gateway: "{{ hostvars[item].ansible_default_ipv6.gateway | default(omit) }}" + monitorInterface: true interfaceMtu: "{{ hostvars[item].ansible_default_ipv4.mtu | default('9000') }}" default_inventory_hostname: "{{ hostvars[item].component | default('server') }}.kabletown.invalid" merged_server_attrs: "{{ dl_ds_merged_servers['server.kabletown.invalid'] | combine(dl_ds_merged_servers[default_inventory_hostname] | default({}) ) | combine(dl_ds_merged_servers[item] | default({}) ) }}" @@ -816,6 +817,7 @@ ip6Address: "{{ omit }}" ip6IsService: true ip6Gateway: "{{ omit }}" + monitorInterface: true interfaceMtu: "9000" default_inventory_hostname: "{{ hostvars[item].component | default('server') }}.kabletown.invalid" merged_server_attrs: "{{ dl_ds_merged_servers['server.kabletown.invalid'] | combine(dl_ds_merged_servers[default_inventory_hostname] | default({}) ) | combine(dl_ds_merged_servers[item] | default({}) ) }}" diff --git a/infrastructure/ansible/roles/dataset_loader/tasks/update_mso_servers.yml b/infrastructure/ansible/roles/dataset_loader/tasks/update_mso_servers.yml index a6919d723d..3b53da482c 100644 --- a/infrastructure/ansible/roles/dataset_loader/tasks/update_mso_servers.yml +++ b/infrastructure/ansible/roles/dataset_loader/tasks/update_mso_servers.yml @@ -51,6 +51,7 @@ ip6Address: "{{ item.ip6Address }}" ip6IsService: "{{ item.ip6IsService }}" ip6Gateway: "{{ item.ip6Gateway }}" + monitorInterface: "{{ item.monitorInterface }}" interfaceMtu: "{{ item.interfaceMtu }}" tcpPort: "{{ item.tcpPort }}" httpsPort: "{{ item.httpsPort }}" From c61f3cf7635ac3882510305b15f5fd2c77908b1d Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Mon, 11 Jul 2022 23:39:04 -0600 Subject: [PATCH 2/3] Template server interfaces as an array --- .../roles/dataset_loader/templates/server.j2 | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/infrastructure/ansible/roles/dataset_loader/templates/server.j2 b/infrastructure/ansible/roles/dataset_loader/templates/server.j2 index 00abbcb14f..637433a292 100644 --- a/infrastructure/ansible/roles/dataset_loader/templates/server.j2 +++ b/infrastructure/ansible/roles/dataset_loader/templates/server.j2 @@ -24,13 +24,6 @@ {% if xmppPasswd is defined and xmppPasswd is not none and xmppPasswd != omit and xmppPasswd %} "xmppPasswd": "{{ xmppPasswd }}", {% endif %} -{% if ip6Address is defined and ip6Address is not none and ip6Address != omit and ip6Address %} - "ip6Address": "{{ ip6Address }}", - "ip6IsService": {{ ip6IsService }}, -{% endif %} -{% if ip6Gateway is defined and ip6Gateway is not none and ip6Gateway != omit and ip6Gateway %} - "ip6Gateway": "{{ ip6Gateway }}", -{% endif %} {% if rack is defined and rack is not none and rack != omit and rack %} "rack": "{{ rack }}", {% endif %} @@ -67,12 +60,31 @@ "hostName": "{{ hostName }}", "domainName": "{{ domainName }}", "cachegroupId": {{ cachegroupId }}, - "interfaceName": "{{ interfaceName }}", - "ipAddress": "{{ ipAddress }}", - "ipIsService": {{ ipIsService }}, - "ipNetmask": "{{ ipNetmask }}", - "ipGateway": "{{ ipGateway }}", - "interfaceMtu": {{ interfaceMtu }}, + "interfaces": [ + { + "ipAddresses": [ + {% if ipAddress is defined and ipAddress is not none and ipAddress != omit and ipAddress %} + { + "address": "{{ (ipAddress + '/' + ipNetmask) | ipaddr }}", + "gateway": "{{ ipGateway }}", + "serviceAddress": {{ ipIsService }} + }{% if ip6Address is defined and ip6Address is not none and ip6Address != omit and ip6Address %},{% endif %} + {% endif %} + {% if ip6Address is defined and ip6Address is not none and ip6Address != omit and ip6Address %} + { + "address": "{{ ip6Address }}", + {% if ip6Gateway is defined and ip6Gateway is not none and ip6Gateway != omit and ip6Gateway %} + "gateway": "{{ ip6Gateway }}", + {% endif %} + "serviceAddress": {{ ip6IsService }} + } + {% endif %} + ], + "monitor": {{ monitorInterface }}, + "mtu": {{ interfaceMtu }}, + "name": "{{ interfaceName }}" + } + ], "physLocationId": {{ physLocationId }}, "typeId": {{ typeId }}, "profileId": {{ profileId }}, From d311ca00b4c7708a3141286368b669dabf84b0ef Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Tue, 12 Jul 2022 20:59:35 -0600 Subject: [PATCH 3/3] Use Traffic Ops API Version 3 for the Ansible Roles --- CHANGELOG.md | 1 + infrastructure/ansible/roles/dataset_loader/defaults/main.yml | 2 +- infrastructure/ansible/sample.lab/ansible/vars.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c76258c0a..a4f2421521 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - `TRAFFIC_ROUTER`-type Profiles no longer need to have names that match any kind of pattern (e.g. `CCR_.*`) - [#4351](https://github.com/apache/trafficcontrol/issues/4351) Updated message to an informative one when deleting a delivery service. - Updated Grove to use the TO API v3 client library +- Updated Ansible Roles to use Traffic Ops API v3 ## [6.1.0] - 2022-01-18 ### Added diff --git a/infrastructure/ansible/roles/dataset_loader/defaults/main.yml b/infrastructure/ansible/roles/dataset_loader/defaults/main.yml index 987b634bab..ccb83c2a94 100644 --- a/infrastructure/ansible/roles/dataset_loader/defaults/main.yml +++ b/infrastructure/ansible/roles/dataset_loader/defaults/main.yml @@ -24,7 +24,7 @@ dl_sf_url: https://czf.kabletown.invalid dl_to_user: dl_to_user_password: # TrafficOps API version to use -dl_to_api_version: 2.0 +dl_to_api_version: 3.0 dl_target_api_url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}" # URL for the CZF file dl_shallow_czf_url: "{{ dl_sf_url }}/czf.json" diff --git a/infrastructure/ansible/sample.lab/ansible/vars.yml b/infrastructure/ansible/sample.lab/ansible/vars.yml index 30036ada32..68131b302f 100644 --- a/infrastructure/ansible/sample.lab/ansible/vars.yml +++ b/infrastructure/ansible/sample.lab/ansible/vars.yml @@ -25,7 +25,7 @@ grovetccfg_version: "{{ grove_version }}" influxdb_relay_version: adaa2ea-1 feigner_version: 1.0.0_dev_11248-1 ats_version: 7.1.4-2.el7 -to_api_version: "2.0" +to_api_version: "3.0" todb_username: traffic_ops todb_db_name: traffic_ops