How to create a user with cook cookbook for universal users?

I am trying to add the user 'deploy' to my web_app role using the 'generic-users' recipe with a chef server. I created a deploy.json database containing:

{ "id": "deploy", "group": "deploy", "shell": true } 

I uploaded a data packet to my server.

I also downloaded all my recipes and roles.

Finally, here is my role in the application:

 name "app_server" description "application" run_list( "recipe[generic-users]", ) default_attributes "users" => { "active_groups" => "deploy" } 

When I try to provide a server using this role, I see the following:

 [2012-09-24T22:17:53+01:00] INFO: Active groups: deploy, sysadmin 

But it does not actually create a user of my deployment.

What do I need to do to create it for my user?

In addition, I would like to specify different users and be able to create specific accounts only for certain roles. How can i do this?

+4
source share
2 answers

Have you viewed User Resource and Group Resource ?

You can create groups and users in a declarative way:

 group "magrathean" do gid 42 end user "slartibartfast" do home "/home/slartibartfast" gid 42 shell "/bin/bash" password "hashed password" end 

See the section on hashed passwords.

We run a custom cookbook that allows us to customize specific configuration files, such as .alias , .bashrc and so on.

+7
source

You might be thinking of a “user cookbook,” which is supported by a chef (formerly Opscode) who does what you say. Given that the users of the data are “users” and the “expand” element (using json, as you declared it), it will create the user. It can also remove a user or trigger an action from a user resource mentioned by Tilman. https://github.com/opscode-cookbooks/users

0
source

Source: https://habr.com/ru/post/1436013/


All Articles