Compare commits
13 Commits
7a61866736
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
069e72aff2
|
|||
|
7e475c9325
|
|||
|
22ff568c83
|
|||
|
7172f6fd01
|
|||
|
d23fd388bc
|
|||
|
7d64db8dcb
|
|||
|
393719fd56
|
|||
|
91543507dd
|
|||
|
6643f44ae8
|
|||
|
d936bc22b0
|
|||
|
48f62ed2e1
|
|||
|
ce2e51bf06
|
|||
|
b6ccbcde2c
|
6
es.ini
Normal file
6
es.ini
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[waykey]
|
||||||
|
192.168.1.34
|
||||||
|
192.168.1.36
|
||||||
|
192.168.1.37
|
||||||
|
192.168.1.47
|
||||||
|
192.168.1.49
|
||||||
49
gather-info.yaml
Normal file
49
gather-info.yaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
- name: Gather and write system information to CSV on control node
|
||||||
|
hosts: all
|
||||||
|
gather_facts: no
|
||||||
|
user: root
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: Gather system information
|
||||||
|
setup:
|
||||||
|
gather_subset:
|
||||||
|
- 'all'
|
||||||
|
register: system_info
|
||||||
|
|
||||||
|
- name: Set extended system facts
|
||||||
|
set_fact:
|
||||||
|
system_summary:
|
||||||
|
hostname: "{{ system_info.ansible_facts.ansible_hostname }}"
|
||||||
|
ipv4_addresses: "{{ system_info.ansible_facts.ansible_all_ipv4_addresses | join(',') }}"
|
||||||
|
ipv6_addresses: "{{ system_info.ansible_facts.ansible_all_ipv6_addresses | join(',') }}"
|
||||||
|
cpu: "{{ system_info.ansible_facts.ansible_processor | join(',') }}"
|
||||||
|
total_memory_mb: "{{ system_info.ansible_facts.ansible_memtotal_mb }}"
|
||||||
|
os_distribution: "{{ system_info.ansible_facts.ansible_distribution }}"
|
||||||
|
os_version: "{{ system_info.ansible_facts.ansible_distribution_version }}"
|
||||||
|
os_family: "{{ system_info.ansible_facts.ansible_os_family }}"
|
||||||
|
architecture: "{{ system_info.ansible_facts.ansible_architecture }}"
|
||||||
|
kernel: "{{ system_info.ansible_facts.ansible_kernel }}"
|
||||||
|
uptime_seconds: "{{ system_info.ansible_facts.ansible_uptime_seconds }}"
|
||||||
|
default_ipv4: "{{ system_info.ansible_facts.ansible_default_ipv4.address }}"
|
||||||
|
default_ipv6: "{{ system_info.ansible_facts.ansible_default_ipv6.address if system_info.ansible_facts.ansible_default_ipv6 is defined else '' }}"
|
||||||
|
mounts: "{{ system_info.ansible_facts.ansible_mounts | map(attribute='mount') | join(',') }}"
|
||||||
|
interfaces: "{{ system_info.ansible_facts.ansible_interfaces | join(',') }}"
|
||||||
|
gateway_ipv4: "{{ system_info.ansible_facts.ansible_default_ipv4.gateway }}"
|
||||||
|
gateway_ipv6: "{{ system_info.ansible_facts.ansible_default_ipv6.gateway if system_info.ansible_facts.ansible_default_ipv6 is defined else '' }}"
|
||||||
|
|
||||||
|
- name: Ensure CSV file exists and write header on control node
|
||||||
|
local_action:
|
||||||
|
module: lineinfile
|
||||||
|
path: ./system_info.csv
|
||||||
|
line: '"hostname","ipv4_addresses","ipv6_addresses","cpu","total_memory_mb","os_distribution","os_version","os_family","architecture","kernel","uptime_seconds","default_ipv4","default_ipv6","mounts","interfaces","gateway_ipv4","gateway_ipv6"'
|
||||||
|
create: yes
|
||||||
|
state: present
|
||||||
|
run_once: true # Only run once to write the header
|
||||||
|
|
||||||
|
- name: Append system information to CSV on control node
|
||||||
|
local_action:
|
||||||
|
module: lineinfile
|
||||||
|
path: ./system_info.csv
|
||||||
|
line: '"{{ system_summary.hostname }}","{{ system_summary.ipv4_addresses }}","{{ system_summary.ipv6_addresses }}","{{ system_summary.cpu }}","{{ system_summary.total_memory_mb }}","{{ system_summary.os_distribution }}","{{ system_summary.os_version }}","{{ system_summary.os_family }}","{{ system_summary.architecture }}","{{ system_summary.kernel }}","{{ system_summary.uptime_seconds }}","{{ system_summary.default_ipv4 }}","{{ system_summary.default_ipv6 }}","{{ system_summary.mounts }}","{{ system_summary.interfaces }}","{{ system_summary.gateway_ipv4 }}","{{ system_summary.gateway_ipv6 }}"'
|
||||||
|
create: yes
|
||||||
|
insertafter: EOF
|
||||||
17
install-deno.yaml
Normal file
17
install-deno.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
- name: Install deno from IPFS gateway
|
||||||
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
user: root
|
||||||
|
tasks:
|
||||||
|
- name: Download the deno file from IPFS gateway
|
||||||
|
get_url:
|
||||||
|
url: http://192.168.1.13:8080/ipfs/QmawC2DzXqCjesHMMExuLgYxpN18SHmioKzgaD5hskZvur
|
||||||
|
dest: /usr/bin/deno
|
||||||
|
timeout: 300
|
||||||
|
|
||||||
|
|
||||||
|
- name: Set execute permission on deno
|
||||||
|
file:
|
||||||
|
path: /usr/bin/deno
|
||||||
|
mode: '0755'
|
||||||
|
state: file
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
- name: Download the deb file from IPFS gateway
|
- name: Download the deb file from IPFS gateway
|
||||||
get_url:
|
get_url:
|
||||||
url: https://waykey.net:7999/ipfs/QmXAvSfitFCGw2N4YC3R8sJd6dBBhW21rCRhvEpzyfjGW9
|
url: https://waykey.net/ipfs/QmXAvSfitFCGw2N4YC3R8sJd6dBBhW21rCRhvEpzyfjGW9
|
||||||
dest: /tmp/ipmi-exporter.deb
|
dest: /tmp/ipmi-exporter.deb
|
||||||
|
|
||||||
- name: Install the deb package
|
- name: Install the deb package
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
tasks:
|
tasks:
|
||||||
- name: Download the deb file from IPFS gateway
|
- name: Download the deb file from IPFS gateway
|
||||||
get_url:
|
get_url:
|
||||||
url: https://waykey.net:7999/ipfs/QmeexpjtcrKDQhFdvMyVqQuBf7fNVurkzC1YWkFFDumDgj
|
url: https://waykey.net/ipfs/QmeexpjtcrKDQhFdvMyVqQuBf7fNVurkzC1YWkFFDumDgj
|
||||||
dest: /tmp/node-exporter.deb
|
dest: /tmp/node-exporter.deb
|
||||||
|
|
||||||
- name: Install the deb package
|
- name: Install the deb package
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
192.168.1.12
|
192.168.1.12
|
||||||
192.168.1.13
|
192.168.1.13
|
||||||
192.168.1.15
|
192.168.1.15
|
||||||
|
192.168.1.16
|
||||||
192.168.1.19
|
192.168.1.19
|
||||||
192.168.1.20
|
192.168.1.20
|
||||||
192.168.1.32
|
192.168.1.32
|
||||||
@@ -13,14 +14,38 @@
|
|||||||
192.168.1.35
|
192.168.1.35
|
||||||
192.168.1.36
|
192.168.1.36
|
||||||
192.168.1.37
|
192.168.1.37
|
||||||
|
192.168.1.41
|
||||||
192.168.1.42
|
192.168.1.42
|
||||||
192.168.1.43
|
192.168.1.43
|
||||||
192.168.1.44
|
192.168.1.44
|
||||||
|
192.168.1.45
|
||||||
192.168.1.47
|
192.168.1.47
|
||||||
192.168.1.48
|
192.168.1.48
|
||||||
192.168.1.49
|
192.168.1.49
|
||||||
192.168.1.50
|
192.168.1.50
|
||||||
192.168.1.52
|
192.168.1.52
|
||||||
192.168.1.53
|
192.168.1.53
|
||||||
|
192.168.1.54
|
||||||
|
192.168.1.55
|
||||||
|
192.168.1.56
|
||||||
|
192.168.1.57
|
||||||
|
192.168.1.58
|
||||||
|
192.168.1.59
|
||||||
|
192.168.1.60
|
||||||
|
192.168.1.61
|
||||||
|
192.168.1.62
|
||||||
|
192.168.1.63
|
||||||
|
192.168.1.64
|
||||||
|
192.168.1.65
|
||||||
|
192.168.1.66
|
||||||
|
192.168.1.67
|
||||||
|
192.168.1.68
|
||||||
|
192.168.1.69
|
||||||
|
192.168.1.70
|
||||||
|
192.168.1.71
|
||||||
|
192.168.1.72
|
||||||
|
192.168.1.74
|
||||||
|
192.168.1.75
|
||||||
|
192.168.1.76
|
||||||
|
192.168.1.77
|
||||||
192.168.1.91
|
192.168.1.91
|
||||||
|
|
||||||
|
|||||||
38
set-contained-proxy.yaml
Normal file
38
set-contained-proxy.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
- name: Configure HTTP proxy for containerd
|
||||||
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
user: root
|
||||||
|
tasks:
|
||||||
|
- name: Check if kubelet service is running
|
||||||
|
shell: systemctl is-active kubelet
|
||||||
|
register: kubelet_status
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Create directory for containerd service override
|
||||||
|
file:
|
||||||
|
path: /etc/systemd/system/containerd.service.d
|
||||||
|
state: directory
|
||||||
|
when: kubelet_status.stdout == "active"
|
||||||
|
|
||||||
|
- name: Create or edit http-proxy.conf for containerd
|
||||||
|
copy:
|
||||||
|
dest: /etc/systemd/system/containerd.service.d/http-proxy.conf
|
||||||
|
content: |
|
||||||
|
[Service]
|
||||||
|
Environment="HTTP_PROXY=http://192.168.1.38:7890"
|
||||||
|
Environment="HTTPS_PROXY=http://192.168.1.38:7890"
|
||||||
|
Environment="NO_PROXY=localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,.svc,.cluster.local,10.244.0.0/16,.waykey.net,.k8s.local,.media.beer"
|
||||||
|
when: kubelet_status.stdout == "active"
|
||||||
|
|
||||||
|
- name: Reload systemd daemon
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
when: kubelet_status.stdout == "active"
|
||||||
|
|
||||||
|
- name: Restart containerd and kubelet services
|
||||||
|
systemd:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: restarted
|
||||||
|
loop:
|
||||||
|
- containerd
|
||||||
|
- kubelet
|
||||||
|
when: kubelet_status.stdout == "active"
|
||||||
9
shutdown.yaml
Normal file
9
shutdown.yaml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- name: Shutdown remote servers
|
||||||
|
hosts: all # 或者指定特定的主机组
|
||||||
|
become: yes # 提升权限为root用户
|
||||||
|
tasks:
|
||||||
|
- name: Shutdown the server
|
||||||
|
command: /sbin/shutdown -h now
|
||||||
|
async: 1
|
||||||
|
poll: 0
|
||||||
|
ignore_errors: true # 忽略错误以防止连接中断后任务失败
|
||||||
99
system_info.csv
Normal file
99
system_info.csv
Normal file
File diff suppressed because one or more lines are too long
7
zfs-scrub.yaml
Normal file
7
zfs-scrub.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
- name: Start ZFS scrub
|
||||||
|
hosts: all
|
||||||
|
become: yes
|
||||||
|
user: root
|
||||||
|
tasks:
|
||||||
|
- name: Get list of ZFS pools
|
||||||
|
shell: zpool list -H -o name | xargs -n1 zpool scrub
|
||||||
Reference in New Issue
Block a user