chef/cookbooks/hostsfile/metadata.json

1 line
6.3 KiB
JSON

{"name":"hostsfile","version":"3.0.1","description":"Provides an resource for managing the /etc/hosts file","long_description":"# hostsfile cookbook\n\n[![Build Status](https://travis-ci.org/customink-webops/hostsfile.svg?branch=master)](https://travis-ci.org/customink-webops/hostsfile)\n\n`hostsfile` provides a resource for managing your `/etc/hosts` (or Windows equivalent) file using Chef.\n\n## Requirements\n\n- Chef 12.7 or higher\n\n## Attributes\n\nAttribute | Description | Example | Default\n---------- | ------------------------------------------------------- | -------------------- | ------------------------------------\nip_address | (name attribute) the IP address for the entry | 1.2.3.4 |\nhostname | (required) the hostname associated with the entry | example.com |\nunique | remove any existing entries that have the same hostname | true | false\naliases | array of aliases for the entry | ['www.example.com'] | []\ncomment | a comment to append to the end of the entry | 'interal DNS server' | nil\npriority | the relative position of this entry | 20 | (varies, see **Priorities** section)\n\n## Actions\n\n**Please note**: In `v0.1.2`, specifying a hostname or alias that existed in another automatically removed that hostname from the other entry before. In `v2.1.0`, the `unique` option was added to give the user case-by-case control of this behavior. For example, given an `/etc/hosts` file that contains:\n\n```\n1.2.3.4 example.com www.example.com\n```\n\nwhen the Chef recipe below is converged:\n\n```ruby\nhostsfile_entry '2.3.4.5' do\n hostname 'www.example.com'\n unique true\nend\n```\n\nthen the `/etc/hosts` file will look like this:\n\n```\n1.2.3.4 example.com\n2.3.4.5 www.example.com\n```\n\nNot specifying the `unique` parameter will result in duplicate hostsfile entries.\n\n### `create`\n\nCreates a new hosts file entry. If an entry already exists, it will be overwritten by this one.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n hostname 'example.com'\n action :create\nend\n```\n\nThis will create an entry like this:\n\n```\n1.2.3.4 example.com\n```\n\n### `create_if_missing`\n\nCreate a new hosts file entry, only if one does not already exist for the given IP address. If one exists, this does nothing.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n hostname 'example.com'\n action :create_if_missing\nend\n```\n\n### `append`\n\nAppend a hostname or alias to an existing record. If the given IP address doesn't already exist in the hostsfile, this method behaves the same as create. Otherwise, it will append the additional hostname and aliases to the existing entry.\n\n```\n1.2.3.4 example.com www.example.com # Created by Chef\n```\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n hostname 'www2.example.com'\n aliases ['foo.com', 'foobar.com']\n comment 'Append by Recipe X'\n action :append\nend\n```\n\nwould yield:\n\n```\n1.2.3.4 example.com www.example.com www2.example.com foo.com foobar.com # Created by Chef, Appended by Recipe X\n```\n\n### `update`\n\nUpdates the given hosts file entry. Does nothing if the entry does not exist.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n hostname 'example.com'\n comment 'Update by Chef'\n action :update\nend\n```\n\nThis will create an entry like this:\n\n```\n1.2.3.4 example # Updated by Chef\n```\n\n### `remove`\n\nRemoves an entry from the hosts file. Does nothing if the entry does not exist.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n action :remove\nend\n```\n\nThis will remove the entry for `1.2.3.4`.\n\n## Usage\n\nIf you're using [Berkshelf](http://berkshelf.com/), just add `hostsfile` to your `Berksfile`:\n\n```ruby\ncookbook 'hostsfile'\n```\n\nOtherwise, install the cookbook from the community site:\n\n```\nknife cookbook site install hostsfile\n```\n\nHave any other cookbooks _depend_ on hostsfile by editing editing the `metadata.rb` for your cookbook.\n\n```ruby\n# metadata.rb\ndepends 'hostsfile'\n```\n\nNote that you can specify a custom path to your hosts file in the `['hostsfile']['path']` node attribute. Otherwise, it defaults to sensible paths depending on your OS.\n\n### Testing\n\nIf you are using [ChefSpec](https://github.com/sethvargo/chefspec) to unit test a cookbook that implements the `hostsfile_entry` resource, this cookbook packages customer matchers that you can use in your unit tests:\n\n- `append_hostsfile_entry`\n- `create_hostsfile_entry`\n- `create_hostsfile_entry_if_missing`\n- `remove_hostsfile_entry`\n- `update_hostsfile_entry`\n\nFor example:\n\n```ruby\nit 'creates a hostsfile entry for the DNS server' do\n expect(chef_run).to create_hostsfile_entry('1.2.3.4')\n .with_hostname('dns.example.com')\nend\n```\n\n## Priority\n\nPriority is a relatively new addition to the cookbook. It gives you the ability to (somewhat) specify the relative order of entries. By default, the priority is calculated for you as follows:\n\n82. 127.0.0.1\n81. ::1\n80. 127.0.0.0/8\n60. IPV4\n20. IPV6\n00. default\n\nHowever, you can override it using the `priority` option.\n\n## License & Authors\n\n- Author:: Seth Vargo (sethvargo@gmail.com)\n\n```text\nCopyright 2012-2013, Seth Vargo\nCopyright 2012, CustomInk, LLC\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Seth Vargo","maintainer_email":"sethvargo@gmail.com","license":"Apache-2.0","platforms":{"all":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/customink-webops/hostsfile","issues_url":"https://github.com/customink-webops/hostsfile/issues","chef_version":[[">= 12.7"]],"ohai_version":[]}