Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#637 from fmount/tripleo_pr…
Browse files Browse the repository at this point in the history
…ereq

Add TripleO requirements playbook
  • Loading branch information
jistr authored Dec 3, 2024
2 parents 6e73805 + c449962 commit d909b76
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ test-with-ceph: ## Launch test suite with ceph
mkdir -p tests/logs
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_SECRETS) $(TEST_ARGS) tests/playbooks/test_with_ceph.yaml 2>&1 | tee $(TEST_OUTFILE)

test-tripleo-requirements: TEST_OUTFILE := tests/logs/test_tripleo_requirements_out_$(shell date +%FT%T%Z).log
test-tripleo-requirements: ## Launch test suite related to the ceph migration
mkdir -p tests/logs
ANSIBLE_CONFIG=$(TEST_CONFIG) ansible-playbook -v -i $(TEST_INVENTORY) -e @$(TEST_VARS) -e @$(TEST_CEPH_OVERRIDES) -e @$(TEST_SECRETS) $(TEST_ARGS) tests/playbooks/test_tripleo_adoption_requirements.yaml 2>&1 | tee $(TEST_OUTFILE)

test-ceph-migration: TEST_OUTFILE := tests/logs/test_ceph_migration_out_$(shell date +%FT%T%Z).log
test-ceph-migration: ## Launch test suite related to the ceph migration
mkdir -p tests/logs
Expand Down
47 changes: 47 additions & 0 deletions tests/playbooks/test_tripleo_adoption_requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
- name: TripleO adoption requirements
hosts: "{{ groups['overcloud'][0] | default([]) }}"
gather_facts: true
tasks:
# Propagate StorageNFS network
- name: Propagate Storage NFS network
block:
- name: Load Ceph data
when:
- (manila_backend | default("cephfs")) == "cephnfs"
ansible.builtin.import_role:
name: ceph_migrate
tasks_from: ceph_load
tags:
- ceph_load
- manila_adoption

# Add firewall rules
- name: Firewall
ansible.builtin.import_role:
name: ceph_migrate
tasks_from: ceph_firewall
tags:
- ceph_firewall
- manila_adoption

- name: Propagate Storage NFS network
when:
- propagate_storage_nfs | bool | default(false)
- target_nodes | default([]) | length > 0
ansible.builtin.include_role:
name: ceph_migrate
tasks_from: propagate_storage_nfs
loop: "{{ target_nodes }}"
tags:
- manila_adoption

# Create the Ceph-NFS cluster
- name: Create a ceph nfs cluster
when:
- (manila_backend | default("cephfs")) == "cephnfs"
- ceph_nfs_vip is defined
ansible.builtin.include_role:
name: ceph_migrate
tasks_from: nfs
tags:
- manila_adoption
2 changes: 2 additions & 0 deletions tests/roles/ceph_migrate/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ ceph_alertmanager_container_image: "quay.io/prometheus/alertmanager:v0.25.0"
ceph_grafana_container_image: "quay.io/ceph/ceph-grafana:9.4.7"
ceph_node_exporter_container_image: "quay.io/prometheus/node-exporter:v1.5.0"
ceph_prometheus_container_image: "quay.io/prometheus/prometheus:v2.43.0"
ceph_storagenfs_nic: "nic2"
ceph_storagenfs_vlan_id: "70"
4 changes: 2 additions & 2 deletions tests/roles/ceph_migrate/tasks/nfs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
become: true
ansible.builtin.command: |
{{ ceph_cli }} nfs cluster create {{ cephfs_name | default('cephfs') }} \
--ingress --virtual-ip={{ ceph_nfs_vip }} \
--ingress-mode=haproxy-protocol '--placement=label=nfs'
'--placement=label:nfs' --ingress --virtual-ip={{ ceph_nfs_vip }} \
--ingress-mode=haproxy-protocol
changed_when: false
23 changes: 23 additions & 0 deletions tests/roles/ceph_migrate/tasks/propagate_storage_nfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Patch net-config config and add the IP address (target node)
when:
- ceph_storagenfs_ipaddr is defined
- ceph_storagenfs_ipaddr | ansible.builtin.ipaddr
delegate_to: "{{ target_node }}"
become: true
ansible.builtin.blockinfile:
marker_begin: "BEGIN storageNFS network"
marker_end: "END storageNFS network"
path: "{{ os_net_conf_path }}"
block: |
- type: vlan
device: {{ ceph_storagenfs_nic }}
vlan_id: {{ ceph_storagenfs_vlan_id }}
addresses:
- ip_netmask: {{ ceph_storagenfs_ipaddr }}/24
routes: []
- name: Refresh os-net-config (target_node)
become: true
delegate_to: "{{ target_node }}"
ansible.builtin.command:
"os-net-config -c {{ os_net_conf_path }}"
3 changes: 3 additions & 0 deletions tests/roles/manila_adoption/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# manila_backend can be 'cephfs' or 'cephnfs'
manila_backend: cephfs
os_net_conf_path: "/etc/os-net-config/config.yaml"
manila_storagenfs_nic: "nic2"
manila_storagenfs_vlan_id: "70"

0 comments on commit d909b76

Please sign in to comment.