Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch glance store backend to swift #330

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
daf13c3
Switch glance store backend to swift
sulochan Jun 22, 2024
4d0b106
Add playbook to set uniform service types for all subnets of a networ…
awfabian-rs Jun 25, 2024
ebaf03e
Corrected image reference in Skyline deployment YAML. (#332)
sowm9802 Jun 26, 2024
f31a647
Update kubernetes.core ansible collection to 3.2.0 (#334)
cblument Jun 27, 2024
90547a7
feat: update the service-user docs (#333)
cloudnull Jun 27, 2024
beb5771
onfig and Secrets change
aedan Jun 27, 2024
db5e053
Had to correct some of the docs
aedan Jun 27, 2024
8605232
fix: update remaining docs post config updates (#335)
cloudnull Jun 28, 2024
729827e
fix: update last remaining docs (#336)
cloudnull Jun 28, 2024
4a14308
fix: topolvm example
cloudnull Jun 28, 2024
f5c56e8
fix: correct libvirt chart path
cloudnull Jun 28, 2024
04bf82f
fix: doc types on ovn setup
cloudnull Jun 28, 2024
a1260e6
feat: add /opt/genestack/manifests to bootstrap
cloudnull Jun 28, 2024
c78ce9e
fix: fix path for loki examples
cloudnull Jun 28, 2024
5ea6914
fix: Ensure that bootstrap is checking the right path
cloudnull Jun 28, 2024
216ad9d
Update jinja2 to 3.1.4
sulochan Jun 28, 2024
ad8d115
Bootstrap needs to be in opt/genestack
aedan Jun 28, 2024
92b6deb
feat: add pci-passthrough docs to tree (#328)
cloudnull Jun 22, 2024
022a24c
fix: shell formating in pci passthrough (#329)
cloudnull Jun 22, 2024
48920c7
fix: add more scheduler docs (#331)
cloudnull Jun 22, 2024
8f4fd3c
Add playbook to set uniform service types for all subnets of a networ…
awfabian-rs Jun 25, 2024
1b4f717
Corrected image reference in Skyline deployment YAML. (#332)
sowm9802 Jun 26, 2024
98c898e
Update kubernetes.core ansible collection to 3.2.0 (#334)
cblument Jun 27, 2024
f3df157
feat: update the service-user docs (#333)
cloudnull Jun 27, 2024
e2f0788
onfig and Secrets change
aedan Jun 27, 2024
ac18b6d
Had to correct some of the docs
aedan Jun 27, 2024
5b21504
fix: update remaining docs post config updates (#335)
cloudnull Jun 28, 2024
b3a74c1
fix: update last remaining docs (#336)
cloudnull Jun 28, 2024
9d07d5e
fix: topolvm example
cloudnull Jun 28, 2024
dad0ebc
fix: correct libvirt chart path
cloudnull Jun 28, 2024
a7675a7
fix: doc types on ovn setup
cloudnull Jun 28, 2024
291343b
feat: add /opt/genestack/manifests to bootstrap
cloudnull Jun 28, 2024
402c1bf
fix: fix path for loki examples
cloudnull Jun 28, 2024
41562c6
fix: Ensure that bootstrap is checking the right path
cloudnull Jun 28, 2024
3e97d28
Update jinja2 to 3.1.4
sulochan Jun 28, 2024
3ca3d67
Bootstrap needs to be in opt/genestack
aedan Jun 28, 2024
b02e19e
Merge branch 'sulochan-glance_store'
sulochan Jul 2, 2024
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
2 changes: 1 addition & 1 deletion ansible-collection-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ collections:
version: 2.1.0
type: git
- name: https://github.com/ansible-collections/kubernetes.core
version: 3.0.0
version: 3.2.0
type: git
130 changes: 130 additions & 0 deletions ansible/playbooks/network-service-types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# This playbook ensures all subnets of a given network have the specified
# service types, but has defaults to prevent nova instances from connecting
# directly to a network named PUBLICNET (so that they have to use floating IPs.)
#
# This works by setting service types network:floatingip,
# network:router_gateway, and network:distributed on all subnets of PUBLICNET
# (or the specified network.)
#
# Usage:
#
# ansible-playbook publicnet.yaml
#
# Optionally, -e network_name=<network_name>, and/or -e revert=true to remove
# the above-listed service types from the subnets of the network.
#
# It saves a copy of the subnets every time you run the playbook (unless you
# use something like -e save_copy=false)
#
# Dependencies:
#
# - You will need a working clouds.yaml. You can see how to generate one in:
# $GENESTACK/docs/openstack-clouds.md
# - a working `openstack` command
# - unfortunately, the Ansible collection openstack.cloud can only create
# and delete subnets, not modify them
# - Ansible collection openstack.cloud
# - however, you probably will not need to install this because you will
# typically find this already available in the venv the genestack creates
# for the 'root' user on the bastion by default
#
# See comments at the end of the playbook for an example of creating network(s)
# to test on, since you can use -e network_name and specify a test network.

- name: Set service types on subnets to prevent instances from connecting directly to PUBLICNET
hosts: localhost
gather_facts: false

vars:
cloud: default
network_name: PUBLICNET
revert: false
save_copy: true
service_types:
- 'network:floatingip'
- 'network:router_gateway'
- 'network:distributed'

tasks:

- name: List cloud networks
openstack.cloud.networks_info:
cloud: "{{ cloud }}"
name: "{{ network_name }}"
register: networks_result

- name: Fail unless matching one network.
fail:
msg: "Failed to match exactly one network. Try -e network_name=<network_uuid>"
when:
- networks_result.networks | length != 1

- name: Get subnet info
openstack.cloud.subnets_info:
cloud: "{{ cloud }}"
name: "{{ item }}"
register: subnets_result
loop: "{{ networks_result.networks[0].subnet_ids }}"

- name: Gather timestamp for subnet backup info
ansible.builtin.setup:
filter: "ansible_date_time"
when: save_copy | bool

# If we operated on the wrong subnet or it has some complicated set of
# service types, we have a full copy of what everything looked like before
# the playbook changed anything and can manually fix it.
- name: Save a copy of pre-change subnet info
# While saving a file should technically result in an Ansible 'changed',
# I only wanted to see 'changed' when Ansible changes service types on
# subnets.
#
# While the task never reports 'changed', it can still fail the playbook
# run, which seems like desirable behavior if we couldn't save a copy.
changed_when: false
copy:
content: >
{{ item.subnets[0] }}
dest: "{{ item.subnets[0].id }}_{{ ansible_date_time.year }}-{{ ansible_date_time.month }}-{{ ansible_date_time.day }}-{{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}-{{ ansible_date_time.second }}.json"
when: save_copy | bool
loop: "{{ subnets_result.results }}"

# Unfortunately, openstack.cloud.subnet cannot modify subnets. It can only
# create and delete them: https://docs.ansible.com/ansible/latest/collections/openstack/cloud/subnet_module.html#ansible-collections-openstack-cloud-subnet-module
# We have to use the CLI tool here (or the raw Neutron API; we just can't
# use the module.)
#
# If you try to set a service type that already exists on a subnet, Neutron
# will take a very long time and then give you a http 409, so in addition
# to generating one Ansible 'change' per service type and subnet changed
# (which seems good), we definitely have to set only the ones the subnet
# doesn't already have anyway, so we loop through the full cross-product
# of subnets and service types here.
- name: Set service types on subnets.
shell: >
openstack subnet set {{ item.0.subnets[0].id }} --service-type {{ item.1 }}
loop: "{{ subnets_result.results | product(service_types) | list }}"
when:
- item.1 not in item.0.subnets[0].service_types
- not revert | bool

# Unsetting only happens on 'revert'.
- name: Unset service types on subnets.
shell: >
openstack subnet unset {{ item.0.subnets[0].id }} --service-type {{ item.1 }}
loop: "{{ subnets_result.results | product(service_types) | list }}"
when:
- item.1 in item.0.subnets[0].service_types
- revert | bool

# Test network
#
# You can easily create a test network with a few subnets to see how this works,
# if desired:
#
# openstack network create testnet
# openstack subnet create testsubnet \
# --network testnet --subnet-range 192.168.8.0/24
# openstack subnet create testsubnet2 \
# --network testnet --subnet-range 192.168.9.0/24
# ansible-playbook -e network_name=testnet
Loading
Loading