sync repo to git
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Dnsmasq
|
||||
hosts: localhost
|
||||
become: yes
|
||||
vars:
|
||||
- additional_dhcp_hosts:
|
||||
ethernet_switch:
|
||||
desc: "SNO Hub Cluster"
|
||||
mac: 98:b7:85:1e:c6:f1
|
||||
ip: 10.1.71.10
|
||||
|
||||
roles:
|
||||
- role: ricsanfre.dnsmasq
|
||||
24
infra-config/10-internal-cluster/01-dns/.terraform.lock.hcl
generated
Normal file
24
infra-config/10-internal-cluster/01-dns/.terraform.lock.hcl
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/rework-space-com/freeipa" {
|
||||
version = "5.0.0"
|
||||
constraints = "5.0.0"
|
||||
hashes = [
|
||||
"h1:6EquDv6GgQO2HjZUUoRIUVzYa951n+wb4Uk7ggD6XD0=",
|
||||
"zh:098607e559c3b696401034ff494ba8068962b45059ee067a54b58334b6ee0f2c",
|
||||
"zh:18b806a14bb9d9382213c6929af35f5a65f16c17ff526d475f1eab33d1470290",
|
||||
"zh:2c8c74668844d256b7fdc503cd736a20b7e58db5b31880d1ad8090c1af04e24c",
|
||||
"zh:3bba458b9a6df99c21da58750dd6586b93bdcc557e4a2d695e801ada39e8de1e",
|
||||
"zh:58f728d9e98cc7aae3841c07318be64b6dcb2f51c041f04bba977e61104a2333",
|
||||
"zh:597dfbefbfe111a31e9ff3c4fc14fc8e12c1e255454087d3eebd2ec6c7aa9bf3",
|
||||
"zh:6093d6db13d834c23f5482efae80c8e1ae046028fccf24242f0f1c1935e6aa70",
|
||||
"zh:87271fa234a57ce05d4166e444002bd66976f971b434f7add45c874c9587129d",
|
||||
"zh:89f7f6be64b6bf9e708fbafd22f410cf3f50b1fcd4cd6c61e9ffffd6180ea839",
|
||||
"zh:9bdd7a984f845ff6f4bc4df5cc41a9de019639fceca62e60fc7c0f098ad2695c",
|
||||
"zh:a0551311c96b86050d15854b4fca2beaa06b2e1964f97945824567d0b90db580",
|
||||
"zh:c3daa12021725883bd32d7d852a2de845bb7a5f18009a45be7c2c2d891631713",
|
||||
"zh:d7871eb99683934a30b9d47508379e6d16978f3dcd73601af2204652668592aa",
|
||||
"zh:e8f72fd7750e6c1f0f97d039fea66cb85f457cf22908b7c3f14c7d2cf990ee84",
|
||||
]
|
||||
}
|
||||
3
infra-config/10-internal-cluster/01-dns/README.md
Normal file
3
infra-config/10-internal-cluster/01-dns/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# DNS Provider Configuration
|
||||
|
||||
This directory contains the configuration to updateFreeIPA DNS for the Hub Cluster.
|
||||
39
infra-config/10-internal-cluster/01-dns/dns.tf
Normal file
39
infra-config/10-internal-cluster/01-dns/dns.tf
Normal file
@@ -0,0 +1,39 @@
|
||||
resource "freeipa_dns_record" "ocp-hub" {
|
||||
zone_name = "int.mk-labs.cloud."
|
||||
name = "ocp-hub"
|
||||
type = "A"
|
||||
records = [
|
||||
"10.1.71.10",
|
||||
]
|
||||
ttl = 60
|
||||
}
|
||||
|
||||
resource "freeipa_dns_record" "api" {
|
||||
zone_name = "int.mk-labs.cloud."
|
||||
name = "api.hub"
|
||||
type = "A"
|
||||
records = [
|
||||
"10.1.71.10",
|
||||
]
|
||||
ttl = 60
|
||||
}
|
||||
|
||||
resource "freeipa_dns_record" "api-int" {
|
||||
zone_name = "int.mk-labs.cloud."
|
||||
name = "api-int.hub"
|
||||
type = "A"
|
||||
records = [
|
||||
"10.1.71.10",
|
||||
]
|
||||
ttl = 60
|
||||
}
|
||||
|
||||
resource "freeipa_dns_record" "wildcard-apps" {
|
||||
zone_name = "int.mk-labs.cloud."
|
||||
name = "*.apps.hub"
|
||||
type = "A"
|
||||
records = [
|
||||
"10.1.71.10",
|
||||
]
|
||||
ttl = 60
|
||||
}
|
||||
22
infra-config/10-internal-cluster/01-dns/provider.tf
Normal file
22
infra-config/10-internal-cluster/01-dns/provider.tf
Normal file
@@ -0,0 +1,22 @@
|
||||
# Configure the DNS Provider
|
||||
provider "freeipa" {
|
||||
host = "infra01.int.mk-labs.cloud"
|
||||
username = "admin"
|
||||
password = var.freeipa_password
|
||||
insecure = true
|
||||
}
|
||||
|
||||
variable "freeipa_password" {
|
||||
description = "The password for the FreeIPA provider"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_providers {
|
||||
freeipa = {
|
||||
source = "rework-space-com/freeipa"
|
||||
version = "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
infra-config/10-internal-cluster/02-dhcp/README.md
Normal file
1
infra-config/10-internal-cluster/02-dhcp/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# Add/modify entry in DNSmasq
|
||||
28
infra-config/10-internal-cluster/02-dhcp/ip-reservations.yml
Normal file
28
infra-config/10-internal-cluster/02-dhcp/ip-reservations.yml
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: Ensure dnsmasq is installed
|
||||
ansible.builtin.apt:
|
||||
name: dnsmasq
|
||||
state: present
|
||||
become: true
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Ensure dnsmasq is installed
|
||||
ansible.builtin.dnf:
|
||||
name: dnsmasq
|
||||
state: present
|
||||
become: true
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: Add host reservation to dnsmasq
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/dnsmasq.d/hosts.conf
|
||||
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
|
||||
|
||||
- name: Restart dnsmasq service
|
||||
ansible.builtin.service:
|
||||
name: dnsmasq
|
||||
state: restarted
|
||||
become: true
|
||||
@@ -0,0 +1,7 @@
|
||||
# Configure the OpenShift Agent Installer and Matchbox
|
||||
|
||||
## Reference Document
|
||||
|
||||
<https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/epub/installing_an_on-premise_cluster_with_the_agent-based_installer/prepare-pxe-assets-agent#prepare-pxe-assets-agent>
|
||||
|
||||
Recap of image creation is in 10-sno-hub-cluster/02-matchbox/.openshift_install.log
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: OpenShift image creation
|
||||
ansible.builtin.command: /usr/local/bin/openshift-install agent create pxe-files
|
||||
args:
|
||||
chdir: 03-openshift-image
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
- name: Create a directory if it does not exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ hostvars[groups['matchbox'][0]].assets }}/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
become: true
|
||||
|
||||
- name: Copy file with owner and permissions
|
||||
ansible.builtin.copy:
|
||||
src: 03-openshift-image/boot-artifacts/
|
||||
dest: "{{ hostvars[groups['matchbox'][0]].assets }}/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}/"
|
||||
owner: matchbox
|
||||
group: matchbox
|
||||
mode: '0644'
|
||||
become: true
|
||||
@@ -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[groups['matchbox'][0]].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.251
|
||||
- 10.1.71.252
|
||||
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
|
||||
@@ -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 }}'
|
||||
@@ -0,0 +1,8 @@
|
||||
// Matcher group for OCP Internal machines
|
||||
resource "matchbox_group" "{{ hostvars[groups['hub_cluster'][0]].cluster_name }}" {
|
||||
name = "{{ hostvars['ocp-hub'].hostname }}" # Physical Server
|
||||
profile = matchbox_profile.openshift-agent-install.name
|
||||
selector = {
|
||||
mac = "{{ hostvars['ocp-hub'].mac_address }}" # PXE boots and installs to 10GbE NIC
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Fedora CoreOS profile
|
||||
resource "matchbox_profile" "openshift-agent-install" {
|
||||
name = "{{ hostvars[groups['hub_cluster'][0]].cluster_name }}"
|
||||
kernel = "/assets/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}/agent.x86_64-vmlinuz"
|
||||
initrd = [
|
||||
"--name initrd /assets/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}/agent.x86_64-initrd.img"
|
||||
]
|
||||
|
||||
args = [
|
||||
"initrd=initrd",
|
||||
"coreos.live.rootfs_url={{ hostvars[groups['matchbox'][0]].http_endpoint }}/assets/{{ hostvars[groups['hub_cluster'][0]].cluster_name }}/agent.x86_64-rootfs.img",
|
||||
"rw",
|
||||
"ignition.firstboot",
|
||||
"ignition.platform.id=metal",
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Configure the matchbox provider
|
||||
provider "matchbox" {
|
||||
endpoint = "{{ hostvars[groups['matchbox'][0]].rpc_endpoint }}"
|
||||
client_cert = file("/etc/matchbox/client.crt")
|
||||
client_key = file("/etc/matchbox/client.key")
|
||||
ca = file("/etc/matchbox/ca.crt")
|
||||
}
|
||||
|
||||
terraform {
|
||||
required_providers {
|
||||
ct = {
|
||||
source = "poseidon/ct"
|
||||
version = "0.13.0"
|
||||
}
|
||||
matchbox = {
|
||||
source = "poseidon/matchbox"
|
||||
version = "0.5.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Run all tasks necessary to configure matchbox to install the cluster
|
||||
hosts: matchbox
|
||||
connection: local
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Clone Git repository
|
||||
ansible.builtin.git:
|
||||
repo: "https://github.com/redhatryan/acm-hub-bootstrap.git"
|
||||
dest: 05-bootstrap-acm
|
||||
version: main
|
||||
become: true
|
||||
62
infra-config/10-internal-cluster/install.yml
Normal file
62
infra-config/10-internal-cluster/install.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
- name: Run all tasks necessary to configure matchbox to install the cluster
|
||||
hosts: matchbox
|
||||
connection: local
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Deploy DNS entries for cluster via Terraform
|
||||
community.general.terraform:
|
||||
project_path: 01-dns/
|
||||
variables:
|
||||
freeipa_password: "{{ vault_freeipa_password }}"
|
||||
state: present
|
||||
force_init: true
|
||||
|
||||
- name: Deploy DHCP entries for cluster via Terraform
|
||||
ansible.builtin.include_tasks:
|
||||
file: 02-dhcp/ip-reservations.yml
|
||||
|
||||
- name: OpenShift Installer install-config.yaml
|
||||
ansible.builtin.template:
|
||||
src: 03-openshift-image/templates/install-config.yaml.j2
|
||||
dest: 03-openshift-image/install-config.yaml
|
||||
mode: '0644'
|
||||
|
||||
- name: OpenShift Installer agent-config.yaml
|
||||
ansible.builtin.template:
|
||||
src: 03-openshift-image/templates/agent-config.yaml.j2
|
||||
dest: 03-openshift-image/agent-config.yaml
|
||||
mode: '0644'
|
||||
|
||||
- name: Create OpenShift image
|
||||
ansible.builtin.include_tasks:
|
||||
file: 03-openshift-image/create-openshift-image.yml
|
||||
|
||||
- name: Move PXE assets to matchbox
|
||||
ansible.builtin.include_tasks:
|
||||
file: 03-openshift-image/move-pxe-assets.yml
|
||||
|
||||
- name: Terraform matchbox groups file
|
||||
ansible.builtin.template:
|
||||
src: 04-matchbox/templates/groups.tf.j2
|
||||
dest: 04-matchbox/groups.tf
|
||||
mode: '0644'
|
||||
|
||||
- name: Terraform matchbox profiles file
|
||||
ansible.builtin.template:
|
||||
src: 04-matchbox/templates/profiles.tf.j2
|
||||
dest: 04-matchbox/profiles.tf
|
||||
mode: '0644'
|
||||
|
||||
- name: Terraform matchbox provider file
|
||||
ansible.builtin.template:
|
||||
src: 04-matchbox/templates/provider.tf.j2
|
||||
dest: 04-matchbox/provider.tf
|
||||
mode: '0644'
|
||||
|
||||
- name: Configure Matchbox via Terraform
|
||||
community.general.terraform:
|
||||
project_path: 04-matchbox/
|
||||
state: present
|
||||
force_init: true
|
||||
Reference in New Issue
Block a user