Chinaunix首页 | 论坛 | 博客
  • 博客访问: 329853
  • 博文数量: 62
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-14 14:12
个人简介

太懒

文章分类

全部博文(62)

文章存档

2015年(8)

2014年(20)

2013年(34)

我的朋友

分类: LINUX

2013-05-27 15:38:15

这几天闲下来研究了一下puppet的环境,实际测试一下,先分三个环境: 开发、测试和生产。

 

图表1

 

Develop 提交到中心库,然后Testing环境检出,测试环境测试。 A—>B—>C-->D1

测试有问题,Develop环境重新修改,提交到中心库;重复测试。 D1—>D2-->A—>B—>C-->D1

没问题Production环境检出,部署到生产环境. D1—>E-->F

 

 

1. 首先在puppet master的配置文件中添加相应的配置段,如下:

 

[main]
  modulepath = /etc/puppet_sotre/main/modules
  manifest = /etc/puppet_sotre/main/manifests/site.pp

#[prov]
  #modulepath = /etc/puppet_sotre/prov/modules
  #manifest = /etc/puppet_sotre/prov/manifests/site.pp

[testing]
  modulepath = /etc/puppet_sotre/test/modules
  manifest = /etc/puppet_sotre/test/manifests/site.pp

[develop]
  modulepath = /etc/puppet_sotre/dev/modules
  manifest = /etc/puppet_sotre/dev/manifests/site.pp

 

2. 建立git中心库

中心库跟puppet主机在一个机器上,安全起见,放在不同的硬盘上,至少有个备份

两个库,一个放配置文件,一个放modules等

[root@my2950 pub]# cd /var/ftp/pub/
[root@my2950 pub]# mkdir -p ./mygit/{puppet.store,puppet.conf}
[root@my2950 pub]#

[root@my2950 pub]# cd mygit/puppet.conf/
[root@my2950 puppet.conf]#
[root@my2950 puppet.conf]# git init --bare;
Initialized empty Git repository in /var/ftp/pub/mygit/puppet.conf/
[root@my2950 puppet.conf]#

[root@my2950 puppet.conf]# cd ../puppet.store/
[root@my2950 puppet.store]# git init --bare;
Initialized empty Git repository in /var/ftp/pub/mygit/puppet.store/
[root@my2950 puppet.store]#

--bare参数最好加上,省的以后麻烦,具体原因问google,不再摘录

 

 

3.  开发环境

[root@my2950 puppet.conf]# mkdir -p /etc/puppet_sotre
[root@my2950 puppet.conf]# cd /etc/puppet_sotre/
[root@my2950 puppet_sotre]#

clone 主库

git clone /var/ftp/pub/mygit/puppet.store develop

/var/ftp/pub/mygit/puppet.conf

[root@my2950 puppet_sotre]# pwd
/etc/puppet_sotre
[root@my2950 puppet_sotre]# ls -al
total 16
drwxr-xr-x    2 root root  4096 May 24 16:44 .
drwxr-xr-x. 105 root root 12288 May 24 03:36 ..
[root@my2950 puppet_sotre]#

[root@my2950 puppet_sotre]# git clone /var/ftp/pub/mygit/puppet.store develop
Cloning into 'develop'...
warning: You appear to have cloned an empty repository.
done.
[root@my2950 puppet_sotre]# ls -al
total 20
drwxr-xr-x    3 root root  4096 May 24 16:44 .
drwxr-xr-x. 105 root root 12288 May 24 03:36 ..
drwxr-xr-x    3 root root  4096 May 24 16:44 develop
[root@my2950 puppet_sotre]#

填充开发环境

[root@my2950 puppet_sotre]#
[root@my2950 puppet_sotre]# cd develop/
[root@my2950 develop]#
[root@my2950 develop]# cp -r /etc/puppet/manifests/ ./
[root@my2950 develop]# cp -r /etc/puppet/modules/ ./
[root@my2950 develop]# ls -al
total 20
drwxr-xr-x 5 root root 4096 May 24 16:46 .
drwxr-xr-x 3 root root 4096 May 24 16:46 ..
drwxr-xr-x 7 root root 4096 May 24 16:44 .git
drwxr-xr-x 3 root root 4096 May 24 16:46 manifests
drwxr-xr-x 5 root root 4096 May 24 16:46 modules
[root@my2950 develop]#

 

