Compare commits

...

17 Commits

Author SHA1 Message Date
jaydee 6e7bae51cd build
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2026-02-26 02:56:30 +01:00
jaydee adb768e3c0 build 2026-02-26 02:53:07 +01:00
jaydee 9f6043344d build 2026-02-26 02:46:52 +01:00
jaydee 77847e2980 build 2026-02-26 02:44:14 +01:00
jaydee 0e5235f477 build 2026-02-26 02:40:47 +01:00
jaydee 53772980c3 build 2026-02-26 02:26:54 +01:00
jaydee 75c9af3b52 build 2026-02-25 22:45:27 +01:00
jaydee 1647152c14 build 2026-02-25 22:36:46 +01:00
jaydee bac47f79de build 2026-02-25 22:31:06 +01:00
jaydee 3ec05fd7e7 build 2026-02-25 22:28:27 +01:00
jaydee 8a5dada497 build 2026-02-25 22:20:47 +01:00
jaydee 0a03645ed9 build 2026-02-25 21:35:42 +01:00
jaydee dce46db94a build 2026-02-25 21:33:38 +01:00
jaydee c32d9fc5d0 build 2026-02-25 21:30:25 +01:00
jaydee c9dc486804 build 2026-02-25 21:28:59 +01:00
jaydee f3454639eb klal 2026-02-25 21:27:45 +01:00
jaydee e9e6b1b08d klal 2026-02-25 21:27:19 +01:00
12 changed files with 193 additions and 21 deletions
+4 -1
View File
@@ -97,4 +97,7 @@
tags: docker_swarm
- name: cloud_init
role: cloud_init
tags: cloud_init
tags: cloud_init
- name: mirror_repo
role: mirror_repo
tags: mirror_repo
+11 -1
View File
@@ -72,7 +72,17 @@ datacenter:
rocky9:
hosts:
rocky9-vm0[1:5].home.lan:
192.168.77.212:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_ssh_user: jd
ansible_ssh_password: q
ansible_become_method: su
ansible_become_password: q
ansible_ssh_pass: q
ansible_become_user: root
rocky10:
hosts:
rocky10-vm0[1:5].home.lan:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_ssh_user: jd
+8
View File
@@ -199,6 +199,14 @@ datacenter:
ansible_ssh_user: jd
ansible_ssh_private_key_file: ssh_key.pem
ansible_user: jd
rocky10:
hosts:
rocky10-vm0[1:9].home.lan:
vars:
ansible_python_interpreter: /usr/bin/python3
ansible_ssh_user: jd
ansible_ssh_private_key_file: ssh_key.pem
ansible_user: jd
alma10:
hosts:
alma10-vm0[1:9].home.lan:
+20 -19
View File
@@ -115,7 +115,7 @@
name: firewalld
state: started
enabled: true
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Open Kubernetes API server port (6443)
ansible.posix.firewalld:
@@ -123,7 +123,7 @@
permanent: yes
state: enabled
immediate: yes
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Open etcd ports (2379-2380)
ansible.posix.firewalld:
@@ -131,7 +131,7 @@
permanent: yes
state: enabled
immediate: yes
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Open kubelet and scheduler ports (10250-10252)
ansible.posix.firewalld:
@@ -139,7 +139,7 @@
permanent: yes
state: enabled
immediate: yes
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Restart containerd
systemd:
@@ -150,8 +150,7 @@
command: kubeadm init --pod-network-cidr=10.244.0.0/16
args:
creates: /etc/kubernetes/admin.conf
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Wait for Kubernetes API to be available
wait_for:
@@ -160,7 +159,7 @@
delay: 10
timeout: 300
state: started
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Create .kube directory
file:
@@ -178,29 +177,30 @@
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: '0644'
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Install Flannel CNI
become_user: "{{ ansible_user }}"
command: kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Get join command
command: kubeadm token create --print-join-command
register: join_command
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Save join command
set_fact:
worker_join_cmd: "{{ join_command.stdout }}"
when: inventory_hostname == 'rocky9-vm01.home.lan'
worker_join_cmd: "sudo {{ join_command.stdout }}"
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Print join command
debug:
msg: "{{ worker_join_cmd }}"
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Wait for Kubernetes API
uri:
@@ -212,10 +212,11 @@
until: api_health.status == 200
retries: 10
delay: 15
when: inventory_hostname == 'rocky9-vm01.home.lan'
when: inventory_hostname.endswith('-vm01.home.lan')
- name: Join cluster
command: "{{ hostvars['rocky9-vm01.home.lan'].worker_join_cmd }}"
args:
creates: /etc/kubernetes/kubelet.conf
when: inventory_hostname != 'rocky9-vm01.home.lan'
- name: Join cluster
command: >-
{{ hostvars['rocky' ~ ansible_distribution_major_version ~ '-vm01.home.lan'].worker_join_cmd }}
args:
creates: /etc/kubernetes/kubelet.conf
when: not inventory_hostname.endswith('-vm01.home.lan')
+38
View File
@@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# defaults file for mirror_repo
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# handlers file for mirror_repo
+35
View File
@@ -0,0 +1,35 @@
#SPDX-License-Identifier: MIT-0
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# 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
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
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: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.
+59
View File
@@ -0,0 +1,59 @@
---
- name: Update Rocky 9 repos to local mirror
become: true
vars:
mirror_url: "http://192.168.77.101:8383/rocky/$releasever"
block:
- name: Facts
ansible.builtin.setup:
when: ansible_facts.architecture is not defined
# - name: Disable mirrorlist in baseos
# ansible.builtin.ini_file:
# path: /etc/yum.repos.d/rocky.repo
# section: baseos
# option: mirrorlist
# state: in
# - name: Set BaseOS baseurl
# ansible.builtin.ini_file:
# path: /etc/yum.repos.d/rocky.repo
# section: baseos
# option: baseurl
# value: "{{ mirror_url }}/baseos/"
- name: Comment mirrorlist in [baseos]
replace:
path: /etc/yum.repos.d/rocky.repo
regexp: '(^\[baseos\][^\[]*?)^mirrorlist=(.*)'
replace: '\1#mirrorlist=\2'
- name: Comment mirrorlist in [appstream]
replace:
path: /etc/yum.repos.d/rocky.repo
regexp: '(^\[appstream\][^\[]*?)^mirrorlist=(.*)'
replace: '\1#mirrorlist=\2'
- name: Set BaseOS baseurl
ansible.builtin.ini_file:
path: /etc/yum.repos.d/rocky.repo
section: baseos
option: baseurl
value: "{{ mirror_url }}/baseos/"
- name: Set AppStream baseurl
ansible.builtin.ini_file:
path: /etc/yum.repos.d/rocky.repo
section: appstream
option: baseurl
value: "{{ mirror_url }}/appstream/"
- name: Clean DNF cache
command: dnf clean all
- name: Rebuild cache
command: dnf makecache
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
localhost
+6
View File
@@ -0,0 +1,6 @@
#SPDX-License-Identifier: MIT-0
---
- hosts: localhost
remote_user: root
roles:
- mirror_repo
+3
View File
@@ -0,0 +1,3 @@
#SPDX-License-Identifier: MIT-0
---
# vars file for mirror_repo