W Khan
W Khan

Reputation: 120

Chef git sync using knife role create and new workstation setup

I have a simple question about keeping my chef-repo in sync with what's on the server.

Here is the steps I took to create a new role:

cd /chef-repo/roles
knife role create windows_base

Then when I do:

knife role list

I can see the new windows_base role appearing, however I do not see a json file created under roles. When I push this to git this file wont exist?

So when I go onto a different workstation and pull everything to that workstation, the role windows_base wont exist. Why is there no json file created when I do knife role create windows_base and there obviously is when creating a role manually using a .rb file.

Simply put - how can I keep my chef-repo in sync with git if there is no file created and the role is directly created on the server?

Upvotes: 0

Views: 60

Answers (1)

coderanger
coderanger

Reputation: 54251

The knife * create commands are issuing the create directly against the API. We don't offer generator commands (which live under chef generate) for roles, you'll just have to create the file yourself. In general you probably don't want to use the create commands, instead make the files you want and then knife upload roles/.

Upvotes: 2

Related Questions