homeserver/roles/mrlesmithjr.ansible-manage-lvm/tasks/centos.yml

70 lines
1.6 KiB
YAML
Raw Normal View History

---
- name: centos | installing lvm2 and sg3_utils
package:
name:
- lvm2
- sg3_utils
state: present
become: true
- include_tasks: amazon.yml
when: ansible_facts.system_vendor == 'Amazon EC2'
- name: centos | debug lvg
debug:
var: lv
verbosity: 3
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
loop_control:
loop_var: lv
- name: centos | install xfs tools
package:
name: "xfsprogs"
state: "present"
become: true
loop: "{{ lookup('subelements', lvm_groups, 'lvnames', {'skip_missing': True}, wantlist=True) }}"
loop_control:
loop_var: lv
when:
- lv.1 is defined
- lv.1 != "None"
- lv.1.filesystem is defined
- lv.1.filesystem == "xfs"
- lv.1.create is defined
- lv.1.create|bool
- name: centos | check for scsi adapters
find:
paths: "/sys/class/scsi_host"
file_type: any
become: true
register: scsi_adapters
- block:
- name: centos | installing sg3_utils
package:
name: sg3_utils
state: present
become: true
- name: centos | checking for scsi devices
command: sg_scan
become: true
register: scsi_devices
changed_when: false
- name: centos | rescanning for new disks
command: "{{ rescan_scsi_command }}"
become: true
changed_when: false
when: scsi_devices.stdout|length > 0
- name: centos | rescanning for resized disks
command: "{{ rescan_scsi_command }} -s"
become: true
changed_when: false
when: scsi_devices.stdout|length > 0
when: scsi_adapters.matched > 0