Ansible ad hoc commands (10+ easy examples) | GoLinuxCloud
golinuxcloud.com › ansLet's try to execute the same command with --become [ansible@controller ~]$ ansible server2 -m command -a "fdisk -l" --become server2 | CHANGED | rc=0 >> Disk /dev/xvda: 10 GiB, 10737418240 bytes, 20971520 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xa323d5eb Device Boot Start End Sectors Size Id Type /dev/xvda1 2048 4095 2048 1M 83 Linux /dev/xvda2 ...