Removing fluff
This commit is contained in:
parent
9550dbb9b5
commit
6a136b8226
@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
# defaults file for setup
|
|
||||||
LAB_FQDN: lab.local
|
|
@ -1,8 +0,0 @@
|
|||||||
# This config is purely for the default landing page that nginx normally serves
|
|
||||||
# up. The intention is to make Nginx's default page useful
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80 default_server;
|
|
||||||
listen [::]:80 default_server;
|
|
||||||
root /var/www/html;
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
# WARN: this should never be committed to source control
|
|
||||||
# The following is used because we
|
|
||||||
# use DNSMasq for its dead simple nature
|
|
||||||
|
|
||||||
127.0.0.1 localhost
|
|
||||||
127.0.1.1 recycled-lab-host
|
|
||||||
|
|
||||||
# Sugma
|
|
||||||
192.168.1.23 git.lablad
|
|
||||||
192.168.1.23 files.lablad
|
|
||||||
192.168.1.23 main.lablad
|
|
||||||
192.168.1.23 music.lablad
|
|
||||||
192.168.1.1 router
|
|
||||||
|
|
||||||
# The following lines are desirable for IPv6 capable hosts
|
|
||||||
::1 localhost ip6-localhost ip6-loopback
|
|
||||||
ff02::1 ip6-allnodes
|
|
||||||
ff02::2 ip6-allrouters
|
|
@ -1,6 +0,0 @@
|
|||||||
server {
|
|
||||||
server_name files.lablad.net;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:8080;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
# This file pertains to the Gitea service which is served under the FQDN:
|
|
||||||
# git.lablad
|
|
||||||
# The default port is listed under /vars/main.yml as 3000 as GITEA_PUB_PORT
|
|
||||||
|
|
||||||
server {
|
|
||||||
server_name git.lablad.net;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:3000;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
server {
|
|
||||||
root /var/www/html;
|
|
||||||
index index.html;
|
|
||||||
server_name lablad.net;
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
# metrics.lablad
|
|
||||||
|
|
||||||
server {
|
|
||||||
server_name metrics.lablad.net;
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:6000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
server {
|
|
||||||
server_name music.lablad.net;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:4040;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Node Exporter which exposes host metrics for Prometheus
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
WorkingDirectory=/opt/prom-node-exporter
|
|
||||||
Type=simple
|
|
||||||
Restart=simple
|
|
||||||
Restart=always
|
|
||||||
Restart=10
|
|
||||||
ExecStart=/opt/prom-node-exporter/node_exporter
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
server {
|
|
||||||
server_name todo.lablad.net;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:9238;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"backend": {
|
|
||||||
"file": {
|
|
||||||
"path": "/vault/file"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"listener": {
|
|
||||||
"tcp": {
|
|
||||||
"address": "0.0.0.0:{{VAULT_PORT}}",
|
|
||||||
"tls_disable": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ui": true
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
# This file pertains to the Gitea service which is served under the FQDN:
|
|
||||||
# vault.lablad
|
|
||||||
# The default port is listed under /vars/main.yml as 8200 as VAULT_PORT
|
|
||||||
|
|
||||||
server {
|
|
||||||
server_name vault.lablad.net;
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:8200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
galaxy_info:
|
|
||||||
author: shockrah
|
|
||||||
description: This role provides multiple tools for setting up a private lab server
|
|
||||||
company: Personal
|
|
||||||
|
|
||||||
# If the issue tracker for your role is not on github, uncomment the
|
|
||||||
# next line and provide a value
|
|
||||||
# issue_tracker_url: http://example.com/issue/tracker
|
|
||||||
|
|
||||||
license: GPL-3.0-only
|
|
||||||
|
|
||||||
min_ansible_version: 2.1
|
|
||||||
|
|
||||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
|
||||||
# min_ansible_container_version:
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: Ubuntu
|
|
||||||
versions:
|
|
||||||
- Jammy
|
|
||||||
|
|
||||||
galaxy_tags: []
|
|
||||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
|
||||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
|
||||||
# remove the '[]' above, if you add tags to this list.
|
|
||||||
#
|
|
||||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
|
||||||
# Maximum 20 tags per role.
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
- community.docker
|
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: lab
|
|
||||||
become: yes
|
|
||||||
vars:
|
|
||||||
lan_subnet: "192.168.1.0/24"
|
|
||||||
tasks:
|
|
||||||
- name: Enable Firewall rules for basic LAN access
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: '{{ item }}'
|
|
||||||
proto: tcp
|
|
||||||
src: '{{ lan_subnet }}'
|
|
||||||
loop:
|
|
||||||
- 22
|
|
||||||
- 53
|
|
||||||
- 80
|
|
||||||
- 443
|
|
||||||
- name: Enable K3s Ports
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: '{{ item }}'
|
|
||||||
proto: tcp
|
|
||||||
loop:
|
|
||||||
- 6443
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
|||||||
# Simply update all required packages that we have on the system
|
|
||||||
# This also takes care of updating any packages that must updated through means
|
|
||||||
# of Git or some other non-apt method should it be required
|
|
||||||
---
|
|
||||||
- hosts: leftcoastlab
|
|
||||||
become: yes
|
|
||||||
tasks:
|
|
||||||
- name: Distribution Upgrade
|
|
||||||
apt:
|
|
||||||
upgrade: dist
|
|
@ -1,154 +0,0 @@
|
|||||||
---
|
|
||||||
# Auto install from the quickstart
|
|
||||||
# If airgapped, all K3s artifacts are already on the node.
|
|
||||||
- hosts:
|
|
||||||
tasks:
|
|
||||||
- name: Download K3s install script
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: https://get.k3s.io/
|
|
||||||
timeout: 120
|
|
||||||
dest: /usr/local/bin/k3s-install.sh
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: Download K3s binary
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: /usr/local/bin/k3s-install.sh
|
|
||||||
changed_when: true
|
|
||||||
|
|
||||||
- name: Add K3s autocomplete to user bashrc
|
|
||||||
ansible.builtin.lineinfile:
|
|
||||||
path: "~{{ ansible_user }}/.bashrc"
|
|
||||||
regexp: '\.\s+<\(k3s completion bash\)'
|
|
||||||
line: ". <(k3s completion bash) # Added by k3s-ansible"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Enable and check K3s service
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: k3s
|
|
||||||
daemon_reload: true
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Pause to allow first server startup
|
|
||||||
when: (groups['server'] | length) > 1
|
|
||||||
ansible.builtin.pause:
|
|
||||||
seconds: 10
|
|
||||||
|
|
||||||
- name: Check whether kubectl is installed on control node
|
|
||||||
ansible.builtin.command: 'kubectl'
|
|
||||||
register: kubectl_installed
|
|
||||||
ignore_errors: true
|
|
||||||
delegate_to: 127.0.0.1
|
|
||||||
become: false
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Apply K3S kubeconfig to control node
|
|
||||||
when: kubectl_installed.rc == 0
|
|
||||||
block:
|
|
||||||
- name: Copy kubeconfig to control node
|
|
||||||
ansible.builtin.fetch:
|
|
||||||
src: /etc/rancher/k3s/k3s.yaml
|
|
||||||
dest: "{{ kubeconfig }}"
|
|
||||||
flat: true
|
|
||||||
|
|
||||||
- name: Change server address in kubeconfig on control node
|
|
||||||
ansible.builtin.shell: |
|
|
||||||
KUBECONFIG={{ kubeconfig }} kubectl config set-cluster default --server=https://{{ api_endpoint }}:{{ api_port }}
|
|
||||||
delegate_to: 127.0.0.1
|
|
||||||
become: false
|
|
||||||
register: csa_result
|
|
||||||
changed_when:
|
|
||||||
- csa_result.rc == 0
|
|
||||||
|
|
||||||
- name: Setup kubeconfig k3s-ansible context on control node
|
|
||||||
when: kubeconfig != "~/.kube/config"
|
|
||||||
ansible.builtin.replace:
|
|
||||||
path: "{{ kubeconfig }}"
|
|
||||||
regexp: 'name: default'
|
|
||||||
replace: 'name: k3s-ansible'
|
|
||||||
delegate_to: 127.0.0.1
|
|
||||||
become: false
|
|
||||||
|
|
||||||
- name: Merge with any existing kubeconfig on control node
|
|
||||||
when: kubeconfig != "~/.kube/config"
|
|
||||||
ansible.builtin.shell: |
|
|
||||||
TFILE=$(mktemp)
|
|
||||||
KUBECONFIG={{ kubeconfig }} kubectl config set-context k3s-ansible --user=k3s-ansible --cluster=k3s-ansible
|
|
||||||
KUBECONFIG={{ kubeconfig }} kubectl config view --flatten > ${TFILE}
|
|
||||||
mv ${TFILE} {{ kubeconfig }}
|
|
||||||
delegate_to: 127.0.0.1
|
|
||||||
become: false
|
|
||||||
register: mv_result
|
|
||||||
changed_when:
|
|
||||||
- mv_result.rc == 0
|
|
||||||
|
|
||||||
- name: Start other server if any and verify status
|
|
||||||
when:
|
|
||||||
- (groups['server'] | length) > 1
|
|
||||||
- inventory_hostname != groups['server'][0]
|
|
||||||
block:
|
|
||||||
- name: Copy K3s service file [HA]
|
|
||||||
when: groups['server'] | length > 1
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "k3s-ha.service.j2"
|
|
||||||
dest: "{{ systemd_dir }}/k3s.service"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
|
|
||||||
- name: Enable and check K3s service
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: k3s
|
|
||||||
daemon_reload: true
|
|
||||||
state: started
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- name: Verify that all server nodes joined
|
|
||||||
when: (groups['server'] | length) > 1
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: >
|
|
||||||
k3s kubectl get nodes -l "node-role.kubernetes.io/control-plane=true" -o=jsonpath="{.items[*].metadata.name}"
|
|
||||||
register: nodes
|
|
||||||
until: nodes.rc == 0 and (nodes.stdout.split() | length) == (groups['server'] | length)
|
|
||||||
retries: 20
|
|
||||||
delay: 10
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Setup kubectl for user
|
|
||||||
block:
|
|
||||||
- name: Create kubectl symlink
|
|
||||||
when: lookup('fileglob', '/usr/local/bin/kubectl', errors='warn') | length == 0
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: /usr/local/bin/k3s
|
|
||||||
dest: /usr/local/bin/kubectl
|
|
||||||
state: link
|
|
||||||
|
|
||||||
- name: Create directory .kube
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: ~{{ ansible_user }}/.kube
|
|
||||||
state: directory
|
|
||||||
owner: "{{ ansible_user }}"
|
|
||||||
mode: "u=rwx,g=rx,o="
|
|
||||||
|
|
||||||
- name: Copy config file to user home directory
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: /etc/rancher/k3s/k3s.yaml
|
|
||||||
dest: ~{{ ansible_user }}/.kube/config
|
|
||||||
remote_src: true
|
|
||||||
owner: "{{ ansible_user }}"
|
|
||||||
mode: "u=rw,g=,o="
|
|
||||||
|
|
||||||
- name: Configure default KUBECONFIG for user
|
|
||||||
ansible.builtin.lineinfile:
|
|
||||||
path: ~{{ ansible_user }}/.bashrc
|
|
||||||
regexp: 'export KUBECONFIG=~/.kube/config'
|
|
||||||
line: 'export KUBECONFIG=~/.kube/config # Added by k3s-ansible'
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Configure kubectl autocomplete
|
|
||||||
ansible.builtin.lineinfile:
|
|
||||||
path: ~{{ ansible_user }}/.bashrc
|
|
||||||
regexp: '\.\s+<\(kubectl completion bash\)'
|
|
||||||
line: ". <(kubectl completion bash) # Added by k3s-ansible"
|
|
@ -1,19 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: lab
|
|
||||||
tasks:
|
|
||||||
- name: Normal Echo
|
|
||||||
command: echo Quick test of an echo
|
|
||||||
register: normal_echo
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
var: normal_echo.stdout
|
|
||||||
|
|
||||||
- name: Checking Sudo access
|
|
||||||
become: yes
|
|
||||||
command: echo One more test with sudo this time
|
|
||||||
register: sudo_echo
|
|
||||||
|
|
||||||
- debug:
|
|
||||||
var: sudo_echo.stdout
|
|
||||||
- debug:
|
|
||||||
var: sudo_echo.stderr
|
|
@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for setup
|
|
||||||
UBUNTU_CODENAME: jammy
|
|
||||||
GITEA_PUB_PORT: 3000
|
|
||||||
GITEA_SSH_PORT: 2222
|
|
||||||
FILEBROWSER_PORT: 8080
|
|
||||||
LOKI_PORT: 3100
|
|
||||||
GRAFANA_PORT: 6000
|
|
||||||
SUBSONIC_PORT: 4040
|
|
||||||
PROM_PORT: 9090
|
|
||||||
KANBOARD_PORT: 9238
|
|
||||||
KANBOARD_PORT_SSL: 9239
|
|
||||||
VAULT_PORT: 8200
|
|
Loading…
Reference in New Issue
Block a user