This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 355
Add a Federation to the Ansible Dataset Loader #5685
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1d7730e
Create a federation
zrhoffman 53cbe7b
Assign the current User to the Federation
zrhoffman 5b0b5a4
Assign the simple DNS Delivery Service to the Federation
zrhoffman 88f7f88
Create Federation Resolvers
zrhoffman 0abcdc6
Assign Federation Resolvers to the Federation
zrhoffman beba47e
Use dedicated Delivery Service simple-dns-for-federation for the Fede…
zrhoffman be59b7c
Assign dedicated User federationuser to the Federation
zrhoffman eae3aa9
Support an arbitrary number of federations
zrhoffman b12d28d
Do not run CDN-in-a-Box CI workflow if only tests or Ansible roles were
zrhoffman a3db0ee
Add missing }
zrhoffman a3318f9
Remove password attribute
zrhoffman 2d785e8
Specify in Task names which Federation we are creating/assigning to
zrhoffman 9eb9e77
Get Resolver type from array key
zrhoffman 75b55ee
Nested loop over cdnDelegationList and dl_ds_merged_federations, not …
zrhoffman 4eca8c3
Remove Federation User
zrhoffman 1e4c074
Glob ignored paths
zrhoffman 0ed0bd8
Revert "Remove Federation User"
zrhoffman 4e59792
Give the Federations User the operations role
zrhoffman df86996
Get Federation User username from `dl_ds_default_federation_user`
zrhoffman e7e9484
Define federation_user
zrhoffman 827614a
Remove federation_user var
zrhoffman 7979799
Break `with_nested` Create Federations task into 2 separate tasks
zrhoffman da59608
Define federation_user for the task
zrhoffman 7389ebf
Access response.id as a JSON query, not as an attribute
zrhoffman d59b637
Use /api/1.4/federations/all.json for federationmapping.polling.url
zrhoffman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
infrastructure/ansible/roles/dataset_loader/tasks/federation_loader.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| - name: "Create Federation {{ federation.mappings.cname }}" | ||
| vars: | ||
| cdn_name_query: 'response[?xmlId == `{{ federation.deliveryService | to_json }}`].cdnName | [0]' | ||
| cdn_name: '{{ get_all_ds.json | json_query(cdn_name_query) }}' | ||
| uri: | ||
| url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/cdns/{{ cdn_name }}/federations" | ||
| method: POST | ||
| body: '{"cname":{{ federation.mappings.cname | to_json }},"ttl":{{ federation.mappings.ttl }}}' | ||
zrhoffman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
zrhoffman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| register: create_federation_out | ||
|
|
||
| - name: "Get ID of Federation {{ federation.mappings.cname }}" | ||
| set_fact: | ||
| federation_id: "{{ create_federation_out.json.response.id }}" | ||
| federation_cname: "{{ create_federation_out.json.response.cname }}" | ||
|
|
||
| - name: "Assign User to Federation {{ federation_cname }}" | ||
| vars: | ||
| federation_user: "{{ federation.user }}" | ||
| federation_user_query: "response[?username == `{{ federation_user }}`].id | [0]" | ||
| federation_user_id: "{{ get_all_users.json | json_query(federation_user_query) }}" | ||
| uri: | ||
| url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/federations/{{ federation_id }}/users" | ||
| method: POST | ||
| body: '{"userIds":[{{ federation_user_id }}],"replace":false}' | ||
|
|
||
| - name: "Assign Delivery Service to Federation {{ federation_cname }}" | ||
| vars: | ||
| federation_ds_id_query: 'response[?xmlId == `{{ federation.deliveryService | to_json }}`].id | [0]' | ||
zrhoffman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| federation_ds_id: "{{ get_all_ds.json | json_query(federation_ds_id_query) }}" | ||
| uri: | ||
| url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/federations/{{ federation_id }}/deliveryservices" | ||
jhg03a marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| method: POST | ||
| body: '{"dsIds":[{{ federation_ds_id }}],"replace":false}' | ||
|
|
||
| - name: "Create Federation Resolvers of type {{ resolver_type_name }}" | ||
| with_dict: "{{ resolvers }}" | ||
| loop_control: | ||
| loop_var: resolver | ||
| vars: | ||
| resolvers: | | ||
| { | ||
| {%- for resolver_type, resolvers in federation.mappings.resolvers.items() -%} | ||
| {%- set resolver_type_loop = loop -%} | ||
| {%- for resolver in resolvers -%} | ||
| {{ resolver | to_json }}: {{ resolver_type | upper | to_json }} | ||
| {%- if not (loop.last and resolver_type_loop.last) -%},{%- endif -%} | ||
| {%- endfor -%} | ||
| {%- endfor -%} | ||
| } | ||
| resolver_type_name: "{{ resolver.value }}" | ||
| type_query: "[?name == `{{ resolver_type_name }}`].id | [0]" | ||
| resolver_type_id: "{{ get_all_types.json.response | json_query(type_query) }}" | ||
| ip_address: "{{ resolver.key }}" | ||
| uri: | ||
| url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/federation_resolvers" | ||
| method: POST | ||
| body: '{"ipAddress":{{ ip_address | to_json }},"typeId":{{ resolver_type_id }}}' | ||
| register: federation_resolver_out | ||
|
|
||
| - name: "Assign Federation Resolvers of type {{ resolver_type_name }} to Federation {{ federation_cname }}" | ||
| with_items: "{{ federation_resolver_out.results }}" | ||
| loop_control: | ||
| loop_var: resolver_post_response | ||
| uri: | ||
| url: "{{ dl_to_url }}/api/{{ dl_to_api_version }}/federations/{{ federation_id }}/federation_resolvers" | ||
| method: POST | ||
| body: '{"fedResolverIds":[{{ resolver_post_response.json | json_query("response.id") }}],"replace":false}' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.