I have a linux user with various folders and files in their home:
User: foo
/home/foo/somefolder
I want to rename this user and move their home directory to end up with:
User: bar
/home/bar/somefolder
I would do this by hand with
sudo usermod --login new_username old_username
Followed by
sudo usermod --home /home/new_username --move-home new_username
Can I create an Ansible role to do this for me?
In Ansible's user module I can find:
home Optionally set the user's home directory.
move_home If set to yes when used with home=, attempt to move the user's old home directory to the specified directory if it isn't there already and the old home exists.
This sounds like a modify is intended, but how do specify the rename itself?