Restructured Documentation

This commit is contained in:
2023-12-21 05:28:41 -07:00
parent fc878acaa4
commit bfbdbc147c
59 changed files with 2 additions and 2 deletions

View File

@ -0,0 +1,32 @@
# 1-provision-vm.yml
```jsx title="1-provision-vm.yml"
---
- name: Ubuntu Server-Based Cluster Deployment
hosts: all
become: yes
tasks:
- name: Fetch updates
apt:
update_cache: yes
- name: Install packages
apt:
name:
- nfs-common
- iptables
- nano
- htop
state: present
update_cache: yes
- name: Upgrade all packages
apt:
upgrade: dist
- name: Autoremove unused packages
apt:
autoremove: yes
- name: Reboot the VM
reboot:
```

View File

@ -0,0 +1,48 @@
# 2-create-initial-controlplane.yml
```jsx title="2-create-initial-controlplane.yml"
---
- name: Deploy Rancher on a Kubernetes cluster
hosts: your_target_host
become: true
gather_facts: yes
tasks:
- name: Download and install the RKE2 server deployment script
ansible.builtin.shell: |
curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE=server sh -
- name: Enable and start the RKE2 server service
ansible.builtin.systemd:
name: rke2-server
enabled: yes
state: started
- name: Create symlink for kubectl
ansible.builtin.command: |
ln -s $(find /var/lib/rancher/rke2/data/ -name kubectl) /usr/local/bin/kubectl
- name: Temporarily export the Kubeconfig
ansible.builtin.shell: |
export KUBECONFIG=/etc/rancher/rke2/rke2.yaml
- name: Install Helm
ansible.builtin.shell: |
curl -#L https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Add Helm repos for Rancher and Jetstack
ansible.builtin.shell: |
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo add jetstack https://charts.jetstack.io
- name: Install Cert-Manager CRDs
ansible.builtin.shell: |
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.6.1/cert-manager.crds.yaml
- name: Install Jetstack cert-manager via Helm
ansible.builtin.shell: |
helm upgrade -i cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace
- name: Install Rancher via Helm
ansible.builtin.shell: |
helm upgrade -i rancher rancher-latest/rancher --create-namespace --namespace cattle-system --set hostname=rancher.cyberstrawberry.net --set bootstrapPassword=bootStrapAllTheThings --set replicas=1
```

View File

@ -0,0 +1,48 @@
# 3A-deploy-additional-controlplane.yml
```jsx title="3A-deploy-additional-controlplane.yml"
---
- name: RKE2 Kubernetes Cluster Deployment
hosts: all
become: yes
tasks:
- name: Download and install RKE2 server
shell: "curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE=server sh -"
- name: Symlink the Kubectl Management Command
command: "ln -s {{ item }} /usr/local/bin/kubectl"
args:
creates: "/usr/local/bin/kubectl"
with_items:
- "{{ find_kubectl.stdout }}"
vars:
find_kubectl:
cmd: "find /var/lib/rancher/rke2/data/ -name kubectl"
- name: Create Rancher-Kubernetes-specific config directory
file:
path: "/etc/rancher/rke2/"
state: directory
- name: Inject IP of Primary Cluster Host (First Node) into Config File
lineinfile:
path: "/etc/rancher/rke2/config.yaml"
line: "server: https://192.168.3.21:9345"
- name: Get the node token from the first node in the cluster
shell: "cat /var/lib/rancher/rke2/server/node-token"
register: node_token
run_once: true
when: "'first_node' in group_names"
- name: Inject the Primary Cluster Host trust token into the config file
lineinfile:
path: "/etc/rancher/rke2/config.yaml"
line: "token: {{ node_token.stdout }}"
- name: Enable and start the RKE2 server service
systemd:
name: rke2-server.service
state: started
enabled: yes
```

View File

@ -0,0 +1,38 @@
# 3B-deploy-worker-node.yml
```jsx title="3B-deploy-worker-node.yml"
---
- name: RKE2 Kubernetes Worker Node Deployment
hosts: all
become: yes
tasks:
- name: Download and install RKE2 agent
shell: "curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE=agent sh -"
- name: Create Rancher-Kubernetes-specific config directory
file:
path: "/etc/rancher/rke2/"
state: directory
- name: Inject IP of Primary Cluster Host (First Node) into Config File
lineinfile:
path: "/etc/rancher/rke2/config.yaml"
line: "server: https://192.168.3.21:9345"
- name: Get the node token from the first node in the cluster
shell: "cat /var/lib/rancher/rke2/server/node-token"
register: node_token
run_once: true
delegate_to: first_node_host
- name: Inject the Primary Cluster Host trust token into the config file
lineinfile:
path: "/etc/rancher/rke2/config.yaml"
line: "token: {{ node_token.stdout }}"
- name: Enable and start the RKE2 agent service
systemd:
name: rke2-agent.service
state: started
enabled: yes
```