Skip to content

Commit

Permalink
OpenStack: Support multiple subnets
Browse files Browse the repository at this point in the history
- Flag primary cluster subnet.
- Attaches bootstrap floating ip to correct subnet.
  • Loading branch information
Adolfo Duarte committed Sep 17, 2020
1 parent c4e0dce commit d18c5f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions upi/openstack/bootstrap.yaml
Expand Up @@ -38,5 +38,6 @@
- name: 'Create the bootstrap floating IP'
os_floating_ip:
state: present
nat_destination: "{{ os_network }}"
network: "{{ os_external_network }}"
server: "{{ os_bootstrap_server_name }}"
1 change: 1 addition & 0 deletions upi/openstack/common.yaml
Expand Up @@ -8,6 +8,7 @@
- name: 'Compute resource names'
set_fact:
cluster_id_tag: "openshiftClusterID={{ infraID }}"
primary_cluster_network_tag: "{{ infraID }}-primaryClusterNetwork"
os_infra_id: "{{ infraID }}"
os_network: "{{ infraID }}-network"
os_subnet: "{{ infraID }}-nodes"
Expand Down
10 changes: 5 additions & 5 deletions upi/openstack/network.yaml
Expand Up @@ -11,23 +11,23 @@
gather_facts: no

tasks:
- name: 'Create the cluster network'
- name: 'Create the primary cluster network'
os_network:
name: "{{ os_network }}"

- name: 'Set the cluster network tag'
- name: 'Set tags on the primary cluster network'
command:
cmd: "openstack network set --tag {{ cluster_id_tag }} {{ os_network }}"
cmd: "openstack network set --tag {{ primary_cluster_network_tag }} --tag {{ cluster_id_tag }} {{ cluster_network.network.id }}"

- name: 'Create a subnet'
- name: 'Create the primary cluster subnet'
os_subnet:
name: "{{ os_subnet }}"
network_name: "{{ os_network }}"
cidr: "{{ os_subnet_range }}"
allocation_pool_start: "{{ os_subnet_range | next_nth_usable(10) }}"
allocation_pool_end: "{{ os_subnet_range | ipaddr('last_usable') }}"

- name: 'Set the cluster subnet tag'
- name: 'Set tags on primary cluster subnet'
command:
cmd: "openstack subnet set --tag {{ cluster_id_tag }} {{ os_subnet }}"

Expand Down

0 comments on commit d18c5f9

Please sign in to comment.