system-config/modules/ansible/manifests/init.pp
Monty Taylor 09697cffdf Move ansible puppet code into a module
If the logic is just in a role, it's hard to re-use it in a one-off
manner on the command line. By putting it into a module, we can
run:

  ansible git0* -m puppet

To run puppet on the git farm, for instance.

Also, the file is completely not openstack specific, so do it in
such a way that we can submit it as a module upstream.

Change-Id: I35b2850e02ec5da2b41ad14eec9fd6d5a356bc93
2014-07-05 10:17:56 -07:00

61 lines
1.2 KiB
Puppet

# == Class: ansible
#
class ansible {
include logrotate
include pip
package { 'ansible':
ensure => latest,
provider => pip,
}
if ! defined(File['/etc/ansible']) {
file { '/etc/ansible':
ensure => directory,
}
}
file { '/etc/ansible/ansible.cfg':
ensure => present,
source => 'puppet:///modules/ansible/ansible.cfg',
require => File['/etc/ansible'],
}
file { '/usr/local/bin/puppet-inventory':
ensure => present,
mode => '0755',
owner => 'root',
group => 'root',
source => 'puppet:///modules/ansible/puppet-inventory',
}
file { '/etc/ansible/roles':
ensure => directory,
recurse => true,
source => 'puppet:///modules/ansible/roles',
require => File['/etc/ansible'],
}
file { '/etc/ansible/library':
ensure => directory,
recurse => true,
source => 'puppet:///modules/ansible/library',
require => File['/etc/ansible'],
}
include logrotate
logrotate::file { 'ansible':
log => '/var/log/ansible.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
}
}