Skip to content

Instantly share code, notes, and snippets.

@eheydrick
Last active August 13, 2018 04:50
Show Gist options
  • Save eheydrick/a6ed77f299181d42f9d2679e92fc7c9b to your computer and use it in GitHub Desktop.
Save eheydrick/a6ed77f299181d42f9d2679e92fc7c9b to your computer and use it in GitHub Desktop.
Rename a chef org
It's not officially supported but you can rename an org on Chef Server 12+
# connect to the DB
sudo -u opscode-pgsql /opt/opscode/embedded/bin/psql -U "opscode-pgsql" -d opscode_chef
# get the id of the org you want to change
select * from orgs;
# update the org name
update orgs set name='NEW_ORG_NAME' where id='ORG_ID';
# update the org full_name
update orgs set full_name='NEW_ORG_FULL_NAME' where id='ORG_ID';
## update the read_access_group
# first get the id of the group
select id from groups where name='OLD_ORG_NAME_read_access_group';
# then update the group name
update groups set name='NEW_ORG_NAME_read_access_group' where id='OLD_ORG_GROUP_ID';
Then update all references to the org name in knife.rb and client.rb and anywhere else org name is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment