-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for NAT Gateway for egress (#8)
First version will use az commands as this is not exposed in azure collection
- Loading branch information
1 parent
f8a8753
commit 68e348b
Showing
5 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,24 @@ | ||
--- | ||
|
||
# Based on: https://docs.microsoft.com/en-us/azure/virtual-network/nat-gateway/quickstart-create-nat-gateway-cli | ||
## Create PIP for NAT Gateway | ||
# TODO: check the sku standard that could be deprecated in the future | ||
- name: Create a public ip address for NAT Gateway | ||
azure_rm_publicipaddress: | ||
resource_group: "{{ azure_resource_group }}" | ||
name: "{{ azure_natgateway_pip_name }}" | ||
allocation_method: static | ||
sku: standard | ||
register: natgateway_pip | ||
|
||
## Create Azure NAT Gateway | ||
# TODO: replace with Ansible module when available | ||
- name: Create Azure NAT Gateway | ||
shell: "az network nat gateway create --resource-group {{ azure_resource_group }} --name {{ azure_natgateway_name }} --public-ip-addresses {{ azure_natgateway_pip_name }}" | ||
|
||
## Associate Azure NAT Gateway with subnets | ||
# TODO: replace with Ansible module when available | ||
- name: Associate NAT Gateway to the compute subnet | ||
shell: "az network vnet subnet update --resource-group {{ azure_resource_group }} --vnet-name {{ azure_vnet_name }} --name \"compute\" --nat-gateway {{ azure_natgateway_name }}" | ||
- name: Associate NAT Gateway to the control-plane subnet | ||
shell: "az network vnet subnet update --resource-group {{ azure_resource_group }} --vnet-name {{ azure_vnet_name }} --name \"control-plane\" --nat-gateway {{ azure_natgateway_name }}" |
This file contains 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 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,5 @@ | ||
# Azure NAT gateway vars (only working if egress=natgateway is set) | ||
azure_natgateway_name: az-ocp4-natgateway | ||
azure_natgateway_pip_name: az-ocp4-pip-natgateway | ||
|
||
azure_outboundtype: "UserDefinedRouting" |