Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

system (24) Versions 0.7.0

Installs/Configures system elements such as the hostname and timezone.

Policyfile
Berkshelf
Knife
cookbook 'system', '= 0.7.0', :supermarket
cookbook 'system', '= 0.7.0'
knife supermarket install system
knife supermarket download system
README
Dependencies
Changelog
Quality 100%

system Cookbook

Cookbook Version
Dependency Status
Code Climate
Test Coverage
License
Join the chat at https://gitter.im/xhost-cookbooks/system

Build Status

Travis CI
Master Build status
Latest Release 0.7.0 Build status

This cookbook is designed to provide a set of recipes and LWRPs for managing the core properties of a host's system.

Currently the main features (from a high level) include:
- setting the hostname
- setting the timezone
- managing packages (install, uninstall & upgrade)

Ad-hoc style operational tasks such as reboot and shutdown are also implemented by recipes.

Get it now from your (local) supermarket!

Requirements

  • Chef >= 11
  • Ruby >= 1.9

Platforms Supported

  • Debian, Ubuntu
  • CentOS, RHEL, Fedora
  • Arch Linux
  • Mac OS X

Cookbooks

  • apt
  • cron
  • hostsfile

Attributes

See attributes/default.rb for default values.

  • node['system']['timezone'] - the system timezone to set, default Etc/UTC
  • node['system']['short_hostname'] - the short hostname to set on the node, default is node['hostname']
  • node['system']['domain_name'] - the domain name to set on the node, default localdomain
  • node['system']['netbios_name'] - the NetBIOS name to set on the node, default is node['system']['short_hostname'] upper-cased (OS X only)
  • node['system']['workgroup'] - the NetBIOS workgroup name to set on the node, default is WORKGROUP (OS X only)
  • node['system']['static_hosts'] - an array of static hostnames to add to /etc/hosts
  • node['system']['upgrade_packages'] - whether to upgrade the system's packages, default true
  • node['system']['packages']['install'] - an array of packages to install (also supports remote package URLs)
  • node['system']['packages']['install_compile_time'] - an array of packages to install in Chef's compilation phase (also supports remote package URLs)
  • node['system']['permanent_ip'] - whether the system has a permenent IP address (http://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution)

The following attributes should never need to be user set:

  • node['system']['cron_service_name']

Usage

Recipes

system::default

Includes the system::update_package_list, system::timezone and system::hostname recipes only.

NOTE: if applicable, the system's package manager's package list will be updated, but installed packages won't be upgraded. To upgrade the system's packages, include the system::upgrade_packages recipe in your run_list or role.

system::hostname

When using resources that reference node['fqdn'] in variables or attribute values, note that you will
need to lazy load to get the new hostname that is being set.

Use with variables:

template '/tmp/foobar.txt' do
source 'use_fqdn_in_variable.erb'
variables lazy {
{
fqdn: node['fqdn'],
foo: bar
}
}
end

Use with a resource attribute:

log 'lazy_log_fqdn' do
message lazy { node['fqdn'] }
level :debug
end

system::install_packages

Installs a list of system packages as specified in the node['system']['packages']['install'] attribute.
Will also install packages provided at compile time from within node['system']['packages']['install_compile_time'].

system::uninstall_packages

Uninstalls a list of system packages as specified in the node['system']['packages']['uninstall'] attribute.
Will also uninstall packages provided at compile time from within node['system']['packages']['uninstall_compile_time'].

system::reboot

Attempts to gracefully reboot the operating system.

system::shutdown

Attempts to gracefully shutdown the operating system.

system::timezone

Sets the timezone of the system.

system::update_package_list

Updates the local package manager's package list.

system::upgrade_packages

Upgrades all installed packages of the local package manager.

LWRPs

The cookbook currently provides 3 Lightweight Resource Providers that can be used in your own recipes
by depending on this cookbook. Recipes are provided interfacing each of these for convenience but
you may find them useful in your own cookbook usage.

system_hostname

Attribute Description Example Default
short_hostname The short hostname for the system starbug nil
domain_name The domain name for the system reddwarf.space nil
static_hosts An array of static hosts to add to /etc/hosts [{ '95.211.29.66' => 'supermarket.io' }, { '184.106.28.82' => 'chef.io' }] nil

Example:

system_hostname 'starbug.reddwarf.space' do
  short_hostname starbug
  domain_name reddwarf.space
  static_hosts [{'95.211.29.66' => 'supermarket.io'}, {'184.106.28.82' => 'chef.io'}]
end

system_timezone

Attribute Description Example Default
timezone The timezone to set the system to Australia/Sydney Etc/UTC

Example:

system_timezone 'Australia/Sydney'

system_packages

Attribute Description Example Default
packages The timezone to set the system to %w(wget curl) []
phase The Chef phase to download the packages in :compile :converge

Example:

system_packages %w(wget curl).join(',') do
  packages %w(wget curl)
  phase :compile
end

License and Authors

Copyright 2011-2015, Chris Fordham

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

system CHANGELOG

This file is used to list changes made in each version of the system cookbook.

0.0.1

  • Initial pre-release version

0.1.0

  • Initial 'pre 1' minor release

0.2.2

  • Includes bug fixes, revised code and more testing files

0.2.3

  • Fix missing quote for rs_tag command in hostname provider

0.3.2

  • Fix missing equals sign for service_action variable
  • Fix notifies for service[hostname] for Debian
  • Set 127.0.1.1 on Debian if needed
  • Fix for OHAI-389
  • Set supports status false for hostname service
  • Use service_name for hostname resource name
  • Minor log text improvements for show host info
  • Notify the hostname service immediately.
  • Address FC037: Invalid notification action
  • Add chefignore
  • Add TESTING.md

0.3.3

0.3.4

0.4.0

  • Better platform support for default cron service
  • timezone provider ensures inclusion of cron recipe
  • Other minor fixes for cron
  • Improve test suite, add basic tests
  • Add a recipe to test setting of the fqdn
  • New attribute, permanent_ip to affect usage of 127.0.1.1 on debian
  • Fix setting hosts in /etc/hosts by using lazy loading of fqdn
  • Set fqdn in compile phase, to be sure

0.4.1

0.5.0

  • Add a hostsfile entry for 127.0.0.1 against localhost.localdomain when not using permanent_ip
  • Include the FQDN in the hostfile entry for for 127.0.0.1 when not on Debian
  • Add resource for the network service in RHEL platform family (restart it on hostname change)
  • Use Chef::Util::FileEdit instead of sed to update /etc/sysconfig/network
  • permanent_ip is now true by default
  • Add support for hostnamectl (mostly for EL 7)
  • Fix missing trailing line return for /etc/hostname
  • Test Debian and CentOS with test-kitchen

0.6.0

  • Mac OS X support (including NetBIOS and Workgroup names)!
  • Pull request #11 (default timezone is now 'Etc/UTC')
  • Fail when an invalid timezone is provided
  • Support providing a zone with a space instead of underscore (for the humans)
  • Make before and after tz-info log resources debug log level
  • update_package_list recipe will now sync MacPorts tree
  • upgrade_packages recipe will now upgrade installed ports for MacPorts
  • Improved test suite including use of chef_zero with test-kitchen, more platforms/versions
  • Add a good handful of Serverspec tests

0.6.1

  • Ensure the crond service is available for restarting in timezone provider
  • Add mac_os_x to supports in metadata

0.6.2

  • Fix cron daemon usage for arch linux (uses cronie which is not yet supported in the cron cookbook yet)
  • Fix cron_service_name for arch linux (cronie) in default attributes
  • Fix supports for arch linux in metadata.rb

0.6.3

  • Use regex with readlines grep when checking for hostname in /etc/sysconfig/network on EL-based distros (fix for issue #14)
  • Help bad images/systems that have a null hostname (fix for issue #15)

0.6.4

  • Fix for issue #17 removing unique hostfile entry for 127.0.0.1
  • Fix render of static_hosts via node attributes
  • Add hostfile entries for ipv6 hosts
  • Let the cron cookbook manage the cron resources entirely
  • Various test elements added/improved

0.7.0

  • New system_packages LWRP
  • Support for installing remote packages by URL using the system_packages LWRP
  • timezone provider now defaults to Etc/UTC timezone

Foodcritic Metric
            

0.7.0 passed this metric