Ansible Unlock Accounts
Hello There!
I am trying to unlock accounts using ansible, Below is the playbook i am using. and the error i am getting. Any idea? Code:
--- Code:
[root@localhost playbooks]# ansible-playbook unlock.yml |
Have you checked the accounts manually; outside of ansible?
Both accounts exists? Both accounts are locked? In another terminal window, tail -f /var/log/messages (or equivalent file for your OS)... Does that give you a better hint? |
Quote:
Is that something you are indeed trying to achieve? |
I don't understand the logic asv is employing - I'm guessing he's trying to say exactly the opposite.
First question is: what distribution are you using? Different distributions output quite different things when using passwd --status. On ubuntu you won't get the "locked" string as far as I can tell, for instance. |
You're supposed to be telling us what distro you're using, but let's assume it's redhat based. On Centos "locked" is going to show up in passwd --status if that's the case. So I'm guessing you're using such a distro anyhow.
Your first problem is that grep is going to output an error code of 1 if it doesn't find the string you're searching for. Ansible doesn't tell the difference between different types of errors if you don't tell it explicitly to do so, so it's simply going to say that the command failed. This is how it should work. That's why the 'ignore_errors' directive shouldn't be commented, so that you can move further if you come across a user who's already unlocked. You're clearly trying to run a playbook without knowing the basics of ansible, so I'd suggest starting with https://serversforhackers.com/c/an-ansible2-tutorial When you reach - debug: var=locked_output.results you'll have seen that this variable is actually a whole array of things: Quote:
This is why you eventually get: Quote:
|
All times are GMT -5. The time now is 04:43 PM. |