- name: VMs
hosts: local_vm_ctl
tasks:
- name: Resume VM nodes
shell: |
virsh resume kub3
virsh resume kub2
virsh resume kub1
virsh list --state-paused --state-running
args:
chdir: /home/bi
executable: /bin/bash
environment:
LIBVIRT_DEFAULT_URI: qemu:///system
register: output
- debug: msg="{{ output.stdout_lines | join('\n') }}"
- debug: msg="{{ output.stderr_lines | join('\n') }}"
# - name: pause
# pause:
# prompt: execute commands on the vm servers
- hosts: node_users:nodes:ctl_plane:local_vm_ctl
tasks:
- set_fact: |
bin='/usr/local/bin/scripts'
bk_bin='/mnt/datae/mufl/bin'
KP='/etc/ufw/applications.d/'
#- name: user commands
# hosts: node_users
# tasks:
# - name: sync .vimrc to nodes
# ansible.posix.synchronize:
# src: ../.vimrc
# dest: "/home/{{ ansible_user }}/"
# archive: no
# rsync_opts:
# - "-rt"
# - "--info=stats2"
# register: output
# - debug: msg="{{ output.stdout_lines }}"
#
# - name: sync .vim dir to nodes
# ansible.posix.synchronize:
# src: ../.vim/
# dest: "/home/{{ ansible_user }}/.vim/"
# archive: no
# rsync_opts:
# - "-rt"
# - "--info=stats2"
# register: output
# - debug: msg="{{ output.stdout_lines }}"
#
# - name: bash commands
# ansible.builtin.shell: |
# ls -a
# args:
# chdir: "/home/{{ ansible_user }}"
# executable: /bin/bash
# register: output
# - debug: msg="{{ output.stdout_lines }}"
# - debug: msg="{{ output.stderr_lines }}"
- name: Root commands
hosts: nodes
tasks:
- name: sync local bin to nodes
ansible.posix.synchronize:
src: ./
dest: "{{ bin }}"
archive: no
rsync_opts:
- "-rpt"
- "--delete"
- "--info=stats2"
register: output
- debug: msg="{{ output.stdout_lines | join('\n') }}"
# - name: Bash commands
# ansible.builtin.shell: |
# hwclock -s
# args:
# chdir: "{{ bin }}"
# executable: /bin/bash
# async: 2000
# poll: 3
# register: output
# - debug: msg="{{ output.stdout_lines | join('\n') }}"
# - debug: msg="{{ output.stderr_lines | join('\n') }}"
#- name: Run kubectl or scripts on the control plane
# hosts: ctl_plane
# tasks:
#
# - name: run ssh2.sh
# ansible.builtin.shell: |
# ssh2.sh
# args:
# chdir: "{{ bin }}"
# executable: /bin/bash
# async: 2000
# poll: 3
# register: output
# - debug: msg="{{ output.stdout_lines | join('\n') }}"
# - debug: msg="{{ output.stderr_lines | join('\n') }}"
- name: Local sync
hosts: local_vm_ctl
tasks:
- name: Sync bin backup on VM-host
ansible.posix.synchronize:
src: ./
dest: "{{ bk_bin }}/"
archive: no
rsync_opts:
- "-rpt"
- "--delete"
- "--info=stats2"
register: output
- debug: msg="{{ output.stdout_lines | join('\n') }}"
- name: VMs
hosts: local_vm_ctl
tasks:
- name: Pause VM nodes
shell: |
virsh suspend kub3
virsh suspend kub2
virsh suspend kub1
virsh list --state-paused --state-running
args:
chdir: /home/bi
executable: /bin/bash
environment:
LIBVIRT_DEFAULT_URI: qemu:///system
register: output
- debug: msg="{{ output.stdout_lines | join('\n') }}"
- debug: msg="{{ output.stderr_lines | join('\n') }}"