chore: archive deprecated infra-config content (SNO cluster, duplicate ansible, old playbooks)
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
# Networks
|
||||
|
||||
My homelab is segmented into a set of networks. Each network is a separate subnet, and each subnet is a separate VLAN that usually corresponds to the 3rd octet of the IPv4 block it aligns to. The following table shows the network and VLAN information:
|
||||
|
||||
| Network | VLAN | DHCP Range | Description |
|
||||
|-----------------|------|------------------|------------------------|
|
||||
| 10.1.71.0/24 | 71 | 10.71.1.10-250 | Server network |
|
||||
| 10.10.22.0/24 | 22 | Static IPs | Cluster network |
|
||||
| 10.10.121.0/24 | 121 | Static IPs | Storage network |
|
||||
@@ -1,33 +0,0 @@
|
||||
# Proxmox
|
||||
|
||||
In this iteration of my homelab, core services are running as VMs in Proxmox.
|
||||
|
||||
The proxmox cluster will be installed via ISO Image and manually configured. (Future iterations will gitops this configuration via Ansible playbooks.)
|
||||
|
||||
## Primary Networking
|
||||
|
||||
| Hostname | VLAN | IP Address | NIC | Notes |
|
||||
|-------------|------|------------------|-----------------|----------------------------|
|
||||
| pve01 | | 10.1.71.51 | On-board 1 GbE | VLAN 71 set on switch port |
|
||||
| pve02 | | 10.1.71.52 | On-board 1 GbE | VLAN 71 set on switch port |
|
||||
| pve03 | | 10.1.71.53 | On-board 1 GbE | VLAN 71 set on switch port |
|
||||
|
||||
## Additional Networking
|
||||
|
||||
| Hostname | VLAN | IP Address | NIC | Notes |
|
||||
|-------------|------|--------------------|--------------|------------------------------|
|
||||
| pve01 | 22 | 10.10.22.51 | PCIe 10 GbE | Cluster Network, VLAN tagged |
|
||||
| pve01 | 121 | 10.10.121.51 | PCIe 10 GbE | Storage Network, VLAN tagged |
|
||||
| pve02 | 22 | 10.10.22.52 | PCIe 10 GbE | Cluster Network, VLAN tagged |
|
||||
| pve02 | 121 | 10.10.121.52 | PCIe 10 GbE | Storage Network, VLAN tagged |
|
||||
| pve03 | 22 | 10.10.22.53 | PCIe 10 GbE | Cluster Network, VLAN tagged |
|
||||
| pve03 | 121 | 10.10.121.53 | PCIe 10 GbE | Storage Network, VLAN tagged |
|
||||
|
||||
## Hosted Services
|
||||
|
||||
- Recursive DNS (Unbound)
|
||||
- Authoritative DNS (FreeIPA)
|
||||
- Identity Management (FreeIPA)
|
||||
- iPXE (Matchbox)
|
||||
- VM Backup (Proxmox Backup)
|
||||
- VM Tempalate Creation (Terraform/Packer)
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
- name: Install all software on infra01
|
||||
hosts: infra01
|
||||
gather_facts: true
|
||||
#become: true
|
||||
|
||||
tasks:
|
||||
# - Update all packages
|
||||
# - Copy .vault_pass.txt from laptop and set env variable
|
||||
# - Install ansible required packages
|
||||
|
||||
- name: Install ansible-core
|
||||
ansible.builtin.package:
|
||||
name: ansible-core
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Install dnf-plugins-core
|
||||
ansible.builtin.package:
|
||||
name: dnf-plugins-core
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Install git
|
||||
ansible.builtin.package:
|
||||
name: git
|
||||
state: present
|
||||
become: true
|
||||
|
||||
- name: Register status of git repo
|
||||
ansible.builtin.stat:
|
||||
path: homelab/.git
|
||||
register: git_status
|
||||
|
||||
- name: Clone GitHub repository
|
||||
when: not git_status.stat.exists
|
||||
block:
|
||||
- name: First run, cloning the repo
|
||||
ansible.builtin.git:
|
||||
repo: https://github.com/rblundon/homelab.git
|
||||
dest: homelab
|
||||
|
||||
- name: Register status of /usr/local/bin/terraform
|
||||
ansible.builtin.stat:
|
||||
path: /usr/local/bin/terraform
|
||||
register: terraform_path
|
||||
|
||||
- name: Download and install terraform version
|
||||
when: not terraform_path.stat.exists
|
||||
block:
|
||||
- name: Download and install terraform
|
||||
ansible.builtin.unarchive:
|
||||
src: "https://releases.hashicorp.com/terraform/{{ terraform_version }}/terraform_{{ terraform_version }}_linux_amd64.zip"
|
||||
dest: "/usr/local/bin/"
|
||||
remote_src: true
|
||||
mode: '0755'
|
||||
exclude: "LICENSE.txt"
|
||||
become: true
|
||||
|
||||
roles:
|
||||
- somaz94.ansible_k8s_iac_tool.install_kustomize
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
- 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
|
||||
@@ -1,24 +0,0 @@
|
||||
# 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",
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
# DNS Provider Configuration
|
||||
|
||||
This directory contains the configuration to updateFreeIPA DNS for the Hub Cluster.
|
||||
@@ -1,39 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
# 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 +0,0 @@
|
||||
# Add/modify entry in DNSmasq
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
- 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
|
||||
@@ -1,7 +0,0 @@
|
||||
# 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
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- name: OpenShift image creation
|
||||
ansible.builtin.command: /usr/local/bin/openshift-install agent create pxe-files
|
||||
args:
|
||||
chdir: 03-openshift-image
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
- 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
|
||||
@@ -1,33 +0,0 @@
|
||||
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.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
|
||||
@@ -1,25 +0,0 @@
|
||||
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 }}'
|
||||
@@ -1,8 +0,0 @@
|
||||
// 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
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// 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",
|
||||
]
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
- 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
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
- 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
|
||||
@@ -1,18 +0,0 @@
|
||||
# infra-config
|
||||
|
||||
## Create a virtual environment for ansible-core, activate it upgrade pip
|
||||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
python3 -m venv ~/venv-ansible
|
||||
source ~/venv-ansible/bin/activate
|
||||
pip3 install --upgrade pip
|
||||
```
|
||||
|
||||
## Install ansible-core, proxmoxer and requests (needed by community.general.proxmox_*)
|
||||
|
||||
```bash
|
||||
pip3 install ansible-core proxmoxer requests
|
||||
ansible-galaxy collection install community.proxmox
|
||||
```
|
||||
@@ -1,43 +0,0 @@
|
||||
# README
|
||||
|
||||
inventory # inventory file for all servers
|
||||
|
||||
group_vars/
|
||||
group1.yml # here we assign variables to particular groups
|
||||
group2.yml
|
||||
host_vars/
|
||||
hostname1.yml # here we assign variables to particular systems
|
||||
hostname2.yml
|
||||
|
||||
library/ # if any custom modules, put them here (optional)
|
||||
module_utils/ # if any custom module_utils to support modules, put them here (optional)
|
||||
filter_plugins/ # if any custom filter plugins, put them here (optional)
|
||||
|
||||
site.yml # master playbook
|
||||
webservers.yml # playbook for webserver tier
|
||||
dbservers.yml # playbook for dbserver tier
|
||||
|
||||
roles/
|
||||
common/ # this hierarchy represents a "role"
|
||||
tasks/ #
|
||||
main.yml # <-- tasks file can include smaller files if warranted
|
||||
handlers/ #
|
||||
main.yml # <-- handlers file
|
||||
templates/ # <-- files for use with the template resource
|
||||
ntp.conf.j2 # <------- templates end in .j2
|
||||
files/ #
|
||||
bar.txt # <-- files for use with the copy resource
|
||||
foo.sh # <-- script files for use with the script resource
|
||||
vars/ #
|
||||
main.yml # <-- variables associated with this role
|
||||
defaults/ #
|
||||
main.yml # <-- default lower priority variables for this role
|
||||
meta/ #
|
||||
main.yml # <-- role dependencies
|
||||
library/ # roles can also include custom modules
|
||||
module_utils/ # roles can also include custom module_utils
|
||||
lookup_plugins/ # or other types of plugins, like lookup in this case
|
||||
|
||||
webtier/ # same kind of structure as "common" was above, done for the webtier role
|
||||
monitoring/ # ""
|
||||
fooapp/ # ""
|
||||
@@ -1,13 +0,0 @@
|
||||
- name: "Add SSH key to servers for Ansible"
|
||||
hosts: ipaserver
|
||||
|
||||
vars_files:
|
||||
- ansible-vault.yml
|
||||
|
||||
roles:
|
||||
- role: rywillia.ssh-copy-id
|
||||
vars:
|
||||
hostname: "{{ ansible_hostname }}"
|
||||
username: "{{ vault_ansible_user }}"
|
||||
password: "{{ vault_ansible_password }}"
|
||||
ssh_public_key: "/Users/rblundon/git/MK-Labs/ansible/files/ansible"
|
||||
@@ -1,8 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
37663530616632333938363737366639623261366264616231396533366432303034376365643633
|
||||
3632383464666637343765366439333964646637643936380a326335353639326362366263373466
|
||||
63646562353737636333653333373765363331323065386137626161633333643034323962316630
|
||||
6263373464613033360a376633663236333464393866373733643839336165363761373931623761
|
||||
37646139633036646435323361326366326134656630656366366434363335353165356431613731
|
||||
39653364653465613066323164663261363461316662623433663637333330306663633864303862
|
||||
643261393832643433326332366166383239
|
||||
@@ -1,19 +0,0 @@
|
||||
[defaults]
|
||||
|
||||
# Chick-Fil-A would like a word...
|
||||
nocows = True
|
||||
|
||||
# Installs collections into [current dir]/ansible_collections/namespace/collection_name
|
||||
collections_paths = ./collections:~/.ansible/collections
|
||||
|
||||
# Installs roles into [current dir]/roles/namespace.rolename
|
||||
roles_path = ./roles
|
||||
|
||||
inventory = ./inventory
|
||||
|
||||
# default user to use for playbooks if user is not specified
|
||||
# (/usr/bin/ansible will use current user as default)
|
||||
remote_user = wed
|
||||
private_key_file = ~/.ssh/ansible
|
||||
|
||||
allow_world_readable_tmpfiles = True
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
roles: []
|
||||
|
||||
collections: []
|
||||
# - name: community.docker
|
||||
@@ -1,23 +0,0 @@
|
||||
- name: "Playbook to test the inventory_hostname and ansible_hostname"
|
||||
hosts: ipaserver
|
||||
# gather_facts: true
|
||||
tasks:
|
||||
- name: "What is my inventory_hostname"
|
||||
ansible.builtin.debug:
|
||||
var: inventory_hostname
|
||||
|
||||
- name: "What is my hostname"
|
||||
ansible.builtin.debug:
|
||||
var: hostname
|
||||
|
||||
- name: "What is my ansible_hostname"
|
||||
ansible.builtin.debug:
|
||||
var: ansible_hostname
|
||||
|
||||
- name: "What is my ansible_host"
|
||||
ansible.builtin.debug:
|
||||
var: ansible_host
|
||||
|
||||
# - name: "Ansible | List all known variables and facts"
|
||||
# ansible.builtin.debug:
|
||||
# var: hostvars[inventory_hostname]
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
hostname: infra01.int.mk-labs.cloud
|
||||
@@ -1,6 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
36383531343863313331636462653666393131633533346433343237653433633938343737363531
|
||||
3330616336336635313037356130373231643531613237340a613663303764333837333438343433
|
||||
38373264316533613763373634343735323764316364376138613934323339653735303562636631
|
||||
6166393933356663660a393036653937386239396331653037376564663232666561306631306331
|
||||
6362
|
||||
@@ -1,9 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
36393261393537313432333136623438383339303162636464353239386433316134613537336263
|
||||
6462326336363562613431653435353032383064303166340a333761633530643265336465663634
|
||||
65633864653830653738333563326162326430666237303362336537306238356231393761376539
|
||||
3335336333316231620a633562633731396464393366323762323365383664326430323038646566
|
||||
34643339303863303734623038393336313264636439636663616462613465303232643337653539
|
||||
39386231373231306639343561613665626634383932393836616239643662376237353965316162
|
||||
64623934616533386664333732343230626130343630393235303863366536363033323335323337
|
||||
61356536323131383438
|
||||
@@ -1,9 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
62613936343461366134333738386435646236386662663434373563663433393437383961336634
|
||||
6234303634383134623162396130623562353332313463620a373364393561633038383662643561
|
||||
37636232366532623364306638373064623433626364383639353137653139353764343466386463
|
||||
3237373565653262630a383633353438303934643064623464313639623963386661393562333738
|
||||
39316136633733386166663433633434653636333239323236306161653864353666653137653935
|
||||
34636236353635336631313432386362616462383763346162363466323432333064633336646439
|
||||
38656362306337393065366362653864363438313934333235616338653934626535363266633039
|
||||
38626466343338313239
|
||||
@@ -1,17 +0,0 @@
|
||||
---
|
||||
backup:
|
||||
hosts:
|
||||
backup:
|
||||
ansible_host: 10.1.71.9
|
||||
|
||||
ipaserver:
|
||||
hosts:
|
||||
infra01:
|
||||
ansible_host: 10.1.71.5
|
||||
|
||||
ipareplicas:
|
||||
hosts:
|
||||
|
||||
#infra:
|
||||
# hosts:
|
||||
# awx.int.mk-labs.cloud:
|
||||
@@ -1 +0,0 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINnSM/9fO8rz/amqkyoGUzUKNNzzmtSXPwOCr1O9zKNO ansible
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
- name: Set hostname
|
||||
hosts: ipa_server
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Set hostname
|
||||
ansible.builtin.hostname:
|
||||
name: "{{ hostname }}"
|
||||
register: result
|
||||
|
||||
- name: Print result
|
||||
ansible.builtin.debug:
|
||||
var: result
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
- name: Update sudoers for passwordless
|
||||
hosts: unbound_servers
|
||||
become: true
|
||||
gather_facts: true
|
||||
|
||||
tasks:
|
||||
- name: Update sudoers for passwordless
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/sudoers
|
||||
state: present
|
||||
regexp: "^%wheel"
|
||||
line: "%wheel ALL=(ALL) NOPASSWD:ALL"
|
||||
validate: "visudo -cf %s"
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
# file: site.yml
|
||||
#- import_playbook: webservers.yml
|
||||
#- import_playbook: dbservers.yml
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
- name: Playbook to unconfigure IPA servers
|
||||
hosts: ipaserver
|
||||
become: true
|
||||
|
||||
roles:
|
||||
- role: freeipa.ansible_freeipa.ipaserver
|
||||
state: absent
|
||||
@@ -1,10 +0,0 @@
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
66323366323966373436343163303131323239343134323434373762383539663539363464393234
|
||||
3762666265303430373832333865613538316261386162640a653562666130323138313533616334
|
||||
37623336653332353830306534633165626634376636396166356235353937323965616161323437
|
||||
3536643537623931380a633730366330396538373836326439306566666663633932393230323563
|
||||
30643032646366393530663138376638386538336466633532303563636163303637303933646465
|
||||
37316239393136383638636436646230643338616438646564396238376136653639393865363666
|
||||
39346337356133313938303938643866346636663737323238333762386234373563633761333166
|
||||
36373063643438303930313366653436363731656163376666323330633763373361393663633631
|
||||
39353232346634633836623134383861656337663062393232373932353431323730
|
||||
@@ -1,37 +0,0 @@
|
||||
---
|
||||
- name: Create VM ID from IP address for Proxmox hosts
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Create Proxmox VMs
|
||||
delegate_to: "localhost"
|
||||
when: platform is defined and platform == "proxmox"
|
||||
block:
|
||||
- name: Create VM ID from IP address
|
||||
ansible.builtin.set_fact:
|
||||
vm_id: "{{ ip_address.split('.')[-2] }}{{ '%03d' % (ip_address.split('.')[-1] | int) }}"
|
||||
|
||||
- name: Create new VM with minimal options and given vmid
|
||||
community.proxmox.proxmox_kvm:
|
||||
api_user: "{{ proxmox_user }}"
|
||||
api_password: "{{ proxmox_password }}"
|
||||
api_host: "{{ proxmox_host }}"
|
||||
name: "{{ inventory_hostname }}"
|
||||
node: "{{ proxmox_target_node }}"
|
||||
vmid: "{{ vm_id }}"
|
||||
cores: "{{ vm_cpus }}"
|
||||
memory: "{{ vm_memory }}"
|
||||
bios: ovmf
|
||||
efidisk0:
|
||||
storage: "{{ vm_storage }}"
|
||||
format: raw
|
||||
efitype: 4m
|
||||
pre_enrolled_keys: false
|
||||
scsihw: virtio-scsi-single
|
||||
scsi:
|
||||
scsi0: "{{ vm_storage }}:{{ vm_disk_size }},format=raw,aio=native" # VMs_LVM:10,format=raw
|
||||
net:
|
||||
net0: "virtio,bridge={{ vm_net_bridge }}{{ vm_net_vlan }}"
|
||||
onboot: "true"
|
||||
# update: "true"
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
# file: dns-entry.yml
|
||||
|
||||
# This playbook is used to create a DNS entry for a given server if it's IP address is a host variable.
|
||||
# It will create a Terraform file in the homelab/terraform/dns directory.
|
||||
# It will then run the Terraform apply command to create the DNS entry.
|
||||
# It will then notify the update-dns handler to update the DNS entry.
|
||||
|
||||
# Future work:
|
||||
# - Add a check to see if the DNS entry already exists.
|
||||
# - Add a check to see if the Terraform provider is already configured.
|
||||
# - Add a check to see if the Terraform DNS entry is already created.
|
||||
|
||||
- name: Validate Terraform DNS provider
|
||||
delegate_to: "{{ terraform_server }}"
|
||||
run_once: true
|
||||
block:
|
||||
- name: Check if terraform directory exists
|
||||
ansible.builtin.stat:
|
||||
path: homelab/terraform/dns
|
||||
register: terraform_dir
|
||||
|
||||
- name: Create Terraform directory for DNS entries
|
||||
ansible.builtin.file:
|
||||
path: homelab/terraform/dns
|
||||
state: directory
|
||||
mode: '0755'
|
||||
when: not terraform_dir.stat.exists
|
||||
|
||||
- name: "Create/Update Terraform DNS provider"
|
||||
ansible.builtin.template:
|
||||
src: templates/dns_provider.tf.j2
|
||||
dest: homelab/terraform/dns/provider.tf
|
||||
mode: '0644'
|
||||
|
||||
- name: Create Terraform files for DNS
|
||||
delegate_to: "{{ terraform_server }}"
|
||||
ansible.builtin.template:
|
||||
src: templates/dns.tf.j2
|
||||
dest: homelab/terraform/dns/{{ inventory_hostname }}.tf
|
||||
mode: '0644'
|
||||
changed_when: true
|
||||
notify:
|
||||
- Update DNS
|
||||
@@ -1,59 +0,0 @@
|
||||
!
|
||||
frr version 8.1
|
||||
frr defaults traditional
|
||||
hostname WorldDrive
|
||||
domainname int.mk-labs.cloud
|
||||
log syslog informational
|
||||
service integrated-vtysh-config
|
||||
!
|
||||
router bgp 65002
|
||||
bgp router-id 10.1.71.1
|
||||
bgp log-neighbor-changes
|
||||
no bgp default ipv4-unicast
|
||||
neighbor internal peer-group
|
||||
neighbor internal remote-as 65001
|
||||
neighbor external peer-group
|
||||
neighbor external remote-as 65003
|
||||
neighbor 10.1.71.141 peer-group external
|
||||
neighbor 10.1.71.141 description Compact1
|
||||
neighbor 10.1.71.142 peer-group external
|
||||
neighbor 10.1.71.142 description Compact2
|
||||
neighbor 10.1.71.143 peer-group external
|
||||
neighbor 10.1.71.143 description Compact3
|
||||
neighbor 10.1.71.131 peer-group internal
|
||||
neighbor 10.1.71.131 description MF 3
|
||||
neighbor 10.1.71.132 peer-group internal
|
||||
neighbor 10.1.71.132 description NUC2
|
||||
neighbor 10.1.71.133 peer-group internal
|
||||
neighbor 10.1.71.133 description NUC3
|
||||
neighbor 10.1.71.134 peer-group internal
|
||||
neighbor 10.1.71.134 description MF 3
|
||||
neighbor 10.1.71.135 peer-group internal
|
||||
neighbor 10.1.71.135 description NUC2
|
||||
neighbor 10.1.71.136 peer-group internal
|
||||
neighbor 10.1.71.136 description NUC3
|
||||
!
|
||||
address-family ipv4 unicast
|
||||
! no need to redistribute connected, as we are not advertising our own routes
|
||||
! redistribute connected
|
||||
neighbor external activate
|
||||
neighbor external soft-reconfiguration inbound
|
||||
neighbor external route-map allow-external in
|
||||
neighbor internal activate
|
||||
neighbor internal soft-reconfiguration inbound
|
||||
neighbor internal route-map allow-internal in
|
||||
exit-address-family
|
||||
exit
|
||||
!
|
||||
! allow any advertised routes in this range with up to 32 bits mask length
|
||||
ip prefix-list external seq 5 permit 10.1.182.0/24 le 32
|
||||
ip prefix-list internal seq 5 permit 10.1.82.0/24 le 32
|
||||
!
|
||||
route-map allow-external permit 10
|
||||
match ip address prefix-list external
|
||||
exit
|
||||
!
|
||||
route-map allow-internal permit 10
|
||||
match ip address prefix-list internal
|
||||
exit
|
||||
!
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
- name: Print host IP addresses
|
||||
hosts: infra01
|
||||
gather_facts: false
|
||||
vars:
|
||||
my_hosts: "{{ query('inventory_hostnames', 'all') }}"
|
||||
tasks:
|
||||
- name: Loop through all hosts
|
||||
ansible.builtin.debug:
|
||||
msg: "Host {{ item }} has IP address: {{ hostvars[my_hosts[my_idx]].ip_address | default('No IP address defined') }}"
|
||||
when: hostvars[my_hosts[my_idx]].ip_address is defined
|
||||
loop: "{{ my_hosts }}"
|
||||
loop_control:
|
||||
index_var: my_idx
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
# file: proxmox.yml
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
# file: site.yml
|
||||
|
||||
- name: Master playbook for home lab
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Process DNS entries
|
||||
when: ip_address is defined
|
||||
ansible.builtin.import_tasks:
|
||||
file: dns-entry.yml
|
||||
tags:
|
||||
- update-dns
|
||||
- never
|
||||
|
||||
handlers:
|
||||
- name: Update DNS
|
||||
run_once: true
|
||||
delegate_to: "{{ terraform_server }}"
|
||||
community.general.terraform:
|
||||
project_path: homelab/terraform/dns/
|
||||
variables:
|
||||
freeipa_server: "{{ dns_server }}"
|
||||
freeipa_admin: "{{ dns_admin }}"
|
||||
freeipa_password: "{{ vault_freeipa_password }}"
|
||||
state: present
|
||||
force_init: true
|
||||
Reference in New Issue
Block a user