diff --git a/10-sno-hub-cluster/02-dhcp/ip-reservations.yml b/10-sno-hub-cluster/02-dhcp/ip-reservations.yml index 34e08ba..0993f40 100644 --- a/10-sno-hub-cluster/02-dhcp/ip-reservations.yml +++ b/10-sno-hub-cluster/02-dhcp/ip-reservations.yml @@ -16,8 +16,8 @@ - name: Add host reservation to dnsmasq ansible.builtin.lineinfile: path: /etc/dnsmasq.d/hosts.conf - regexp: "^dhcp-host={{ mac_address }}" - line: "dhcp-host={{ mac_address }},{{ ip_address }} #{{ hostname }}" + regexp: "^dhcp-host={{ hostvars['ocp-hub'].mac_address }}" + line: "dhcp-host={{ hostvars['ocp-hub'].mac_address }},{{ hostvars['ocp-hub'].ip_address }} #{{ hostvars['ocp-hub'].hostname }}" state: present become: true diff --git a/10-sno-hub-cluster/install.yml b/10-sno-hub-cluster/install.yml index 8768dcf..4e5d46b 100644 --- a/10-sno-hub-cluster/install.yml +++ b/10-sno-hub-cluster/install.yml @@ -16,11 +16,15 @@ - ansible.builtin.include_tasks: file: 02-dhcp/ip-reservations.yml - - name: Terraform matchbox groups file + - name: OpenShift Installer install-config.yaml ansible.builtin.template: src: templates/openshift-installer/install-config.yaml.j2 dest: 03-openshift-image/install-config.yaml -# include_vars: group_vars/hub + + - name: OpenShift Installer agent-config.yaml + ansible.builtin.template: + src: templates/openshift-installer/agent-config.yaml.j2 + dest: 03-openshift-image/agent-config.yaml - ansible.builtin.include_tasks: file: 03-openshift-image/create-openshift-image.yml diff --git a/group_vars/all/vars b/group_vars/all/vars index eb9f134..96c5de2 100644 --- a/group_vars/all/vars +++ b/group_vars/all/vars @@ -12,8 +12,8 @@ matchbox_rpc_endpoint: "matchbox.int.mk-labs.cloud:8081" openshift_installer_pull_secret: "{{ vault_pull_secret }}" openshift_installer_ssh_key: "{{ vault_ssh_key }}" -# Variables for 10-sno-hub-cluster -hub_cluster_mac_address: "98:b7:85:1e:c6:f1" -hub_cluster_ip_address: "10.1.71.10" -hub_cluster_hostname: "ocp-hub" -hub_cluster_name: "hub" +# # Variables for 10-sno-hub-cluster +# hub_cluster_mac_address: "98:b7:85:1e:c6:f1" +# hub_cluster_ip_address: "10.1.71.10" +# hub_cluster_hostname: "ocp-hub" +# hub_cluster_name: "hub" diff --git a/host_vars/ocp-hub/vars b/host_vars/ocp-hub/vars new file mode 100644 index 0000000..322d5d6 --- /dev/null +++ b/host_vars/ocp-hub/vars @@ -0,0 +1,5 @@ +--- +mac_address: "98:b7:85:1e:c6:f1" +ip_address: "10.1.71.10" +hostname: "ocp-hub" +primary_interface: "enp1s0f0" diff --git a/10-sno-hub-cluster/03-openshift-image/agent-config.yaml b/templates/openshift-installer/agent-config.yaml.j2 similarity index 55% rename from 10-sno-hub-cluster/03-openshift-image/agent-config.yaml rename to templates/openshift-installer/agent-config.yaml.j2 index ed5122d..4f79440 100644 --- a/10-sno-hub-cluster/03-openshift-image/agent-config.yaml +++ b/templates/openshift-installer/agent-config.yaml.j2 @@ -1,22 +1,22 @@ apiVersion: v1alpha1 kind: AgentConfig metadata: - name: hub -rendezvousIP: 10.1.71.10 + name: {{ group_vars['hub-cluster'].cluster_name }} +rendezvousIP: {{ hostvars['ocp-hub'].ip_address }} bootArtifactsBaseURL: https://matchbox.int.mk-labs.cloud:8080/assets/hub/ hosts: - - hostname: hub + - hostname: {{ hostvars['ocp-hub'].hostname }} role: master interfaces: - - name: enp1s0f0 - macAddress: 98:B7:85:1E:C6:F1 + - name: {{ hostvars['ocp-hub'].primary_interface }} + macAddress: {{ hostvars['ocp-hub'].mac_address }} networkConfig: interfaces: - - name: enp1s0f0 + - name: {{ hostvars['ocp-hub'].primary_interface }} type: ethernet state: up identifier: mac-address - mac-address: 98:B7:85:1E:C6:F1 + mac-address: {{ hostvars['ocp-hub'].mac_address }} ipv4: enabled: true dhcp: true @@ -29,5 +29,5 @@ hosts: config: - destination: 0.0.0.0/0 next-hop-address: 10.1.71.1 - next-hop-interface: enp1s0f0 + next-hop-interface: {{ hostvars['ocp-hub'].primary_interface }} table-id: 254