Code:
$ ansible -a "\lsblk -e 7 -o name,size,type,fstype,mountpoint" cur |egrep 'rc=|crypt'
hadar | CHANGED | rc=0 >>
regulus | CHANGED | rc=0 >>
romulus | CHANGED | rc=0 >>
zcs45 | CHANGED | rc=0 >>
istar | CHANGED | rc=0 >>
spam3 | CHANGED | rc=0 >>
blog44 | CHANGED | rc=0 >>
xen41 | CHANGED | rc=0 >>
posc | CHANGED | rc=0 >>
└─sda3 464.6G part crypto_LUKS
└─sda3_crypt 464.6G crypt LVM2_member
osmc | CHANGED | rc=0 >>
nextcloud | CHANGED | rc=0 >>
wouldn't take much to turn that into a text/CSV/DB file with:
{hostname} = LUKS|NOLUKS
for every host.
As you can see - only 1 system here uses LUKS, posc.
Or use
Code:
$ ansible -m setup cur |tee /tmp/ansible-facts.txt
to get all the details that ansible's "setup" module knows about each system. It boggles the mind how much it knows, BTW.
Searching on "LUKS" ....
Code:
"ansible_device_links": {
"ids": {
"dm-0": [
"dm-name-sda3_crypt",
"dm-uuid-CRYPT-LUKS1-f67e63db81114836aff8f2dcb9bb32fc-sda3_crypt",
"lvm-pv-uuid-M3j3pO-VrTd-DmUc-kjwt-lA2B-52Se-a52mf8"
and elsewhere
Code:
"links": {
"ids": [
"dm-name-sda3_crypt",
"dm-uuid-CRYPT-LUKS1-f67e63db81114836aff8f2dcb9bb32fc-sda3_crypt",
"lvm-pv-uuid-M3j3pO-VrTd-DmUc-kjwt-lA2B-52Se-a52mf8"
],
and elsewhere using "crypt"
Code:
"sda3": {
"holders": [
"sda3_crypt"
],
Ansible is very handy for getting lots of information with 1 command from 1-50,000 systems.
It is also useful for pushing consistent configuration changes to specific types of systems. Say you want all your DBMS systems to have a specific setting, that's a perfect task for Ansible.
Bookmarks