Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgreensmith/knife-hosts
https://github.com/mgreensmith/knife-hosts
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mgreensmith/knife-hosts
- Owner: mgreensmith
- License: other
- Created: 2013-01-09T07:05:01.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-07-19T07:10:23.000Z (over 11 years ago)
- Last Synced: 2024-09-20T13:05:37.373Z (about 2 months ago)
- Language: Ruby
- Size: 125 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Gem Version](https://badge.fury.io/rb/knife-hosts.png)](http://badge.fury.io/rb/knife-hosts)
# Knife::Hosts
Knife plugin to print node names and IPs formatted for inclusion in a hosts file.
## Installation
Add this line to your application's Gemfile:
gem 'knife-hosts'
And then execute:
$ bundle
Or install it yourself as:
$ gem install knife-hosts
## Usage
```
knife hosts [-di] [QUERY]
```Copy the output to your `/etc/hosts`
Use an optional chef search query to limit the output.We add friendly aliases a couple of ways:
1. We strip trailing domain elements (default 2) from the end of node names and add an alias:
```
10.1.1.1 foo.bar.com foo
```
You can override the number of domain elements stripped with the `-d [N]`, `--drop-elements [N]` option, and disable it completely with `-d 0`2. Rackspace prefaces the hostname of physical nodes with an identifying number, eg `000000-foo.bar.com`
We strip this number and add the leftover host name as an alias, eg:
```
10.1.1.1 000000-foo.bar.com foo.bar.com
```
If you happen to name your nodes with a leading number and then a hyphen, you may want to disable this behavior with `-i`, `--ignore-strip-rackspace` option.## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request