Chef git sync using knife role create and new workstation setup

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

Here is the steps I took to create a new role (workstation is fedora 23):

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?

Please don’t immediately cross post to both Stack Overflow (https://stackoverflow.com/questions/39973980/chef-git-sync-using-knife-role-create-and-new-workstation-setup) and Discourse. It usually means two different people will take the time to answer you, thus using double the needed volunteer time.

1 Like

Thanks @codechanger for answering on stackoverflow:

“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/.”

Feel free to close this