Forge Home

ec2cronjob

It Creates Cronjobs that runs in ec2 on only one instance per used AMI

10,992 downloads

9,361 latest version

4.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.6 (latest)
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Apr 15th 2015
This version is compatible with:

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'paschdan-ec2cronjob', '0.1.6'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add paschdan-ec2cronjob
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install paschdan-ec2cronjob --version 0.1.6

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

paschdan/ec2cronjob — version 0.1.6 Apr 15th 2015

Puppet Forge Build Status wercker status Puppet Forge

Overview

This module can generate CRON-JOBS that runs on only one EC2-Instance based on the used AMI.

To be able to do this it installs the awscli tools.

Until jdowning releases a newer version of his awscli you need to use master branch !!!!

How does it work

This module installs a wrapper script around your cronjob. This wrapper does the following:

  • it gets the instance-id of the mashine via facter
  • it gets the ami-id of the mashine via facter
  • it gets the region of the mashine via facter / sed
  • it gets the first instance with the current ami in the current region via awscli
  • it runs your cronjob if the first instance (from awscli) is the same as the current instance

Usage

Add a Cron

if you are using awscli with my profiles-fix you can use it this way:

add an awscli profile for root user and prepare system for adding crons

class { 'ec2cronjob':
  aws_access_key_id     => 'MYACCESSKEYID',
  aws_secret_access_key => 'MYSECRETACCESSKEY'
}

to add a cron simply do

ec2cronjob::cron { 'mytestcron':
  command  => 'echo "Hello World"',
  minute   => 1,
  hour     => 2,
  weekday  => 4,
  month    => 5,
  monthday => 7
}

you will need installed awscli (with credentials) to have the cronjob running.

Remove a Cron

ec2cronjob::cron { 'mytestcron':
  ensure => absent
}