Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Enhanced ort integration test for reload states
- Added a new field to Delivery Services - `tlsVersions` - that explicitly lists the TLS versions that may be used to retrieve their content from Cache Servers.
- Updated T3C changes in Ansible playbooks
- Updated all endpoints in infrastructure code to use API version 2.0

### Fixed
- [#5690](https://github.com/apache/trafficcontrol/issues/5690) - Fixed github action for added/modified db migration file.
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/ansible/influxdb_relay.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

- name: Get TO Cookie
uri:
url: "{{ to_url }}/api/1.3/user/login"
url: "{{ to_url }}/api/{{ to_api_version }}/user/login"
method: POST
body: '{ "u":"{{ tm_traffic_ops_username }}", "p":"{{ tmonitor_passwd }}" }'
headers:
Expand All @@ -46,7 +46,7 @@

- name: Get All Servers
uri:
url: "{{ to_url }}/api/1.3/servers"
url: "{{ to_url }}/api/{{ to_api_version }}/servers"
method: GET
validate_certs: no
follow_redirects: all
Expand Down
14 changes: 4 additions & 10 deletions infrastructure/ansible/roles/dataset_loader/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 1.3
dl_to_api_version: 2.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"
Expand Down Expand Up @@ -72,13 +72,7 @@ dl_ds_default_cdns:

# TO Types
dl_ds_merged_types: "{{ dl_ds_default_types }}"
dl_ds_default_types:
- name: TR_LOC
description: Traffic Router Logical Location
useInTable: cachegroup
- name: INFRA_LOC
description: Generic Infrastructure Logical Location
useInTable: cachegroup
dl_ds_default_types: []

# The mapping of components from inventory hostvars to TO types
dl_ds_merged_type_ansible_component_map: "{{ dl_ds_default_type_ansible_component_map }}"
Expand Down Expand Up @@ -125,7 +119,7 @@ dl_ds_default_cachegroups:
parentCachegroup:
secondaryParentCachegroup:
localizationMethods:
type: INFRA_LOC
type: TC_LOC
fallbackToClosest:
- name: multi-site-org-east
shortName: msoe
Expand Down Expand Up @@ -738,7 +732,7 @@ dl_ds_default_profile_cdntemplates:
secure: 0
- name: federationmapping.polling.url
configFile: CRConfig.json
value: https://${toHostname}/api/1.4/federations/all.json
value: https://${toHostname}/api/{{ dl_to_api_version }}/federations/all
secure: 0
- name: geolocation.polling.interval
configFile: CRConfig.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

1. Install `jq`
2. Install `ruby`
3. Curl to get the response of https://{{ TO_BASE_URL }}/api/1.3/profiles/name/{{ TARGET_PROFILE }}/parameters and save that to a file named `profile.parameters.json`
3. Curl to get the response of https://{{ TO_BASE_URL }}/api/{{ dl_to_api_version }}/profiles/name/{{ TARGET_PROFILE }}/parameters and save that to a file named `profile.parameters.json`
4. `jq -r '[.[] | sort_by(.configFile,.name,.value)[] | {name: .name,configFile: .configFile,value: .value,secure: (if .secure then 1 else 0 end)}]' profile.parameters.json > profile.parameters.filtered.json`
5. `ruby -ryaml -rjson -e 'puts YAML.dump(JSON.parse(STDIN.read))' < profile.parameters.filtered.json > profile.parameters.yml`
6. Transplant into appropriate ansible var file
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
name: "{{ dl_ds_merged_cdns[cdnDelegationPrimary].name | default(cdnDelegationPrimary) }}"
domainName: "{{ cdnDelegationPrimary }}.{{ (groups['traffic_ops'] | first).split('.')[1:] | join('.') | lower }}"
dnssecEnabled: "{{ dl_ds_merged_cdns[cdnDelegationPrimary].dnssecEnabled | default(false) | lower }}"
cdn_query: "response[?starts_with(domainName,`{{ cdnDelegationPrimary }}`) == `true`].id | [0]"
cdn_query: "response[?starts_with(domainName,`{{ cdnDelegationPrimary | lower }}`) == `true`].id | [0]"
error_query: "alerts[?level=='error'].text[?!contains(@,'already exists')]"
register: update_cdn_out
failed_when: (update_cdn_out.status == 400 and update_cdn_out.json | to_json | from_json | json_query(error_query) | length != 0) or (update_cdn_out.status > 400 and update_cdn_out.status < 600)
Expand Down Expand Up @@ -172,7 +172,7 @@
with_items: "{{ dl_ds_merged_cachegroups | json_query(type_filter) }}"
vars:
type_query: "response[?name == '{{ item.type | default('EDGE_LOC') }}'].id | [0]"
type_filter: "[?type == 'INFRA_LOC']"
type_filter: "[?type == 'TC_LOC']"
error_query: "alerts[?level=='error'].text[?!contains(@,'already exists')]"
register: create_cachegroup_out
failed_when: (create_cachegroup_out.status == 400 and create_cachegroup_out.json | to_json | from_json | json_query(error_query) | length != 0) or (create_cachegroup_out.status > 400 and create_cachegroup_out.status < 600 and create_cachegroup_out.status != 500)
Expand Down Expand Up @@ -703,9 +703,11 @@
updPending: True
interfaceName: "{{ hostvars[item].ansible_default_ipv4.interface | default('eth0') }}"
ipAddress: "{{ hostvars[item].ansible_default_ipv4.address | default(hostvars[item].ansible_host) }}"
ipIsService: true
ipNetmask: "{{ hostvars[item].ansible_default_ipv4.netmask | default('255.255.255.0') }}"
ipGateway: "{{ hostvars[item].ansible_default_ipv4.gateway | default('127.0.0.0') }}"
ip6Address: "{{ hostvars[item].ansible_default_ipv6.address | default(omit) }}"
ip6IsService: true
ip6Gateway: "{{ hostvars[item].ansible_default_ipv6.gateway | default(omit) }}"
interfaceMtu: "{{ hostvars[item].ansible_default_ipv4.mtu | default('9000') }}"
tcpPort: "{{ (dl_ds_merged_servers[item] | default(dl_ds_merged_servers['server.kabletown.invalid'])).tcpPort | default(omit) }}"
Expand Down Expand Up @@ -772,10 +774,12 @@
cdnId: "{{ cdn_id }}"
updPending: True
interfaceName: "eth0"
ipIsService: true
ipAddress: "{{ hostvars[item].ansible_host }}"
ipNetmask: "255.255.255.0"
ipGateway: "127.0.0.0"
ip6Address: "{{ omit }}"
ip6IsService: true
ip6Gateway: "{{ omit }}"
interfaceMtu: "9000"
tcpPort: "{{ (dl_ds_merged_servers[item] | default(dl_ds_merged_servers['server.kabletown.invalid'])).tcpPort | default(omit) }}"
Expand Down Expand Up @@ -966,7 +970,7 @@

- name: Snapshot all CDNs
uri:
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/snapshot/{{ item.name }}"
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/snapshot?cdn={{ item.name }}"
method: PUT
with_items: "{{ get_all_cdns.json.response[1:] }}"
register: snapshot_out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

- name: you have to call get once for Riak/TO to work right before you can add certs
uri:
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/cdns/name/{{ Target_cdn_name }}/sslkeys.json"
url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/cdns/name/{{ Target_cdn_name }}/sslkeys"
method: GET

- name: Assign Servers to Delivery Services - Grove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
cdnId: "{{ item.cdnId }}"
updPending: "{{ item.updPending }}"
interfaceName: "{{ item.interfaceName }}"
ipIsService: "{{ item.ipIsService}}"
ipAddress: "{{ item.ipAddress }}"
ipNetmask: "{{ item.ipNetmask }}"
ipGateway: "{{ item.ipGateway }}"
ip6Address: "{{ item.ip6Address }}"
ip6IsService: "{{ item.ip6IsService }}"
ip6Gateway: "{{ item.ip6Gateway }}"
interfaceMtu: "{{ item.interfaceMtu }}"
tcpPort: "{{ item.tcpPort }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{% 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 }}",
Expand Down Expand Up @@ -68,6 +69,7 @@
"cachegroupId": {{ cachegroupId }},
"interfaceName": "{{ interfaceName }}",
"ipAddress": "{{ ipAddress }}",
"ipIsService": {{ ipIsService }},
"ipNetmask": "{{ ipNetmask }}",
"ipGateway": "{{ ipGateway }}",
"interfaceMtu": {{ interfaceMtu }},
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/ansible/roles/to_api/tasks/login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
- name: Get TO Cookie
uri:
url: "{{ to_api_base_url }}/api/1.2/user/login"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/user/login"
method: POST
body_format: json
body: '{ "u":"{{ to_api_login_name }}", "p":"{{ to_api_login_password }}" }'
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/ansible/roles/to_api/tasks/queue_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: Get cdn details
uri:
url: "{{ to_api_base_url }}/api/1.2/cdns"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/cdns"
method: GET
headers:
Cookie: "{{ hostvars.localhost.login.set_cookie }}"
Expand All @@ -29,7 +29,7 @@

- name: "{{ 'Queue updates for ' + to_api_target_cdn }}"
uri:
url: "{{ to_api_base_url }}/api/1.2/cdns/{{ cdns_details.json.response | selectattr('name','equalto',to_api_target_cdn) | map(attribute='id') | list | first }}/queue_update"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/cdns/{{ cdns_details.json.response | selectattr('name','equalto',to_api_target_cdn) | map(attribute='id') | list | first }}/queue_update"
method: POST
body_format: json
headers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: Get server details for {{to_api_target_host}}
uri:
url: "{{ to_api_base_url }}/api/1.2/servers/hostname/{{ to_api_target_host.split('.')[0] }}/details"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/servers/details?hostName={{ to_api_target_host.split('.')[0] }}"
method: GET
headers:
Cookie: "{{ hostvars.localhost.login.set_cookie }}"
Expand All @@ -40,7 +40,7 @@

- name: "{{ 'Set state of '+to_api_target_host+' to ' + to_api_desired_state }}"
uri:
url: "{{ to_api_base_url }}/api/1.2/servers/{{ server_details.json.response.id }}/status"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/servers/{{ server_details.json.response.id }}/status"
method: PUT
body_format: json
headers:
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/ansible/roles/to_api/tasks/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
- name: "Retrieves PENDING snapshot ({{ to_api_target_cdn }})"
delegate_to: localhost
uri:
url: "{{ to_api_base_url }}/api/1.2/cdns/{{ to_api_target_cdn }}/snapshot/new"
url: "{{ to_api_base_url }}/api/{{ to_api_version }}/cdns/{{ to_api_target_cdn }}/snapshot/new"
method: GET
follow_redirects: all
return_content: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ tp_default_properties_template:
cacheChecks:
_comments: These are configurable properties for the cache checks view. The data
for the cache checks view is derived from TO extensions. The extensions array
should include an entry for each of your extensions or you can check GET api/1.3/servers/checks
should include an entry for each of your extensions or you can check GET api/{{ to_api_version }}/servers/checks
to see which checks you have configured.
show: true
updatePending:
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/ansible/sample.lab/ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "1.3"
to_api_version: "2.0"

todb_username: traffic_ops
todb_db_name: traffic_ops
Expand Down