Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHEF
cookbooks
base
Commits
7167c6ed
Commit
7167c6ed
authored
May 30, 2017
by
Victor Penso
Browse files
Improve the readme
parent
66320027
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
7167c6ed
## 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
...
...
metadata.rb
View file @
7167c6ed
name
'base'
maintainer
'
YOUR_COMPANY_NAME
'
maintainer_email
'
YOUR_EMAIL
'
license
'A
ll rights reserved
'
description
'
Installs/Config
ures b
ase
'
maintainer
'
Victor Penso
'
maintainer_email
'
vic.penso@gmail.com
'
license
'A
pache 2.0
'
description
'
Use generic Chef reso
ur
c
es b
y attributes
'
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'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment