Move ansible to it's own directory structure
This commit is contained in:
40
ansible/playbooks/templates/agent-config.yaml.j2
Normal file
40
ansible/playbooks/templates/agent-config.yaml.j2
Normal file
@@ -0,0 +1,40 @@
|
||||
apiVersion: v1alpha1
|
||||
kind: AgentConfig
|
||||
metadata:
|
||||
name: {{ hostvars[groups[cluster_group][0]].cluster_name }}
|
||||
rendezvousIP: {{ hostvars[groups[cluster_group][0]].ip_address }}
|
||||
bootArtifactsBaseURL: {{ hostvars[groups['matchbox_server'][0]].http_endpoint }}/assets/hub/
|
||||
hosts:
|
||||
{% for host in groups[cluster_group] %}
|
||||
- hostname: {{ host }}
|
||||
role: {{ hostvars[host].node_role | default('master') }}
|
||||
interfaces:
|
||||
- name: {{ hostvars[host].primary_interface }}
|
||||
macAddress: {{ hostvars[host].install_mac_address }}
|
||||
networkConfig:
|
||||
interfaces:
|
||||
- name: {{ hostvars[host].primary_interface }}
|
||||
type: ethernet
|
||||
state: up
|
||||
identifier: mac-address
|
||||
mac-address: {{ hostvars[host].install_mac_address }}
|
||||
ipv4:
|
||||
enabled: true
|
||||
dhcp: true
|
||||
- name: {{ hostvars[host].boot_interface }}
|
||||
type: ethernet
|
||||
state: down
|
||||
identifier: mac-address
|
||||
mac-address: {{ hostvars[host].boot_mac_address }}
|
||||
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[host].primary_interface }}
|
||||
table-id: 254
|
||||
{% endfor %}
|
||||
14
ansible/playbooks/templates/groups.tf.j2
Normal file
14
ansible/playbooks/templates/groups.tf.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
// Matcher group for OCP Internal machines
|
||||
{% for host in groups[cluster_group] %}
|
||||
resource "matchbox_group" "{{ host }}" {
|
||||
name = "{{ host }}" # Physical Server
|
||||
profile = matchbox_profile.openshift-agent-install.name
|
||||
selector = {
|
||||
{% if hostvars[host].boot_mac_address == hostvars[host].install_mac_address %}
|
||||
mac = "{{ hostvars[host].boot_mac_address }}" # PXE boots and installs to same NIC
|
||||
{% else %}
|
||||
mac = "{{ hostvars[host].boot_mac_address }}" # PXE boots to 1GbE NIC, installs to 10GbE NIC
|
||||
{% endif %}
|
||||
}
|
||||
}
|
||||
{% endfor %}
|
||||
28
ansible/playbooks/templates/install-config.yaml.j2
Normal file
28
ansible/playbooks/templates/install-config.yaml.j2
Normal file
@@ -0,0 +1,28 @@
|
||||
apiVersion: v1
|
||||
baseDomain: {{ hostvars[groups[cluster_group][0]].base_domain }}
|
||||
compute:
|
||||
- name: worker
|
||||
hyperthreading: Enabled
|
||||
replicas: {{ hostvars[groups[cluster_group][0]].worker_node_count }}
|
||||
controlPlane:
|
||||
hyperthreading: Enabled
|
||||
name: master
|
||||
replicas: {{ hostvars[groups[cluster_group][0]].master_node_count }}
|
||||
metadata:
|
||||
name: {{ hostvars[groups[cluster_group][0]].cluster_name }}
|
||||
networking:
|
||||
clusterNetwork:
|
||||
- cidr: {{ hostvars[groups[cluster_group][0]].cluster_network }}
|
||||
hostPrefix: {{ hostvars[groups[cluster_group][0]].cluster_network_host_prefix }}
|
||||
machineNetwork:
|
||||
- cidr: {{ hostvars[groups[cluster_group][0]].machine_network }}
|
||||
networkType: OVNKubernetes
|
||||
serviceNetwork:
|
||||
- {{ hostvars[groups[cluster_group][0]].service_network }}
|
||||
platform:
|
||||
{{ hostvars[groups[cluster_group][0]].platform_type }}:
|
||||
apiVIP: {{ hostvars[groups[cluster_group][0]].api_address }}
|
||||
ingressVIP: {{ hostvars[groups[cluster_group][0]].app_address }}
|
||||
fips: false
|
||||
pullSecret: '{{ vault_pull_secret }}'
|
||||
sshKey: '{{ vault_ssh_key }}'
|
||||
16
ansible/playbooks/templates/profiles.tf.j2
Normal file
16
ansible/playbooks/templates/profiles.tf.j2
Normal file
@@ -0,0 +1,16 @@
|
||||
// Fedora CoreOS profile
|
||||
resource "matchbox_profile" "openshift-agent-install" {
|
||||
name = "{{ hostvars[groups[cluster_group][0]].cluster_name }}"
|
||||
kernel = "/assets/{{ hostvars[groups[cluster_group][0]].cluster_name }}/agent.x86_64-vmlinuz"
|
||||
initrd = [
|
||||
"--name initrd /assets/{{ hostvars[groups[cluster_group][0]].cluster_name }}/agent.x86_64-initrd.img"
|
||||
]
|
||||
|
||||
args = [
|
||||
"initrd=initrd",
|
||||
"coreos.live.rootfs_url={{ hostvars[groups['matchbox_server'][0]].http_endpoint }}/assets/{{ hostvars[groups[cluster_group][0]].cluster_name }}/agent.x86_64-rootfs.img",
|
||||
"rw",
|
||||
"ignition.firstboot",
|
||||
"ignition.platform.id=metal",
|
||||
]
|
||||
}
|
||||
20
ansible/playbooks/templates/provider.tf.j2
Normal file
20
ansible/playbooks/templates/provider.tf.j2
Normal file
@@ -0,0 +1,20 @@
|
||||
// Configure the matchbox provider
|
||||
provider "matchbox" {
|
||||
endpoint = "{{ hostvars[groups['matchbox_server'][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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user