You could try generating the password ciphertext using Ruby in your cookbook:
require 'digest/sha2'
password = "pass@123"
salt = rand(36**8).to_s(36)
shadow_hash = password.crypt("$6$" + salt)
After running this, shadow_hash
contains the following string:
$6$vf1ehwzs$VAxaPBAeXjvEMboee.xbJgMOXlCrJ.eJDPkqP.16fGyAqjq1IDkh0OpEXFRo1W04G7tl02YMQz7dKmGKLVaRd/
You can then use it in the user
resource:
user "random" do
supports :manage_home => true
comment "Random User"
uid 1234
gid "users"
home "/home/random"
shell "/bin/bash"
password shadow_hash
end
From http://judepereira.com/blog/use-ruby-to-generate-your-shadow-password/