I have an Ubuntu server, with 2 drives /dev/sdb
and /dev/sdc
. The OS is installed under /dev/sdb
. Now, I am trying to write an Ansible playbook which will identify whether the particular partition contains the OS. I tried using the lsblk
command which returns that the drive /dev/sdb
is partitioned. But no partition table exists for /dev/sdc/
.
Any examples on how to achieve this? My current playbook looks like:
- hosts: localhost
tasks:
- name: Get list of mounted hard drives
command: 'lsblk'
register: result
- name: Create variable block_devices
set_fact:
block_devices: "{{ result.stdout_lines }}"
- debug:
var: block_devices
This playbook returns the available partitions. From this output how to implement the OS installation check?