add group-based variables

This commit is contained in:
2025-03-23 23:08:07 -05:00
parent 46628aa324
commit a07939cbcb
13 changed files with 100 additions and 69 deletions

View File

@@ -1,7 +1,7 @@
---
- name: Create a directory if it does not exist
ansible.builtin.file:
path: "{{ matchbox_assets }}/{{ hostvars['ocp-hub'].cluster_name }}"
path: "{{ hostvars[groups['matchbox'][0]].matchbox_assets }}/{{ hostvars[groups['hub-cluster'][0]].cluster_name }}"
state: directory
mode: '0755'
become: true
@@ -9,7 +9,8 @@
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: 03-openshift-image/boot-artifacts/
dest: "{{ matchbox_assets }}/{{ hostvars['ocp-hub'].cluster_name }}/"
dest: "{{ hostvars[groups['matchbox'][0]].matchbox_assets }}/{{ hostvars[groups['hub-cluster'][0]].cluster_name }}/"
owner: matchbox
group: matchbox
mode: '0644'
become: true

View File

@@ -0,0 +1,33 @@
apiVersion: v1alpha1
kind: AgentConfig
metadata:
name: {{ hostvars[groups['hub-cluster'][0]].cluster_name }}
rendezvousIP: {{ hostvars['ocp-hub'].ip_address }}
bootArtifactsBaseURL: {{ hostvars['matchbox'].http_endpoint }}/assets/hub/
hosts:
- hostname: {{ hostvars['ocp-hub'].hostname }}
role: master
interfaces:
- name: {{ hostvars['ocp-hub'].primary_interface }}
macAddress: {{ hostvars['ocp-hub'].mac_address }}
networkConfig:
interfaces:
- name: {{ hostvars['ocp-hub'].primary_interface }}
type: ethernet
state: up
identifier: mac-address
mac-address: {{ hostvars['ocp-hub'].mac_address }}
ipv4:
enabled: true
dhcp: true
dns-resolver:
config:
server:
- 10.1.71.254
- 10.1.71.253
routes:
config:
- destination: 0.0.0.0/0
next-hop-address: 10.1.71.1
next-hop-interface: {{ hostvars['ocp-hub'].primary_interface }}
table-id: 254

View File

@@ -0,0 +1,25 @@
apiVersion: v1
baseDomain: {{ hostvars[groups['hub-cluster'][0]].base_domain }}
compute:
- name: worker
replicas: {{ hostvars[groups['hub-cluster'][0]].worker_node_count }}
controlPlane:
hyperthreading: Enabled
name: master
replicas: {{ hostvars[groups['hub-cluster'][0]].master_node_count }}
metadata:
name: {{ hostvars[groups['hub-cluster'][0]].cluster_name }}
networking:
clusterNetwork:
- cidr: {{ hostvars[groups['hub-cluster'][0]].cluster_network }}
hostPrefix: {{ hostvars[groups['hub-cluster'][0]].cluster_network_host_prefix }}
machineNetwork:
- cidr: {{ hostvars[groups['hub-cluster'][0]].machine_network }}
networkType: OVNKubernetes
serviceNetwork:
- {{ hostvars[groups['hub-cluster'][0]].service_network }}
platform:
{{ hostvars[groups['hub-cluster'][0]].platform_type }}: {}
fips: false
pullSecret: '{{ vault_pull_secret }}'
sshKey: '{{ vault_ssh_key }}'