-
-
Save thommay/7ee4556ec46106e391db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plain_pass = Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")["password"] | |
p plain_pass | |
#if unix box | |
if node['platform'] == 'ubuntu' | |
chef_gem "ruby-shadow" | |
package "whois" | |
unless node.attribute? "svc_goagent_pass" | |
require 'digest/sha2' | |
salt = rand(36**8).to_s(36) | |
shadow_hash = plain_pass.crypt("$6$" + salt) | |
node.set['svc_goagent_pass'] = shadow_hash | |
end | |
group "sysadmin" do | |
gid 2000 | |
action :create | |
end | |
#create user | |
user 'svc_goagent' do | |
supports :manage_home => true | |
comment 'Go agent user' | |
uid 6666 | |
gid 2000 | |
home '/home/svc_goagent' | |
shell '/bin/bash' | |
password node['svc_goagent_pass'] | |
end | |
else | |
user 'svc_goagent' do | |
supports :manage_home => true | |
comment 'Go agent user' | |
# uid 6666 | |
# gid 2000 | |
# home '/home/svc_goagent' | |
# shell '/bin/bash' | |
password plain_pass | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment