2009-07-06 Mon

[別の年の同じ日: 2002 2003 2006 2007 2008 2010 2013

ralsh はてぶ

puppet のバージョンを上げようと思い,
rpm を作っている時に,ralsh の存在に気づいたのでメモ.

Puppet の RAL(って何?)を直接扱うためのコマンド.

ralsh --help


すると説明がでるんだけど,そこには以下のような例がある.

EXAMPLE
===
This example uses ``ralsh`` to return Puppet configuration for the user
``luke``::

$ ralsh user luke
user { 'luke':
  home => '/home/luke',
  uid => '100',
  ensure => 'present',
  comment => 'Luke Kanies,,,',
  gid => '1000',
  shell => '/bin/bash',
  groups => ['sysadmin','audio','video','puppet']
}


どうやら,Puppet の設定を吐いてくれるみたい.

他にも,package

# ralsh package puppet-server
package { 'puppet-server':
  ensure => '0.24.5-1.el5'
}


service

# ralsh service puppet-server
service { 'puppet-server':
  ensure => 'running',
  enable => 'false'
}


等の設定を吐いてくれるっぽい.

また,
- Digg the Blog » Blog Archive » Master of Puppets #1: ralsh
  http://blog.digg.com/?p=335
によると,以下のように引数を渡してやると,
ユーザ newuser を作成し,その設定を吐いてくれるみたい.
# 以下の例では managehome がないので /home/newuser は作られない.

~$ ralsh user newuser uid=9999 gid=9999 home=/home/newuser shell=/bin/bash ensure=present
notice: /User[newuser]/ensure: created
user { ‘newuser’:
  uid => ‘9999′,
  gid => ‘9999′,
  home => ‘/home/newuser’,
  shell => ‘/bin/bash’,
  password => ‘!’,
  ensure => ‘present’
}



また,以下のように cron の設定もできるみたい.

~$ ralsh cron check_my_mail command="/usr/bin/fetchmail mail.my.mail.server" user=plathrop hour='*' minute='*/30' ensure=present
notice: /Cron[check_my_mail]/ensure: created
cron { ‘check_my_mail’:
  command => ‘/usr/bin/fetchmail mail.my.mail.server’,
  monthday => ‘absent’,
  hour => ['*'],
  environment => ”,
  target => ‘plathrop’,
  special => ”,
  minute => ['*/30'],
  user => ‘plathrop’,
  ensure => ‘present’,
  weekday => ‘absent’,
  month => ‘absent’
}


Puppet で cron を扱えるというのは知らなかったんだけど,
これは /etc/cron.d にでもファイルを書いてくれるのだろうか.

/etc/cron.d 以下にファイルを書いてくれるなら,
source を使って直接ファイルを配布した方が簡単な気もする.

このへんはどうなってるか,あとで試す.

- puppet - Trac
  http://reductivelabs.com/trac/puppet

ref.
- puppet-mode [2009-07-04-3]
- puppet を使ってみる [2009-04-03-1]
- Puppet による変更をメールで通知する [2008-08-29-7]
- Puppet を使って client にパッケージをインストールする [2008-08-28-3]
- CentOS 5.2 に puppet を rpm でインストールする [2008-08-28-1]