Skip to content

Instantly share code, notes, and snippets.

View jooooooon's full-sized avatar

Jonathan Clarke jooooooon

View GitHub Profile
@jooooooon
jooooooon / process_check_example.c
Created March 3, 2011 15:10
Cfengine check_processes example
body common control {
bundlesequence => { "process_check" };
inputs => { "cfengine_stdlib.cf" };
}
bundle agent process_check {
vars:
"daemon" slist => { "cf-execd", "cf-serverd", "cf-monitord" };
processes:
@jooooooon
jooooooon / cron.bash
Created March 3, 2011 15:18
Keep cf-execd alive in crontab
*/5 * * * * root if [ `ps -efww | grep cf-execd | grep -v grep | wc -l` -eq 0 ]; then /var/cfengine/bin/cf-execd; fi
@jooooooon
jooooooon / cron_ensure_cfexecd_running.c
Created March 3, 2011 15:29
Cfengine: add line to /etc/crontab
bundle agent cron_ensure_cfexecd_running {
files:
"$(g.crontab)"
edit_line => add_lines;
}
bundle edit_line add_lines
{
insert_lines:
"*/5 * * * * root if [ `ps -efww | grep cf-execd | grep -v grep | wc -l` -eq 0 ]; then /var/cfengine/bin/cf-execd; fi";
@jooooooon
jooooooon / gist:877378
Created March 19, 2011 10:20
resolv_conf_example_template
body common control {
bundlesequence => { "set_dns_configuration" } ;
}
#######################################################################
# Configure DNS
# Use Google's DNS servers, and set the defaut domain to normation.com
#######################################################################
bundle agent set_dns_configuration {
vars:
body common control {
bundlesequence => { "set_dns_configuration" } ;
}
#######################################################################
# Configure DNS
# Use Google's DNS servers, and set the defaut domain to normation.com
#######################################################################
bundle agent set_dns_configuration {
vars:
body common control {
bundlesequence => { "set_sections" };
}
bundle agent set_sections {
vars:
"value2in1" string => "No";
"value3in2" string => "Yes";
files:
body action my_bg {
background => "true";
}
body classes kept_if_else_exclusive_persist(kept, repaired, failed, persist) {
kept_returncodes => { "0" };
#repaired_returncodes => { "1", "3", "5" };
#failed_returncodes => { "7", "9" };
promise_kept => { "$(kept)" };
@jooooooon
jooooooon / mysql_user.cf
Created May 16, 2012 12:19 — forked from frbayart/mysql_user.cf
mysql_user with cfengine
bundle agent mysql_user() {
vars:
any::
"users_to_check" slist => { "francois", "benoit" };
classes:
"user_is_not_here_$(users_to_check)" expression => returnszero("/usr/local/bin/mysql_user_check $(users_to_check)","noshell");
"mysql_users_check_NOK" expression => classmatch("user_is_not_here_.*");
commands:
#cloud-config
# Set up the package repository to get Rudder.
# We use the "latest" pseudo-version name to always get an up-to-date agent.
# Key from http://www.rudder-project.org/packages.gpg.key
apt_sources:
- source: "deb http://www.rudder-project.org/apt-latest/ $RELEASE main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux)
@jooooooon
jooooooon / install-rudder-agent-rpm-latest.yml
Last active November 28, 2016 17:25
These files allow to install a Rudder agent automatically using cloud-init. All you need to do to use them is set the user-data field in your cloud provider to contain "#include" on one line, and the URL to the raw version of this script on the second line. Assuming you're using an image with cloud-init pre-installed, your new instance will spin…
#cloud-config
# Set up the package repository to get Rudder.
# We use the "latest" pseudo-version name to always get an up-to-date agent.
yum_repos:
- rudder-latest:
baseurl: http://www.rudder-project.org/rpm-latest/RHEL_7/
enabled: true
gpgcheck: true
gpgkey: http://www.rudder-project.org/packages.gpg.key