Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@atward
Last active January 27, 2019 01:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atward/5acc352ae4048fe1262ab444b2d7bcd6 to your computer and use it in GitHub Desktop.
Save atward/5acc352ae4048fe1262ab444b2d7bcd6 to your computer and use it in GitHub Desktop.
#cloud-init
# https://docs.chef.io/packages.html#enterprise-linux
# vendor chef-repo to /var/lib/chef with cookbooks in /var/lib/chef/cookbooks
yum_repos:
chef-stable:
name: chef-stable
baseurl: https://packages.chef.io/stable-yum/el/7/\$basearch/
enabled: true
failovermethod: priority
gpgcheck: true
bootcmd:
# Need to run this before 'cc_chef' during 'config' phase
- rpm --import https://downloads.chef.io/packages-chef-io-public.key
# Fix for RHEL 7.2 pySELinux bug: [Errno 2] No such file or directory
- mkdir -p '/etc/chef' '/var/log/chef' '/var/lib/chef' '/var/cache/chef' '/var/backups/chef' '/var/run/chef'
# Fix for RHEL 7.3 templater missing
- yum install -y python-jinja2
chef:
install_type: packages
# following two parameters are required by cc_chef
server_url: "http://127.0.0.1:8889"
validation_name: system
# do not run chef, use runcmd instead
exec: false
# environment:
run_list:
- 'recipe[example]'
initial_attributes:
example: only
runcmd:
# Additional config needed for chef-zero
- printf "\nchef_zero.enabled true\nchef_repo_path '/var/lib/chef'\n" >> /etc/chef/client.rb
- chef-client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment