Update upstream cookbooks

This commit is contained in:
Greg Karékinian
2017-03-20 13:19:10 +00:00
parent bfd2d52ea8
commit bcfd44b923
340 changed files with 12576 additions and 5465 deletions

View File

@@ -4,6 +4,10 @@ driver_config:
require_chef_omnibus: true
platforms:
- name: ubuntu-14.04
driver_config:
box: opscode_ubuntu-14.04_provisionerless
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
- name: ubuntu-12.04
driver_config:
box: opscode_ubuntu-12.04_provisionerless

View File

@@ -1,5 +1,5 @@
AllCops:
Excludes:
Exclude:
- tmp/**
Documentation:
@@ -7,3 +7,6 @@ Documentation:
LineLength:
Enabled: false
SingleSpaceBeforeFirstArg:
Enabled: false

View File

@@ -1,5 +1,5 @@
# -*- ruby -*-
site :opscode
source "https://supermarket.getchef.com"
metadata

View File

@@ -1,7 +1,13 @@
# Change History
0.3.0
=====
0.4.0 (2015-03-16)
==================
- #40: Use file resources with lazy eval and notifies to prevent network restarts from occurring on every chef run (Matt Kasa)
- Add box with Ubuntu 14.04 for kitchen tests
- #27: Update default recipe to reload only the hostname plugin instead of ohai (Jonathan Serafini)
0.3.0 (2014-05-20)
==================
- Fixed (and tested) FreeBSD support
- #17: added support for RedHat & CentOS (Damien Roche, Marta Paciorkowska)
- added instructions on manual testing with reboot (Marta Paciorkowska)

View File

@@ -1,4 +1,4 @@
rubocop: rubocop $COOKBOOK
knife test: knife cookbook test $COOKBOOK
foodcritic: foodcritic --tags ~FC015 --epic-fail any $SANDBOX/$COOKBOOK
foodcritic: foodcritic -c 11.6.0 --tags ~FC015 --epic-fail any $SANDBOX/$COOKBOOK
chefspec: rspec $SANDBOX/$COOKBOOK

View File

@@ -6,7 +6,7 @@ maintainer_email 'maciej@3ofcoins.net'
license 'MIT'
description 'Configures hostname and FQDN'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.3.0'
version '0.4.0'
supports 'debian'
supports 'ubuntu'

View File

@@ -53,48 +53,47 @@ if fqdn
execute "hostname #{fqdn}" do
only_if { node['fqdn'] != fqdn }
notifies :reload, 'ohai[reload]', :immediately
notifies :reload, 'ohai[reload_hostname]', :immediately
end
when 'centos', 'redhat', 'amazon', 'scientific'
service 'network' do
action :nothing
end
hostfile = '/etc/sysconfig/network'
ruby_block "Update #{hostfile}" do
block do
file = Chef::Util::FileEdit.new(hostfile)
file.search_file_replace_line('^HOSTNAME', "HOSTNAME=#{fqdn}")
file.write_file
end
notifies :reload, 'ohai[reload]', :immediately
file hostfile do
action :create
content lazy {
::IO.read(hostfile).gsub(/^HOSTNAME=.*$/, "HOSTNAME=#{fqdn}")
}
notifies :reload, 'ohai[reload_hostname]', :immediately
notifies :restart, 'service[network]', :delayed
end
# this is to persist the correct hostname after machine reboot
sysctl = '/etc/sysctl.conf'
ruby_block "Update #{sysctl}" do
block do
file = Chef::Util::FileEdit.new(sysctl)
file.insert_line_if_no_match("kernel.hostname=#{hostname}", \
"kernel.hostname=#{hostname}")
file.write_file
end
notifies :reload, 'ohai[reload]', :immediately
file sysctl do
action :create
content lazy {
::IO.read(sysctl) + "kernel.hostname=#{hostname}\n"
}
not_if { ::IO.read(sysctl) =~ /^kernel\.hostname=#{hostname}$/ }
notifies :reload, 'ohai[reload_hostname]', :immediately
notifies :restart, 'service[network]', :delayed
end
execute "hostname #{hostname}" do
only_if { node['hostname'] != hostname }
notifies :reload, 'ohai[reload]', :immediately
notifies :reload, 'ohai[reload_hostname]', :immediately
end
service 'network' do
action :restart
end
else
file '/etc/hostname' do
content "#{hostname}\n"
mode '0644'
notifies :reload, 'ohai[reload]', :immediately
notifies :reload, 'ohai[reload_hostname]', :immediately
end
execute "hostname #{hostname}" do
only_if { node['hostname'] != hostname }
notifies :reload, 'ohai[reload]', :immediately
notifies :reload, 'ohai[reload_hostname]', :immediately
end
end
@@ -109,10 +108,11 @@ if fqdn
hostname fqdn
aliases [hostname]
action :create
notifies :reload, 'ohai[reload]', :immediately
notifies :reload, 'ohai[reload_hostname]', :immediately
end
ohai 'reload' do
ohai 'reload_hostname' do
plugin 'hostname'
action :nothing
end
else