CloudFlare Puppet Module
- Add the 'cloudflare' folder into your module path
- Include the class and configure the relevant variables for your CloudFlare account:
You need to declare this at the top of your class so the defines can use these details at will:
class { 'cloudflare':
cloudflare_email => "$cloudflare_email",
cloudflare_tkn => "$cloudflare_tkn",
}
cloudflare::add { 'sub.domain.com':
domain => 'domain.com/sub.domain.com',
destination => 'target.domain.com',
type => 'cname',
proxy => true,
ttl => 1,
require => Class['cloudflare'],
}
cloudflare::edit { 'sub.domain.com':
}
cloudflare::delete { 'sub.domain.com':
domain => 'domain.com/sub.domain.com',
require => Class['cloudflare'],
}
if $add_dns {
# Declare Cloudflare credentials
$cloudflare_email = password_lookup("cloudflare_email", 'global')
$cloudflare_tkn = password_lookup("cloudflare_tkn", 'global')
# Pass Cloudflare credentials
class { 'cloudflare':
cloudflare_email => "$cloudflare_email",
cloudflare_tkn => "$cloudflare_tkn",
}
# Add the sub.doamin.com
cloudflare::add { 'sub.domain.com':
domain => 'domain.com/sub.domain.com',
destination => 'target.domain.com',
type => 'cname',
proxy => true,
ttl => 1,
require => Class['cloudflare'],
}
}
Riaan Nolan and Jürgen Weber