cookbook 'scaledown_cleanup', '= 0.2.2'
scaledown_cleanup (6) Versions 0.2.2 Follow3
Removes nodes and client keys from chef server upon shutdown (runlevel 0 aka AWS termination)
cookbook 'scaledown_cleanup', '= 0.2.2', :supermarket
knife supermarket install scaledown_cleanup
knife supermarket download scaledown_cleanup
scaledown_cleanup Cookbook
This cookbook grants your nodes remote workstation capabilities(knife) to delete their node ID + client key from a chef server during scaledown. Intended for auto-scaling groups. Probably not the best practice for managing your chef server but YOLO! #You Only Linux Once!
Gives you the choice of SysV init scripts or Systemd units to clean up your chef server.
Requirements
You must set the below attributes. Most importantly you have to set whether your instance uses HVM or PV virutalization and if you want to use SysV or Systemd. Easiest way to use this cookbook is SysV scripts otherwise you'll follow some brief manual steps to set up systemd correctly.
Platform
- This cookbook passed manual tests on Ubuntu 12.04 and Redhat 7.1.
Attributes
- ['chef']['url'] #your chef url
- ['chef']['client_key'] (default is prefered)
- ['chef']['validation_client_name'] (default is prefered)
- ['chef']['validation_key'] (default is prefered)
- ['virtualization_type'] #hvm or pv
- ['systemd'] #true or false
Usage
The easiest way to use this cookbook is via legacy SysV init scripts. To do so set the systemd variable to false (You can still use the sysv scripts even if the operating system's default manager is systemd.)
Otherwise prepare yourselves for the modern age! Systemd usage is a bit more involved. Note whether your OS supports systemd and if its your OS' default system manager. E.g. if you are running Red Hat Enterprise 7.1 then you can set your systemd variable to true without doing any manual work.
*PLEASE NOTE: If you decide to use systemd then you have to ensure systemd is the default service manager for your OS or you will have to personalize this cookbook to install systemd and set as default.
Systemd adoption of major Linux distributions (wikipedia) per version\release date:
|----------------+---------------+--------------|
| OS | Added to repo | Default |
|----------------+---------------+--------------|
|Arch Linux | 01/x/2012 | 10/x/2012 |
|----------------+---------------+--------------|
|Core OS | 07/x/2013 | 10/x/2013 |
|----------------+---------------+--------------|
|Debian | 04/x/2012 | (v8.0) 2015 |
|----------------+---------------+--------------|
|Fedora | (v14) 2010 | (v15) 2011 |
|----------------+---------------+--------------|
|Gentoo Linux | 07/x/2011 | n\a |
|----------------+---------------+--------------|
|Mageia | (v2.0) 2012 | (v2.0) 2012 |
|----------------+---------------+--------------|
|OpenSUSE | (v11.4) 2011| (v12.2) 2012 |
|----------------+---------------+--------------|
|Red Hat | (v7.0) 2014 | (v7.0) 2014 |
|----------------+---------------+--------------|
|SUSE Enterprise | (v12) 2014 | (v12) 2014 |
|----------------+---------------+--------------|
|Ubuntu | (v13.04) 2013 | (v15.04) 2015|
|----------------+---------------+--------------|
*The "added to repo" specifies when systemd became available to an OS via its software repos. "Default" is the first version of the OS that comes stock with systemd as its system manager.
AWS virtualization:
Set the virtualization variable to 'hvm' or 'pv' depending on how your instances are virtualized. (Check AWS ec2 console for this if you don't know.)
It's important to note that different virtualization types get powered off differently by AWS. If your instances are HVM then your instance's OS probably needs the ACPID package installed to receive the power off signal from its hypervisor (aws termination).
Features\ToDos:
- Paramterize more variables.
- Automate OS version\systemd installation to make this cookbook dummy proof.
Contributing:
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
License and Authors
Authors: Brendan Ledoux
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
scaledown_cleanup CHANGELOG
This file is used to list changes made in each version of the scaledown_cleanup cookbook.
0.2.2
- [Brendan Ledoux] - Fixed some stuff foodcritic was complaining about. Used service resource.
0.2.1
- [Brendan Ledoux] - Updated readme, nothing special.
0.2.0
- [Brendan Ledoux] - Added systemd support and HVM support.
0.1.1
- [Brendan Ledoux] - Added dynamic support of debian and rhel families. However This still doesn't work yet. Will be converting to upstart/systemd scripts very shortly.
0.1.0
- [Brendan Ledoux] - Initial release of scaledown_cleanup
Check the Markdown Syntax Guide for help with Markdown.
The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.
Foodcritic Metric
0.2.2 failed this metric
FC023: Prefer conditional attributes: /tmp/cook/3a50124ff9711634161c22cf/scaledown_cleanup/recipes/default.rb:39
0.2.2 failed this metric