knife tidy
knife tidy is a knife plugin that helps clean up stale and unused data in Chef Infra Server backups and on a live Chef Infra Server.
For full documentation, see the knife-tidy GitHub repository.
Install
knife tidy is available as part of the knife-ec-backup Habitat package or as a standalone Ruby gem.
Install the Habitat package (recommended):
hab pkg install chef/knife-ec-backup -bfAfter installation, prefix all
knife tidycommands withhab pkg exec chef/knife-ec-backup.Install the Ruby gem:
gem install knife-tidyAfter installation, run
knife tidycommands directly without thehab pkg execprefix.
Commands
knife tidy server report
Generates a report of stale nodes and unused objects on a live Chef Infra Server.
knife tidy server report [FLAGS]
This command has the following options:
-s,--server-url URL- Chef Infra Server URL (for example,
https://chef.example.com). -u,--user USER- Chef Infra Server admin user (for example,
pivotal). -k,--key KEY- Path to the admin user’s private key.
--node-threshold DAYS- Report nodes that haven’t checked in for this many days (default: 30).
--orgs ORG1,ORG2- Comma-separated list of organizations to report on (default: all).
knife tidy server clean
Removes stale nodes and unused objects from a live Chef Infra Server.
knife tidy server clean [FLAGS]
This command has the following options:
-s,--server-url URL- Chef Infra Server URL.
-u,--user USER- Chef Infra Server admin user.
-k,--key KEY- Path to the admin user’s private key.
--node-threshold DAYS- Remove nodes that haven’t checked in for this many days (default: 30).
--orgs ORG1,ORG2- Comma-separated list of organizations to clean (default: all).
--only-cookbooks- Remove only unused cookbooks.
--only-nodes- Remove only stale nodes.
knife tidy backup clean
Removes unused cookbooks and objects from a local knife-ec-backup backup directory.
knife tidy backup clean [FLAGS]
This command has the following options:
--backup-path PATH- Path to the local backup directory created by
knife ec backup. --orgs ORG1,ORG2- Comma-separated list of organizations to clean (default: all).
Use the Habitat package
Prefix all commands with hab pkg exec chef/knife-ec-backup when using the Habitat package, for example:
hab pkg exec chef/knife-ec-backup knife tidy server report \
--node-threshold 60 \
-s https://chef.example.com \
-u pivotal \
-k /etc/opscode/pivotal.pem