[root@my2950 develop]# git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#       manifests/
#       modules/
nothing added to commit but untracked files present (use "git add" to track)
[root@my2950 develop]# git add .
[root@my2950 develop]# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached ..." to unstage)
#
#       new file:   manifests/node.pp
#       new file:   manifests/nodes/node1.hjshi.com
#       new file:   manifests/site.pp
#       new file:   modules/dnsclient/files/resolv.conf
#       new file:   modules/dnsclient/manifests/init.pp
#       new file:   modules/mycrond/manifests/init.pp
#       new file:   modules/myvimrc/files/vimrc
#       new file:   modules/myvimrc/manifests/init.pp
#
[root@my2950 develop]# git commit -a -m "init develop"
[master (root-commit) 675a779] init develop
7 files changed, 133 insertions(+)
create mode 100644 manifests/node.pp
create mode 100644 manifests/nodes/node1.hjshi.com
create mode 100644 manifests/site.pp
create mode 100644 modules/dnsclient/files/resolv.conf
create mode 100644 modules/dnsclient/manifests/init.pp
create mode 100644 modules/mycrond/manifests/init.pp
create mode 100644 modules/myvimrc/files/vimrc
create mode 100644 modules/myvimrc/manifests/init.pp
[root@my2950 develop]#

[root@my2950 develop]# git status
# On branch master
nothing to commit (working directory clean)
[root@my2950 develop]#

提交到中心库

[root@my2950 develop]# git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '/var/ftp/pub/mygit/puppet.store'
[root@my2950 develop]#
[root@my2950 develop]# git push origin master
Counting objects: 21, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (21/21), 2.06 KiB, done.
Total 21 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (21/21), done.
To /var/ftp/pub/mygit/puppet.store
* [new branch]      master -> master
[root@my2950 develop]#

 

4. 测试环境

测试环境跟生产环境一样,只检出不修改,有问题直接回到开发环境

git clone /var/ftp/pub/mygit/puppet.store testing

[root@my2950 develop]# cd /etc/puppet_sotre/
[root@my2950 puppet_sotre]# ll
total 4
drwxr-xr-x 5 root root 4096 May 24 16:46 develop
[root@my2950 puppet_sotre]# git clone /var/ftp/pub/mygit/puppet.store testing
Cloning into 'testing'...
done.
[root@my2950 puppet_sotre]# ls -al
total 24
drwxr-xr-x    4 root root  4096 May 24 17:06 .
drwxr-xr-x. 105 root root 12288 May 24 03:36 ..
drwxr-xr-x    5 root root  4096 May 24 16:46 develop
drwxr-xr-x    5 root root  4096 May 24 17:06 testing
[root@my2950 puppet_sotre]# ls -al testing/
total 20
drwxr-xr-x 5 root root 4096 May 24 17:06 .
drwxr-xr-x 4 root root 4096 May 24 17:06 ..
drwxr-xr-x 8 root root 4096 May 24 17:06 .git
drwxr-xr-x 3 root root 4096 May 24 17:06 manifests
drwxr-xr-x 5 root root 4096 May 24 17:06 modules
[root@my2950 puppet_sotre]#

简单做个测试在develop环境修改一个文件,提交到中心库,然后从testing环境检出

 

 

