最新发布 页面 5 RSS Toggle Comment Threads | 键盘快捷键

  • bixuan 10:31 on 2010 年 11 月 19 日 链接地址 | 回复
    Tags:   

    amazon的EC2确实很方便,但是计费方式还不够灵活~

     
  • bixuan 01:17 on 2010 年 11 月 17 日 链接地址 | 回复
    Tags:   

    搞了个通宵,终于从amazon迁出了,NND

     
    • lasu 09:41 on 2010 年 11 月 17 日 链接地址

      为什么要迁出?我刚搬进去呢

    • bixuan 10:23 on 2010 年 11 月 17 日 链接地址

      amazon内网出现链路质量问题,所以不得已。而且性价比也太低了,呵呵

  • bixuan 22:42 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: , tidy,   

    puppet tidyt用法
    先占位置

     
  • bixuan 22:41 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: mount, ,   

    puppet mount用法
    先占位置

     
  • bixuan 21:18 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: host, ,   

    puppet 主机(host)用法:
    语法:

    host { 'xx.com':
        alias => ['absent'],
        ip => 'absent',
        target => '',
        ensure => 'absent'
    }
    

    如果忘了host的语法,那么可以执行ralsh获取,比如:

    ralsh host xx.com
    host:表示类别,其他诸如file,cron
    xx.com:就是host里的主机头
    

    ip
    主机的IP地址,ipv4或ipv6

    name
    主机名称
    资源类型的命名变量

    ensure
    确定该主机是否启用,有效值present 和 absent
    ensure => ‘present’:表示启用在该条记录,如果没有则添加
    ensure => ‘absent’:表示去启用该条记录,如果已经存在则会删除

    target
    这个用法不清楚

    例子:

    host { 'test.ourlinux.net':
            ip => '192.168.1.121',
            alias=> [ "1.ourlinux.net", "2.ourlinux.net" ],
            ensure => 'present',
            #ensure => 'absent',
    }
    

    查看/etc/hosts结果增加了如下一行:
    192.168.1.121 test.ourlinux.net 1.ourlinux.net 2.ourlinux.net

    http://puppet.chinaec2.com/host

     
  • bixuan 21:01 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: define, ,   

    puppet 定义(definitions)用法:
    定义使用define关键词建立,支持参数,但不支持继承。可以将定义想象为一个可用参数多次调用的配置段。
    当设计为重复调用时,不包含资源,仅有一个实例,象包或者服务。
    使用关键词define,指定定义名,然后是由括号包围的参数列表,用花括号封闭定义段。

    先占位置

     
  • bixuan 17:17 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: , 安装   

    puppet 安装

    1、服务端安装
    需要安装puppet-server,当然相关ruby的依赖包也会自动安装:

    yum -y install puppet-server puppet
    

    2、客户端安装
    只要安装puppet即可:

    yum -y install puppet
    

    3、编译安装
    正在测试,比较麻烦以后补上~

     
  • bixuan 16:59 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: group, , user, 用户, , 组   

    puppet 组和用户(group/user)用法:

    user常见语法

    user { 'bixuan':
            home => '/home/bixuan',
            shell => '/bin/bash',
            uid => '500',
            comment => 'test',
            gid => '100',
            groups => ['users'],
            ensure => 'absent', #absent:存在则删除;present:不存在则闯进
    }
    

    user的基本属性:
    name: OS specified limits apply. (namevar)
    shell: 用户的shell类型,比如:/bin/bash
    uid: 用户uid
    comment: 用户信息描述
    ensure: 设置用户的基本状态资源. 有2个值:absent(不启用,设置此值时会删除用户), present(启用该用户,不存在则自动创建).
    gid: 用户的所属的基本组。可以指定数值或的名字。
    groups: 用户附属组,多个组需要用数组来定义。
    home: 用户目录
    managehome: Whether to manage the home directory when managing the user. Valid values are
    true, false.

     
  • bixuan 16:45 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: package, , , 软件包   

    puppet 软件包(package)用法:

    http://puppet.chinaec2.com/package

    先占位置~

     
  • bixuan 16:42 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: , service, 服务,   

    puppet 服务(service)用法:

    service常见语法
    service {‘sshd’:
    enable => true,
    ensure => running,
    hasstatus => true,
    hasrestart => true,
    }
    service的基本属性:

    name: The name of the service as understood on the underlying services subsystem. (namevar)
    enable: If a service should be started at boot. Can be true or false.
    ensure: If the resource should currently be running. Can be true, false, running, or stopped.
    hasrestart: Specifies that your service has a restart command. Can be true or false.
    hasstatus: Specifies that your service has a status command. Can be true or false.
    pattern: The pattern to search for in the process table.
    restart: Specify a restart command.
    start: Specify a start command.
    status: Specify a status command.
    stop: Specify a stop command.
    

    http://puppet.chinaec2.com/srv

     
  • bixuan 16:34 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: , template, 模板,   

    puppet 模板(template)用法:
    先占位置~

     
  • bixuan 15:14 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: file, , 文件,   

    puppet 文件(file)用法:

    file常见语法

    file {"/tmp/bixuan/etc":
            ensure => file,
            source =>"puppet://$puppetserver/files/etc",
            owner =>"root",
            group =>"root",
            mode =>"744"
    }
    

    file的基本属性:

    path: Specifies the target location for file. (namevar)
    ensure: Accepts absent, present, file, and directory.
                Any other value will be treated as a symlink.
    owner: 文件所属用户.
    group: 文件所属组.
    mode: 文件权限,比如:755
    content: 指定文件的内容,作为字符串返回。
    source: 指定源文件
    force: Force replacement of directories with a link. Valid values (true, false).
    ignore: 忽略指定文件,比如.svn, .git.
              Omits files matching specified patterns during recursion (Ex: .svn, .git).
    recurse: 递归检索文件,同步目录时设为true
    purge: 清除已删除的文件。Whether or not to purge unmanaged file resources within a directory.
              Valid values (true,false)
    

    例子
    1、同步目录:

    file {"/tmp/bixuan/etc":
            source =>"puppet://$puppetserver/files/etc",
            recurse =>"true", #递归检索文件,同步目录时设为true
            owner =>"root",
            group =>"root",
            mode =>"744",
            purge =>"true", #保持和source完全一致。类似rsync的 --delete参数
    }
    

    2、同步文件:

    file { "/etc/sysctl.conf":
            source => "puppet://$puppetserver/files/etc/sysctl.conf",
            owner => "root",
            group => "root",
            mode => 0644,
    }
    

    操作文件往往和命令相关联,具体查看:puppet exec用法

     
  • bixuan 12:20 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: 童童   

    前几天带童童去收惊说在好几个地方吓到了,难怪晚上睡觉都会哭起来~低能量的生物无处不在啊~~

     
  • bixuan 03:26 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: ,   

    puppet 其他用法:

    1、在同1台server里多个用户执行puppet配置:

    如果已经签名了root的ssl证书,那么普通用户则不能用,因为puppet服务端只认一个`hostname -f`的证书,所以我采用了比较BT的做法:(假定普通用户:bixuan)

    hostname=`hostname -f|tr A-Z a-z`
    cp /var/lib/puppet/ssl/private_keys/${hostname}.pem /home/bixuan/.puppet/ssl/private_keys/${hostname}.pem
    cp /var/lib/puppet/ssl/public_keys/${hostname}.pem /home/bixuan/.puppet/ssl/public_keys/${hostname}.pem
    cp /var/lib/puppet/ssl/${hostname}.pem /home/bixuan/.puppet/ssl/${hostname}.pem
    

    注意:hostaname必须转换成小写。

     
  • bixuan 00:50 on 2010 年 11 月 14 日 链接地址 | 回复
    Tags: cron, ,   

    puppet crontab用法:

    cron { puppetd:
            command => "/usr/sbin/puppetd --server 192.168.4.185 --test",
            user => root,
            minute => '*/2'
    }
    

    以root用户每分钟执行:/usr/sbin/puppetd –server 192.168.4.185 –test
    上面的puppetd是作为标记的名字。

    相当于:

    # Puppet Name: puppetd
    */2 * * * * /usr/sbin/puppetd --server 192.168.4.185 --test
    

    参数

    除了用户和command两个参数以外,其他的参数都是可选项.

    command
    crontab要执行的命令, 环境变量按照系统本地规则进行管理,推荐使用绝对路径.

    ensure
    指定该资源是否启用,可设置成true或false

    environment
    在 crontab环境里面指定环境变量,例如 PATH=/bin:/usr/bin:/usr/sbin.

    hour
    运行crontab的小时,可设置成0-23

    minute
    运行crontab的分钟,可设置成0-59

    month
    设置crontab运行的月份,1-12

    monthday
    一个月份中的日子,1-31

    name
    该crontab的名字,这个名字用于管理员区分不同的crontab,以及puppet管理各种资源关系.

    provider
    指定provider,可用的provider有

    crontab 默认的crontab程序
    special 特殊的管理程序,只能在freebsd上面用
    user
    把该crontab加到那个用户的crontab列表,默认是运行puppet的用户

    weekday
    运行crontab的星期数,0-7

     
c
写新的
j
下一篇文章/下一个回复
k
前一篇文章/以前的回复
r
回复
e
编辑
o
显示/隐藏 回复
t
回到顶部
l
go to login
h
show/hide help
esc
取消