LoginSignup
1
1

More than 5 years have passed since last update.

puppet入門5 ユーザー、グループの追加

Last updated at Posted at 2013-11-23

ユーザーとグループを追加してみよう。
今回はmysqlユーザーを作ってみた。

設定

site.pp
node 'puppetmaster.safe' {
  group { "mysql":
    gid => 518,
    ensure => present
  }
  user { "mysql":
    ensure => present,
    home => "/opt/mysql",
    managehome => true,
    uid => 518,
    gid => 518,
    shell => "/bin/bash",
    password => '!!'
  }
}

配布

# id mysql
id: mysql: No such user
# puppet agent --server=puppetmaster.safe --no-daemonize --verbose
Notice: Starting Puppet client version 3.3.2
Info: Retrieving plugin
Info: Caching catalog for puppetmaster.safe
Info: Applying configuration version '1385177049'
Notice: /Stage[main]//Node[puppetmaster.safe]/Group[mysql]/ensure: created
Notice: /Stage[main]//Node[puppetmaster.safe]/User[mysql]/ensure: created
Notice: Finished catalog run in 0.27 seconds
^CNotice: Caught INT; calling stop
# id mysql
uid=518(mysql) gid=518(mysql) groups=518(mysql)
# grep mysql /etc/shadow
mysql:!!:16032:0:99999:7:::
# grep mysql /etc/passwd
mysql:x:518:518::/opt/mysql:/bin/bash
/var/log/messages
Nov 23 06:24:08 puppetmaster puppet-agent[24182]: Starting Puppet client version 3.3.2
Nov 23 06:24:08 puppetmaster puppet-agent[24187]: Retrieving plugin
Nov 23 06:24:09 puppetmaster puppet-master[916]: Compiled catalog for puppetmaster.safe in environment production in 0.02 seconds
Nov 23 06:24:09 puppetmaster puppet-agent[24187]: Caching catalog for puppetmaster.safe
Nov 23 06:24:09 puppetmaster puppet-agent[24187]: Applying configuration version '1385177049'
Nov 23 06:24:09 puppetmaster puppet-agent[24187]: (/Stage[main]//Node[puppetmaster.safe]/Group[mysql]/ensure) created
Nov 23 06:24:09 puppetmaster puppet-agent[24187]: (/Stage[main]//Node[puppetmaster.safe]/User[mysql]/ensure) created
Nov 23 06:24:09 puppetmaster puppet-agent[24187]: Finished catalog run in 0.27 seconds

次はpuppet入門6 puppetのclientを追加する

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1