Ask Your Question

How can I read password-hash from a file and assign to a user.

asked 2016-04-19 02:49:34 -0600

Roland800 gravatar image

Normally I put the a pw-hash in the shadow-file with

user { "alibaba": ensure => 'present', password => '$6$qfPDlAej83p$cj2nc1NjbKjhL42Mo/3Uia4NqD4dIB3ouVeI/tSG92UqH5cKUKI' }

But now I want to read out the string from a file /home/alibaba/.alibaba-sha512, containing the new hash. I can't find a function in puppet, so I can realize this. (Using a variable?) Thank you for the help.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-04-19 16:30:58 -0600

lavaman gravatar image

If the file you want to read from is on the agent machine, you'll have to use a custom fact:

That is how the master gets information from the agent machines.

If that file is on the master, you would create a custom function to read it:

edit flag offensive delete link more

answered 2016-04-20 07:44:34 -0600

DarylW gravatar image

If you are managing things with puppet, it would make more sense for you to put the password hash into hiera, and manage the shadow-file and the other resources with that being your source of truth..

Reading state from machines for doing other incidental things is the path to madness... but yes, it can be done with a custom facter fact. ;)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-04-19 02:49:34 -0600

Seen: 211 times

Last updated: Apr 20 '16