Provisioning of a custom cookbook fails on a users_manage resource:
users_manage "www-data" do action :create end
The reason is that this user is currently running the nginx worker process.
A simple fix should be to stop the service while users_manage is running. What is the best way to do this in Chef?
One solution may be something like:
A better way would probably be to backfill the data bag for the
users
cookbook to keep it in sync with the current system so it won't change anything, given that you first call theusers
cookbook and later install nginx (in the run_list).An even better way would be to add your custom users to the www-group and leave nginx alone. Nginx's user/group memberships are defined by the package/distro and various things assume specific settings, e.g. logrotate cronjobs. If you change that, you'll probably gonna have a bad timeā¦