puppet

puppet (二)公共资源

混江龙づ霸主 提交于 2019-11-28 23:47:34
puppet公有资源的用途: puppet将资源完成任务与否的结果看为状态,正是这种特性让我们可以通过资源公有属性来建立与资源的关系,当建立了资源关联关系后,前者资源状态未成功时,后者资源可以通过资源共有属性来确认其最终执行结果,这就是公有资源属性的用途. 常用的公有资源: before/require:定义资源的先后顺序,除此之外还有"->". require:资源依赖,自身资源依赖哪个资源。 before:自身资源在哪个资源之前使用. notify/subscribe:通知订阅. notify:通知,自身发生改变通知remote资源 subcribe:订阅,当远程remote资源改变,自身做刷新操作 无关系示例: 以安装、启动httpd服务为例,puppet代码如下: 1 2 3 4 5 6 7 8 9 [root@sh-web1 ~] # cat httpd.pp package { "httpd" : ensure => present, provider => 'yum' , } service { "httpd" : ensure => running, enable => true , } 注释:希望的结果是先安装httpd软件包,再启动httpd服务. 运行结果如下: 1 2 3 4 5 6 7 8 9 10 [root@sh-web1 ~] # puppet

Chef and Puppet recommendations [closed]

自作多情 提交于 2019-11-28 18:00:45
问题 I'd like to ask about when and in what circumstances you'd use puppet and when you'd use chef. I've also found rump which is a puppet-solo type of thing where you iterate a single server to its configuration and then push that to a series of servers, allowing you to see changes directly. My question: which of the above should I use and in what ways? Could someone help me? My aim is in the context of continuous integration, continuous deployment in a mono/.Net environment with rake and git. I

are there iterators and loops in puppet?

耗尽温柔 提交于 2019-11-28 16:43:04
问题 When I define(?) a resource e.g. to ensure dir structure, are there any loops available? Like that: for X in [app1,app2] do: file { '/opt/app/' + X: ensure => directory, owner => 'root', group => 'root', mode => '0644', } I have tens of directories and I am really tired with declaring it in puppet.. It would take 15 LOC of bash. Any ideas? 回答1: Older versions of the puppet language have no support for loops. But you can use an array instead of a simple string for the title and declare several

Installing a puppet module from a manifest script

試著忘記壹切 提交于 2019-11-28 15:59:36
I'm using puppet to provision a vagrant (ubuntu based) virtual machine. In my script I need to: sudo apt-get build-dep python-lxml I know I can install the apt puppet module so I can use: apt::builddep { 'python-lxml': } But I can't find any reference about installing a module from the script and how to include/require it. Seems to me that the puppet docs refer only to installing from the command line puppet tool I also tried doing something like: define build_dep($pkgname){ exec { "builddepend_$pkgname": commmand => "sudo apt-get build-dep $pkgname"; } } build_dep{ "python-imaging": pkgname =

Configuration Management for Windows [closed]

爱⌒轻易说出口 提交于 2019-11-28 13:45:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Are there any tools for windows like that *nix world has? I am looking for something like Chef or Puppet. I have found cfEngine but it still looks very *nix centric. Ideally it would be open source, and command line driven. The idea is to put together an automated infrastructure with windows based servers. Our

openstack安装

跟風遠走 提交于 2019-11-28 05:23:09
RDO(Red Hat Distribution of OpenStack)是由红帽公司推出的部署OpenStack集群的一个基于Puppet的部署工具,可以很快地通过RDO部署一套复杂的OpenStack环境。如果用户想在REHL上面部署OpenStack,最便捷的方式就是RDO。 环境:Centos7系统,4G内存,100G硬盘大小。 一:更新yum源 yum -y update 二:RDO安装源 yum install -y https://www.rdoproject.org/repos/rdo-release.rpm 三:在使用RDO安装OpenStack过程中,需要Packstack来部署OpenStack,以下安装Packstack: yum install -y openstack-packstack 最好把相关依赖包都尽量安装下: yum install -y yum openstack-packstack openstack-nova-compute puppet hiera openssh-clients tar nc rubygem-json openstack-nova-conductor openstack-dashboard openstack-swift mongodb-server openstack-ceilometer-central

How to iterate over an array in Puppet

China☆狼群 提交于 2019-11-28 04:59:09
I would like to iterate over an array that is stored as a Facter fact, and for each element of the array create a new system user and a directory, and finally make API calls to AWS. Example of the fact: my_env => [shared1,shared2,shared3] How can I iterate over an array in Puppet? itsbruce This might work, depending on what you are doing # Assuming fact my_env => [ shared1, shared2, shared3 ] define my_resource { file { "/var/tmp/$name": ensure => directory, mode => '0600', } user { $name: ensure => present, } } my_resource { $my_env: } It will work if your requirements are simple, if not,

managing a user password for linux in puppet

微笑、不失礼 提交于 2019-11-28 03:40:36
I need to create a test user with a password using using puppet. I've read that puppet cannot manage user passwords in a generic cross-platform way, which is a pity. I am doing this for Red Hat Enterprise Linux Server release 6.3. I do as follows: user { 'test_user': ensure => present, password => sha1('hello'), } puppet updates the password of the user, but Linux says login/pwd incorrect when I try to login. it works (I can login) if I set the password manually in Linux with sudo passwd test_user , and then look at /etc/shadow and hardcode that value in puppet. something like: user { 'test

Run `apt-get update` before installing other packages with Puppet

情到浓时终转凉″ 提交于 2019-11-28 03:06:11
I'm trying to create puppet module which automates installation of zend server CE, this is not important here, but steps are as following update /etc/apt/source.list download repos key via wget do apt-get update do apt-get install zend-server-ce-5.2 I have init.pp file class zendserverce { # https://github.com/puppetlabs/puppetlabs-stdlib file_line { 'debian_package': path => '/etc/apt/sources.list', line => 'deb http://repos.zend.com/zend-server/deb server non-free' } exec { "wget http://repos.zend.com/zend.key -O- |apt-key add -": path => ["/usr/bin", "/usr/sbin"] } exec { "apt-get update":