[root@my2950 puppet_sotre]# pwd
/etc/puppet_sotre
[root@my2950 puppet_sotre]# cd develop/
[root@my2950 develop]# ll
total 8
drwxr-xr-x 3 root root 4096 May 24 16:46 manifests
drwxr-xr-x 5 root root 4096 May 24 16:46 modules
[root@my2950 develop]# echo "develop" >develop.env
[root@my2950 develop]# ll
total 12
-rw-r--r-- 1 root root    8 May 24 17:08 develop.env
drwxr-xr-x 3 root root 4096 May 24 16:46 manifests
drwxr-xr-x 5 root root 4096 May 24 16:46 modules
[root@my2950 develop]# git add .
[root@my2950 develop]# git commit -a -m "add develop.env"
[master 183afd2] add develop.env
1 file changed, 1 insertion(+)
create mode 100644 develop.env
[root@my2950 develop]# git push
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 317 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /var/ftp/pub/mygit/puppet.store
   675a779..183afd2  master -> master
[root@my2950 develop]#

 

[root@my2950 develop]# cd ../testing/
[root@my2950 testing]# ll
total 8
drwxr-xr-x 3 root root 4096 May 24 17:06 manifests
drwxr-xr-x 5 root root 4096 May 24 17:06 modules
[root@my2950 testing]# git pull
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /var/ftp/pub/mygit/puppet.store
   675a779..183afd2  master     -> origin/master
Updating 675a779..183afd2
Fast-forward
develop.env | 1 +
1 file changed, 1 insertion(+)
create mode 100644 develop.env
[root@my2950 testing]#
[root@my2950 testing]# ll
total 12
-rw-r--r-- 1 root root    8 May 24 17:09 develop.env
drwxr-xr-x 3 root root 4096 May 24 17:06 manifests
drwxr-xr-x 5 root root 4096 May 24 17:06 modules
[root@my2950 testing]# cat develop.env
develop
[root@my2950 testing]#

 

5. 生产环境

只检出不修改,有问题直接回到开发环境,正常流程下不应该有问题了。。。

git clone ./testing/ main main

[root@my2950 puppet_sotre]# git clone /var/ftp/pub/mygit/puppet.store main
Cloning into 'main'...
done.
[root@my2950 puppet_sotre]# ll
total 12
drwxr-xr-x 5 root root 4096 May 24 17:08 develop
drwxr-xr-x 5 root root 4096 May 24 17:15 main
drwxr-xr-x 5 root root 4096 May 24 17:09 testing
[root@my2950 puppet_sotre]# ll main/
total 12
-rw-r--r-- 1 root root    8 May 24 17:15 develop.env
drwxr-xr-x 3 root root 4096 May 24 17:15 manifests
drwxr-xr-x 5 root root 4096 May 24 17:15 modules
[root@my2950 puppet_sotre]#

[root@my2950 puppet_sotre]# git clone ./testing/ main main
Cloning into 'main'...
done.
[root@my2950 puppet_sotre]#

[root@my2950 puppet_sotre]# cd main
[root@my2950 main]# ls -al
total 24
drwxr-xr-x 5 root root 4096 May 27 15:14 .
drwxr-xr-x 7 root root 4096 May 27 15:14 ..
-rw-r--r-- 1 root root    8 May 27 15:14 develop.env
drwxr-xr-x 8 root root 4096 May 27 15:14 .git
drwxr-xr-x 3 root root 4096 May 27 15:14 manifests
drwxr-xr-x 5 root root 4096 May 27 15:14 modules
[root@my2950 main]#

 

6. 填充另一个git库

git clone /var/ftp/pub/mygit/puppet.conf vpuppet.conf

[root@my2950 puppet_sotre]# git clone /var/ftp/pub/mygit/puppet.conf vpuppet.conf
Cloning into 'vpuppet.conf'...
warning: You appear to have cloned an empty repository.
done.
[root@my2950 puppet_sotre]# ll
total 16
drwxr-xr-x 5 root root 4096 May 24 17:08 develop
drwxr-xr-x 5 root root 4096 May 24 17:15 main
drwxr-xr-x 5 root root 4096 May 24 17:09 testing
drwxr-xr-x 3 root root 4096 May 24 17:18 vpuppet.conf
[root@my2950 puppet_sotre]#

 

