First commit
This commit is contained in:
51
ansible/k3s/configure_disk.yml
Normal file
51
ansible/k3s/configure_disk.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
- name: Configurar disco adicional en las VMs
|
||||
hosts: k3s_cluster
|
||||
become: yes
|
||||
collections:
|
||||
- community.general
|
||||
|
||||
tasks:
|
||||
- name: Verificar si el disco /dev/vdb existe
|
||||
ansible.builtin.stat:
|
||||
path: /dev/vdb
|
||||
register: disk_check
|
||||
|
||||
- name: Crear particion de datos en disco /dev/vdb
|
||||
community.general.parted:
|
||||
device: /dev/vdb
|
||||
fs_type: ext4
|
||||
label: gpt
|
||||
number: 1
|
||||
state: present
|
||||
when: disk_check.stat.exists
|
||||
|
||||
- name: Formatear la partición en ext4
|
||||
community.general.filesystem:
|
||||
fstype: ext4
|
||||
dev: /dev/vdb1
|
||||
when: disk_check.stat.exists
|
||||
|
||||
- name: Obtener UUID del disco
|
||||
ansible.builtin.command: blkid -s UUID -o value /dev/vdb1
|
||||
register: disk_uuid
|
||||
when: disk_check.stat.exists
|
||||
|
||||
- name: Montar disco en /mnt/data
|
||||
ansible.posix.mount:
|
||||
path: /mnt/data
|
||||
src: UUID={{ disk_uuid.stdout }}
|
||||
fstype: ext4
|
||||
state: "mounted"
|
||||
when: disk_check.stat.exists
|
||||
|
||||
- name: Crear carpeta para longhorn
|
||||
ansible.builtin.file:
|
||||
path: /mnt/data/longhorn
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Crear carpeta para postgres
|
||||
ansible.builtin.file:
|
||||
path: /mnt/data/postgres
|
||||
state: directory
|
||||
mode: '0755'
|
||||
Reference in New Issue
Block a user