aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ii/manifests/init.pp
blob: 0c80db4062e4c545930ddfa8bc247cfcf5653eae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class ii {
    class base {
        package { "ii": }

        file { "/var/lib/ii/":
            ensure => directory,
            owner => nobody,
        }
    }

    define bot($server = 'irc.freenode.net',
               $channel) {

        $nick = $name

        include ii::base

        service { 'ii':
            provider => base,
            start => "su nobody -c 'ii -n $nick -i /var/lib/ii/$nick -s $server'",
            notify => "join channel",
        }

        exec { "join channel":
            command => "echo '/j $channel' > /var/lib/ii/$nick/$server/in",
            user => nobody,
            refreshonly => true,
        }
    }
}