[root@my2950 puppet_sotre]# cd vpuppet.conf/
[root@my2950 vpuppet.conf]# ls -al
total 12
drwxr-xr-x 3 root root 4096 May 24 17:18 .
drwxr-xr-x 6 root root 4096 May 24 17:18 ..
drwxr-xr-x 7 root root 4096 May 24 17:18 .git
[root@my2950 vpuppet.conf]# cp /etc/pu
pulse/        puppet/       puppet_sotre/
[root@my2950 vpuppet.conf]# cp /etc/puppet/
auth.conf        fileserver.conf  manifests/       puppet.conf
config.txt       .git/            modules/
[root@my2950 vpuppet.conf]# cp /etc/puppet/* ./
cp: omitting directory `/etc/puppet/manifests'
cp: omitting directory `/etc/puppet/modules'
[root@my2950 vpuppet.conf]# ll
total 48
-rw-r--r-- 1 root root  2552 May 24 17:20 auth.conf
-rw-r--r-- 1 root root 33187 May 24 17:20 config.txt
-rw-r--r-- 1 root root    57 May 24 17:20 fileserver.conf
-rw-r--r-- 1 root root   982 May 24 17:20 puppet.conf
[root@my2950 vpuppet.conf]#

 

 

添加到版本库

 

 

[root@my2950 vpuppet.conf]# git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#       auth.conf
#       config.txt
#       fileserver.conf
#       puppet.conf
nothing added to commit but untracked files present (use "git add" to track)
[root@my2950 vpuppet.conf]# git add .
[root@my2950 vpuppet.conf]# git commit -a -m "init puppet.conf"
[master (root-commit) 120d775] init puppet.conf
4 files changed, 1358 insertions(+)
create mode 100644 auth.conf
create mode 100644 config.txt
create mode 100644 fileserver.conf
create mode 100644 puppet.conf
[root@my2950 vpuppet.conf]#
[root@my2950 vpuppet.conf]#
[root@my2950 vpuppet.conf]# git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '/var/ftp/pub/mygit/puppet.conf'
[root@my2950 vpuppet.conf]# git push origin master
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 11.96 KiB, done.
Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done.
To /var/ftp/pub/mygit/puppet.conf
* [new branch]      master -> master
[root@my2950 vpuppet.conf]#
[root@my2950 vpuppet.conf]# git status
# On branch master
nothing to commit (working directory clean)
[root@my2950 vpuppet.conf]#

 

7. 检出puppet的配置文件

git clone /var/ftp/pub/mygit/puppet.conf puppet

[root@my2950 main]# cd /etc/
[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]# /etc/init.d/puppetmaster stop
Stopping puppetmaster:                                     [  OK  ]
[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]# mv puppet puppet.orig
[root@my2950 etc]#
[root@my2950 etc]# ls -al |grep puppet
drwxr-xr-x    5 root root   4096 May 23 14:16 puppet.orig
drwxr-xr-x    7 root root   4096 May 27 15:14 puppet_sotre
[root@my2950 etc]# git clone /var/ftp/pub/mygit/puppet.conf puppet
Cloning into 'puppet'...
done.
[root@my2950 etc]# ls -al |grep puppet
drwxr-xr-x    3 root root   4096 May 27 15:27 puppet
drwxr-xr-x    5 root root   4096 May 23 14:16 puppet.orig
drwxr-xr-x    7 root root   4096 May 27 15:14 puppet_sotre
[root@my2950 etc]# ls -al puppet
total 68
drwxr-xr-x    3 root root  4096 May 27 15:27 .
drwxr-xr-x. 106 root root 12288 May 27 15:27 ..
-rw-r--r--    1 root root  2552 May 27 15:27 auth.conf
-rw-r--r--    1 root root 33187 May 27 15:27 config.txt
-rw-r--r--    1 root root    57 May 27 15:27 fileserver.conf
drwxr-xr-x    8 root root  4096 May 27 15:27 .git
-rw-r--r--    1 root root   982 May 27 15:27 puppet.conf
[root@my2950 etc]#

 

测试修改配置文件

[root@my2950 main]# cd /etc/
[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]# m/etc/init.d/puppetmaster stop
Stopping puppetmaster: [  OK  ]

