7 Commits

Author SHA1 Message Date
765c4daf8f Rename hosts from hosting_* to hosting-* due to corruption 2025-11-29 13:44:00 +07:00
21a1b017ad Add scripts to manage VMs power 2025-11-29 13:38:56 +07:00
6deb9c073a Make adequate .gitignore 2025-11-29 13:29:33 +07:00
3bc8a2ec93 Add Ansible 2025-11-29 13:25:05 +07:00
a98125ce97 Delete Ansible support 2025-11-28 12:19:47 +07:00
020edd51be Add bash ip-fetching of VMs script to virsh/ip-fetching 2025-11-27 07:26:44 +07:00
13177dacd3 Update .gitignore 2025-11-26 09:53:18 +07:00
17 changed files with 99 additions and 14 deletions

7
.gitignore vendored
View File

@@ -1 +1,6 @@
*~* # - Ignore temp vim files
*~* # - Ignore temp vim files
*~
~*
# Ignore credentials
hostlist

2
ansible/ansible.cfg Normal file
View File

@@ -0,0 +1,2 @@
[defaults]
host_key_checking=false

View File

@@ -0,0 +1,8 @@
- name: initialize playbook for hostname and other configurations
hosts: all
gather_facts: false
tasks:
- import_tasks: tasks/ping.yaml
- import_tasks: tasks/change_hostname.yaml

View File

@@ -0,0 +1,8 @@
[all:vars]
ansible_user=user
ansible_ssh_pass=123456
ansible_become_user=root
ansible_become_pass=123456
ansible_become_method=sudo
ansible_sudo_pass=123456
ansible_ssh_executable=/usr/bin/ssh

View File

1
ansible/members_list Symbolic link
View File

@@ -0,0 +1 @@
../hostlist

View File

@@ -0,0 +1,12 @@
- name: clean /etc/hostname
command:
rm -f /etc/hostname
become: true
- name: change hostname
lineinfile:
path: /etc/hostname
line: "{{ inventory_hostname }}"
create: true
become: true

3
ansible/tasks/ping.yaml Normal file
View File

@@ -0,0 +1,3 @@
- name: check connectivity
ping:
register: ping_result

5
bash/ip_fetch/README Normal file
View File

@@ -0,0 +1,5 @@
Use mk_ip-hostname_table.sh only after pinging these domains, which will fill the host's ARP, so
# virsh domifaddr
...will work properly.

View File

@@ -0,0 +1,11 @@
#!/usr/bin/bash
hostlist=""
cat /dev/null > ../../hostlist
for var in $(grep hosting ../../memlist)
do
echo $var ansible_host=$(virsh domifaddr $var --full --source arp | awk '/192.168.0./ {print $4}' | cut -d "/" -f 1) >> ../../hostlist
done

8
bash/virt-virsh/vmcloning-init Normal file → Executable file
View File

@@ -1,10 +1,6 @@
#!/usr/bin/bash
prefix="hosting_"
postfix="_vm"
for var in $(cat ../../memlist)
for var in $(grep hosting ../../memlist)
do
name=$prefix$var$postfix
virt-clone --original generic_hosting --name $name --auto-clone
virt-clone --original generic_hosting --name $var --auto-clone
done

6
bash/virt-virsh/vmreboot Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/bash
for var in $(grep hosting ../../memlist)
do
virsh reboot $var
done

6
bash/virt-virsh/vmshutdown Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/bash
for var in $(grep hosting ../../memlist)
do
virsh shutdown $var
done

6
bash/virt-virsh/vmstart Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/bash
for var in $(grep hosting ../../memlist)
do
virsh start $var
done

8
bash/virt-virsh/vmundefine Normal file → Executable file
View File

@@ -1,10 +1,6 @@
#!/usr/bin/bash
prefix="hosting_"
postfix="_vm"
for var in $(cat ../../memlist)
for var in $(grep hosting ../../memlist)
do
name=$prefix$var$postfix
virsh undefine $name
virsh undefine $var
done

22
memlist
View File

@@ -1 +1,21 @@
antonkaretnikov alexanderboliubysh dorjisandakov sergeymoskalenko katerinenikitina kirillsavchenko nikitamochalov danilreutov anastasiatsygankova egorkaikov stepanyankov daniilivlev mariaborzykh irinakatalanina mariagerasimenko evgeniatroshinovskaya marinerusskikh vsevolodignatenko konstantinbekbauov egorparkhomenko danilmatveyev
hosting-antonkaretnikov
hosting-alexanderboliubysh
hosting-dorjisandakov
hosting-sergeymoskalenko
hosting-katerinenikitina
hosting-kirillsavchenko
hosting-nikitamochalov
hosting-danilreutov
hosting-anastasiatsygankova
hosting-egorkaikov
hosting-stepanyankov
hosting-daniilivlev
hosting-mariaborzykh
hosting-irinakatalanina
hosting-mariagerasimenko
hosting-evgeniatroshinovskaya
hosting-marinerusskikh
hosting-vsevolodignatenko
hosting-konstantinbekbauov
hosting-egorparkhomenko
hosting-danilmatveyev