Hi Team,
When i try to shutdown the connected node using ansible am getting the below error kindly assist
128 ansible iaf -m shell “/usr/sbin/shutdown -h now” -b
129 ansible iaf -m shell “/usr/sbin/shutdown -h now” --become
130 ansible iaf -m shell ‘/usr/sbin/shutdown -h now’ --become
154 ansible iaf -a “/usr/sbin/shutdown -h now” --become
155 ansible iaf -a “sudo /usr/sbin/shutdown -h now”
for the 155 command am getting message as user is not in the sudoers list
but i have already made an entry in sudoers file and also added to wheel group
cat /etc/group |grep wheel
wheel:x:10:tester
tester ALL=NOPASSWD: ALL
When i try to shutdown the connected node using ansible am getting
the below error kindly assist
128 ansible iaf -m shell "/usr/sbin/shutdown -h now" -b
129 ansible iaf -m shell "/usr/sbin/shutdown -h now" --become
130 ansible iaf -m shell '/usr/sbin/shutdown -h now' --become
None of these are valid, they are missing -a, and Ansible should write an error message.
154 ansible iaf -a "/usr/sbin/shutdown -h now" --become
This one has the correct syntax.
155 ansible iaf -a "sudo /usr/sbin/shutdown -h now"
This should work, but I would recommend the previous one.
for the 155 command am getting message as user is not in the
sudoers list
but i have already made an entry in sudoers file and also added
to wheel group
cat /etc/group |grep wheel
wheel:x:10:tester
tester ALL=NOPASSWD: ALL
Does sudo work when you login manually and test?
Are you sure you are using the user tester in Ansible?
And you need to run ansible with -vvvv to get some more verbose output about what is happing.
Hi Kai,
Please find the o/p below
[tester@ansi root]$ ansible iaf -a “sudo /usr/sbin/shutdown -h now” ^C
[tester@ansi root]$ sudo lvdisplay
— Logical volume —
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID RkK5xV-p9HC-Em5C-8Ryx-8dVU-Pp9i-Uj1WvB
LV Write Access read/write
LV Creation host, time localhost, 2018-05-18 02:03:44 +0530
LV Status available
open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
— Logical volume —
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID 1KyJY9-BLjP-HvbH-GjgH-UTNA-9qvS-deTXGq
LV Write Access read/write
LV Creation host, time localhost, 2018-05-18 02:03:44 +0530
LV Status available
open 1
LV Size <17.47 GiB
Current LE 4472
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0