File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
environments/skeleton/{{cookiecutter.environment}}/terraform Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ module "compute" {
19
19
volume_backed_instances = lookup (each. value , " volume_backed_instances" , var. volume_backed_instances )
20
20
root_volume_size = lookup (each. value , " root_volume_size" , var. root_volume_size )
21
21
extra_volumes = lookup (each. value , " extra_volumes" , {})
22
+ gateway_nmcli_connection = lookup (each. value , " gateway_nmcli_connection" , " " )
23
+ gateway_ip = lookup (each. value , " gateway_ip" , " " )
22
24
23
25
compute_init_enable = lookup (each. value , " compute_init_enable" , [])
24
26
Original file line number Diff line number Diff line change @@ -86,6 +86,18 @@ resource "openstack_compute_instance_v2" "compute" {
86
86
user_data = <<- EOF
87
87
#cloud-config
88
88
fqdn: ${ var . cluster_name } -${ each . key } .${ var . cluster_name } .${ var . cluster_domain_suffix }
89
+
90
+ runcmd:
91
+ %{ if var . gateway_nmcli_connection == " dummy0" ~ }
92
+ - nmcli connection add type dummy ifname dummy0 con-name dummy0
93
+ - nmcli connection modify dummy0 ipv4.address ${ openstack_networking_port_v2 . compute [each . key ]. all_fixed_ips [0 ]} ipv4.gateway ${ openstack_networking_port_v2 . compute [each . key ]. all_fixed_ips [0 ]} ipv4.route-metric 1000 ipv4.method manual
94
+ %{ endif ~ }
95
+ %{ if (var. gateway_nmcli_connection != " " ) && (var. gateway_nmcli_connection != " dummy0" ) ~ }
96
+ - nmcli connection modify '${ var . gateway_nmcli_connection } ' ipv4.address ${ openstack_networking_port_v2 . compute [each . key ]. all_fixed_ips [0 ]} ipv4.gateway ${ var . gateway_ip }
97
+ %{ endif ~ }
98
+ %{ if var . gateway_nmcli_connection != " " }
99
+ - nmcli connection up '${ var . gateway_nmcli_connection } '
100
+ %{ endif ~ }
89
101
EOF
90
102
91
103
}
Original file line number Diff line number Diff line change @@ -93,4 +93,16 @@ variable "compute_init_enable" {
93
93
type = list (string )
94
94
description = " Groups to activate for ansible-init compute rebuilds"
95
95
default = []
96
- }
96
+ }
97
+
98
+ variable "gateway_nmcli_connection" {
99
+ description = " Name of nmcli connection for default gateway, '' for none or 'dummy0' to create a dummy interface"
100
+ type = string
101
+ default = " "
102
+ }
103
+
104
+ variable "gateway_ip" {
105
+ description = " IP of default gateway. Ignored when gateway_nmcli_connection == 'dummy0'"
106
+ type = string
107
+ default = " "
108
+ }
Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ variable "compute" {
60
60
Values are a mapping with:
61
61
size: Size of volume in GB
62
62
**NB**: The order in /dev is not guaranteed to match the mapping
63
+ gateway_nmcli_connection: Name of nmcli connection to set a default
64
+ route on via cloud-init, e.g. "System eth0"
65
+ or "Bond bond0". Use "dummy0" to create
66
+ a dummy interface with dummy route.
67
+ gateway_ip: IP of default gateway. Ignored when gateway_nmcli_connection == "dummy0".
63
68
EOF
64
69
}
65
70
You can’t perform that action at this time.
0 commit comments