[root@my2950 etc]#
[root@my2950 etc]#
[root@my2950 etc]# clearmv puppet puppet.orig
[root@my2950 etc]#
[root@my2950 etc]# git clone ls -al |grep puppet
drwxr-xr-x    5 root root   4096 May 23 14:16 puppet.orig
drwxr-xr-x    7 root root   4096 May 27 15:14 puppet_sotre
[root@my2950 etc]# git clone /var/ftp/pub/mygit/puppet.conf puppet
Cloning into 'puppet'...
done.
[root@my2950 etc]# git clone /var/ftp/pub/mygit/puppet.conf puppet
ls -al |grep
drwxr-xr-x    3 root root   4096 May 27 15:27 puppet
drwxr-xr-x    5 root root   4096 May 23 14:16 puppet.orig
drwxr-xr-x    7 root root   4096 May 27 15:14 puppet_sotre
[root@my2950 etc]# ls -al |grep puppetpuppet
total 68
drwxr-xr-x    3 root root  4096 May 27 15:27 .
drwxr-xr-x. 106 root root 12288 May 27 15:27 ..
-rw-r--r--    1 root root  2552 May 27 15:27 auth.conf
-rw-r--r--    1 root root 33187 May 27 15:27 config.txt
-rw-r--r--    1 root root    57 May 27 15:27 fileserver.conf
drwxr-xr-x    8 root root  4096 May 27 15:27 .git
-rw-r--r--    1 root root   982 May 27 15:27 puppet.conf
[root@my2950 etc]# pwd
/etc
[root@my2950 etc]# cd /etc/puppet_sotre/puvpuppet.conf/
auth.conf        config.txt       fileserver.conf  .git/            puppet.conf
[root@my2950 etc]# cd /etc/puppet_sotre/vpuppet.conf/
[root@my2950 vpuppet.conf]# git status
# On branch master
nothing to commit (working directory clean)
[root@my2950 vpuppet.conf]#
[root@my2950 vpuppet.conf]# vi puppet.conf
"puppet.conf" 31L, 982C  1 [main]
  …
42 42,0-182%:wq!
"puppet.conf" 46L, 1436C written

[root@my2950 vpuppet.conf]#
[root@my2950 vpuppet.conf]# git status
# On branch master
# Changes not staged for commit:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#modified:   puppet.conf
#
no changes added to commit (use "git add" and/or "git commit -a")
[root@my2950 vpuppet.conf]# git commit -a -m "modify puppet.conf add env"

[master ae40453] modify puppet.conf add env
1 file changed, 15 insertions(+)
[root@my2950 vpuppet.conf]# git commit -a -m "modify puppet.conf add env"
status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
[root@my2950 vpuppet.conf]# git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects:  33% (1/3)  
Compressing objects:  66% (2/3)  
Compressing objects: 100% (3/3)  
Compressing objects: 100% (3/3), done.
Writing objects:  33% (1/3)  
Writing objects:  66% (2/3)  
Writing objects: 100% (3/3)  
Writing objects: 100% (3/3), 436 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects:  33% (1/3)  
Unpacking objects:  66% (2/3)  
Unpacking objects: 100% (3/3)  
Unpacking objects: 100% (3/3), done.
To /var/ftp/pub/mygit/puppet.conf
   120d775..ae40453  master -> master
[root@my2950 vpuppet.conf]# pwd
/etc/puppet_sotre/vpuppet.conf
[root@my2950 vpuppet.conf]# cd ../../puppet
[root@my2950 puppet]# more puppet.conf
[main]
    autosign = true

    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    #ssldir = $confdir/ssl
    reports = store,http
    reporturl =

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
--More--(67%)
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
[root@my2950 puppet]#
[root@my2950 puppet]#
[root@my2950 puppet]# git puss
remote: Counting objects: 5, done.
remote: Compressing objects:  33% (1/3)  
remote: Compressing objects:  66% (2/3)  
remote: Compressing objects: 100% (3/3)  
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects:  33% (1/3)  
Unpacking objects:  66% (2/3)  
Unpacking objects: 100% (3/3)  
Unpacking objects: 100% (3/3), done.
From /var/ftp/pub/mygit/puppet.conf
   120d775..ae40453  master     -> origin/master
Updating 120d775..ae40453
Fast-forward
puppet.conf | 15 +++++++++++++++
1 file changed, 15 insertions(+)
[root@my2950 puppet]#
[root@my2950 puppet]# more puppet.conf
[main]
    autosign = true

    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    #ssldir = $confdir/ssl
    reports = store,http
    reporturl =

    modulepath = /etc/puppet_sotre/main/modules
    manifest = /etc/puppet_sotre/main/manifests/site.pp

#[prov]
  #modulepath = /etc/puppet_sotre/prov/modules
--More--(43%)
  #manifest = /etc/puppet_sotre/prov/manifests/site.pp

[testing]
    modulepath = /etc/puppet_sotre/test/modules
    manifest = /etc/puppet_sotre/test/manifests/site.pp

[develop]
    modulepath = /etc/puppet_sotre/dev/modules
    manifest = /etc/puppet_sotre/dev/manifests/site.pp

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
[root@my2950 puppet]#
[root@my2950 puppet]#
[root@my2950 puppet]# /etc/init.d/puppetmaster restart
Stopping puppetmaster: [FAILED]

Starting puppetmaster: [  OK  ]

[root@my2950 puppet]#
[root@my2950 puppet]# ps -eaf|grep puppet
498       4457     1  0 May23 ?        00:00:12 /usr/bin/ruby /usr/share/puppet-dashboard/script/server -e production -p 3000 -b 0.0.0.0 -d
puppet   25296     1  0 15:30 ?        00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd
root     25301 24909  0 15:30 pts/0    00:00:00 grep puppet
[root@my2950 puppet]#

 

8. 完整测试一下

[root@my2950 main]# cd ../testing/develop/
[root@my2950 develop]# ls
develop.env  manifests  modules
[root@my2950 develop]#
[root@my2950 develop]#
[root@my2950 develop]# vi develop.env
"develop.env" 1L, 8C  1 develop
~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               1,1All-- INSERT --2,1All  2  t2to3od4da5ay6
  3 3,13,0-1All:wq1
"1" [New] 3L, 15C written

E37: No write since last change (add ! to override)

E162: No write since last change for buffer "develop.env"

Press ENTER or type command to continue  1 develop
  2 today
  3 3,0-1All:wq!
"develop.env" 3L, 15C written

[root@my2950 develop]#
[root@my2950 develop]# vi develop.env
"develop.env" 3L, 15C  1 develop
  2 today
  3
~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               ~                                                                                               3,0-1All2,1  -- INSERT --2,2All345672,6All-- INSERT --2,1Top r today
  4 2All2,1All-- INSERT --2,1Top p r today
  5 2All2,1All0-1 r today~                                                                                               1   today~                                                                                               2345-- INSERT --2,6All7 08019101001110201040050162,15All:wq!
"develop.env" 3L, 26C written

[root@my2950 develop]#
[root@my2950 develop]#
[root@my2950 develop]#
[root@my2950 develop]# pwd
/etc/puppet_sotre/develop
[root@my2950 develop]# cd git pustatus
# On branch master
# Changes not staged for commit:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#modified:   develop.env
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#1
no changes added to commit (use "git add" and/or "git commit -a")
[root@my2950 develop]#
[root@my2950 develop]# git statuscommit -a -m ""m"o"d"i"e"y"""f"y" "d"e"v"e"l"o"p"."e"n"v"
[master ffa6cc5] modify develop.env
1 file changed, 2 insertions(+)
[root@my2950 develop]#
[root@my2950 develop]# git commit -a -m "modify develop.env"
status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#1
nothing added to commit but untracked files present (use "git add" to track)
[root@my2950 develop]#
[root@my2950 develop]# ll
total 16
-rw-r--r-- 1 root root   15 May 27 15:14 1
-rw-r--r-- 1 root root   26 May 27 15:18 develop.env
drwxr-xr-x 3 root root 4096 May 24 16:46 manifests
drwxr-xr-x 5 root root 4096 May 24 16:46 modules
[root@my2950 develop]#
[root@my2950 develop]# rm -f 1
[root@my2950 develop]#
[root@my2950 develop]# rm -f 1ll
total 12
-rw-r--r-- 1 root root   26 May 27 15:18 develop.env
drwxr-xr-x 3 root root 4096 May 24 16:46 manifests
drwxr-xr-x 5 root root 4096 May 24 16:46 modules
[root@my2950 develop]# llrm -f 1llgit status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
[root@my2950 develop]#
[root@my2950 develop]#
[root@my2950 develop]#
[root@my2950 develop]# git push
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects:  50% (1/2)  
Compressing objects: 100% (2/2)  
Compressing objects: 100% (2/2), done.
Writing objects:  33% (1/3)  
Writing objects:  66% (2/3)  
Writing objects: 100% (3/3)  
Writing objects: 100% (3/3), 333 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects:  33% (1/3)  
Unpacking objects:  66% (2/3)  
Unpacking objects: 100% (3/3)  
Unpacking objects: 100% (3/3), done.
To /var/ftp/pub/mygit/puppet.store
   183afd2..ffa6cc5  master -> master
[root@my2950 develop]#
[root@my2950 develop]# cd ../testing/
[root@my2950 testing]#
[root@my2950 testing]# ll
total 12
-rw-r--r-- 1 root root    8 May 24 17:09 develop.env
drwxr-xr-x 3 root root 4096 May 24 17:06 manifests
drwxr-xr-x 5 root root 4096 May 24 17:06 modules
[root@my2950 testing]#
[root@my2950 testing]# cd ../main
[root@my2950 main]# ls
develop.env  manifests  modules
[root@my2950 main]#
[root@my2950 main]#
[root@my2950 main]# git pull
Already up-to-date.
[root@my2950 main]#
[root@my2950 main]#
[root@my2950 main]# more develop.env
develop
[root@my2950 main]# cd ../
[root@my2950 puppet_sotre]# cd testing/
[root@my2950 testing]#
[root@my2950 testing]#
[root@my2950 testing]# git pull
remote: Counting objects: 5, done.
remote: Compressing objects:  50% (1/2)  
remote: Compressing objects: 100% (2/2)  
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects:  33% (1/3)  
Unpacking objects:  66% (2/3)  
Unpacking objects: 100% (3/3)  
Unpacking objects: 100% (3/3), done.
From /var/ftp/pub/mygit/puppet.store
   183afd2..ffa6cc5  master     -> origin/master
Updating 183afd2..ffa6cc5
Fast-forward
develop.env | 2 ++
1 file changed, 2 insertions(+)
[root@my2950 testing]#
[root@my2950 testing]# more develop.env
develop
today 010101001

[root@my2950 testing]#
[root@my2950 testing]# cd ../
[root@my2950 puppet_sotre]# cd main
[root@my2950 main]# ls
develop.env  manifests  modules
[root@my2950 main]#
[root@my2950 main]#
[root@my2950 main]# more develop.env
develop
[root@my2950 main]# git pull
remote: Counting objects: 5, done.
remote: Compressing objects:  50% (1/2)  
remote: Compressing objects: 100% (2/2)  
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects:  33% (1/3)  
Unpacking objects:  66% (2/3)  
Unpacking objects: 100% (3/3)  
Unpacking objects: 100% (3/3), done.
From /etc/puppet_sotre/./testing
   183afd2..ffa6cc5  master     -> origin/master
Updating 183afd2..ffa6cc5
Fast-forward
develop.env | 2 ++
1 file changed, 2 insertions(+)
[root@my2950 main]#
[root@my2950 main]# more dceevelop.env
develop
today 010101001

[root@my2950 main]#
[root@my2950 main]#

阅读(2169) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~