Commit 7167c6ed authored by Victor Penso's avatar Victor Penso
Browse files

Improve the readme

parent 66320027
## Description ## Description
**THIS IS JUST A PROTOTYPE!** This cookbook enables to configuration of generic [Chef resources](https://docs.chef.io/resources.html) by attributes.
Provide access to Chef resources by attributes. ```
apt_repository
apt_update
apt_package
yum_repository
yum_package
package
group
user
directory
file
remote_file
link
template
git
subversion
execute
bash
script
service
systemd_unit
route
mount
```
Take a look to [test/roles/](test/roles) for example. ### Configuration
Append more resources to the resource list mapped by this cookbook with the attribute `base/resources`:
```ruby
name 'cron'
description 'Cron configuration'
run_list( 'recipe[base]' )
default_attributes(
base: { resources: [ 'cron' ] },
cron: {
'noop': {
hour: '5',
minute: '0',
command: '/bin/true'
}
}
)
```
### Usage
Take a look to [test/roles/](test/roles) directory for a list of example roles using this cookbook.
```ruby
name 'ntpd'
description 'Base configuration for CentOS 7'
run_list( 'recipe[base]' )
default_attributes(
##
# PACKAGES
#
package: [ 'ntp','ntpdate' ],
# Remove the default NTP service on CentOS
yum_package: { chrony: { action: :remove } },
##
# CONFIGURATION FILES
#
file: {
##
# Time Synchronisation
#
'/etc/ntp.conf': {
content: %(
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
),
notifies: [ :restart, 'systemd_unit[ntpd.service]', :delayed ]
}
},
systemd_unit: {
##
# Set timezone at boot
#
'set-timezone.service': {
content: '
[Unit]
Description=Set the time zone to Europe/Berlin
[Service]
ExecStart=/usr/bin/timedatectl set-timezone Europe/Berlin
RemainAfterExit=yes
Type=oneshot
',
action: [:create, :enable, :start]
},
# Disable /etc/init.d/ntp if present
'ntp.service': { action: [:stop, :disable] },
'ntpd.service': {
content: %(
[Unit]
Description=Network Time Service
After=syslog.target ntpdate.service sntp.service
[Service]
Type=forking
ExecStart=/usr/sbin/ntpd -u ntp:ntp -g
PrivateTmp=true
[Install]
WantedBy=multi-user.target
),
action: [:create, :enable, :start],
notifies: [ :restart, 'systemd_unit[ntpd.service]']
}
}
)
```
## License ## License
......
name 'base' name 'base'
maintainer 'YOUR_COMPANY_NAME' maintainer 'Victor Penso'
maintainer_email 'YOUR_EMAIL' maintainer_email 'vic.penso@gmail.com'
license 'All rights reserved' license 'Apache 2.0'
description 'Installs/Configures base' description 'Use generic Chef resources by attributes'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0' version '1.0.0'
source_url 'https://github.com/vpenso/chef-base'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment