salt ext_pillar 使用svn存储

master端配置:

vim /etc/salt/master

ext_pillar:
  - svn: trunk http://10.19.251.26/svn/salt_pillar  #其中trunk为你正式使用的pillar的根目录

也可写branches下具体的目录

ext_pillar:
  - svn: V_1.0.4 http://10.19.251.26/svn/salt_pillar

在master安装pysvn,master本地缓存svnadmin的账号密码

调用salt/pillar/svn_pillar.py检出svn代码到/var/cache/salt/master/pillar_svnfs

[root@deletedevweb01 pillar_svnfs]# tree
.
├── 27f84b5606cc8af977b1a947e394607f
│   ├── branches
│   │   ├── V_1.0.0
│   │   │   └── test.txt
│   │   ├── V_1.0.2
│   │   │   ├── lala.txt
│   │   │   └── test.txt
│   │   ├── V_1.0.3
│   │   │   ├── do.txt
│   │   │   ├── lala.txt
│   │   │   └── tets.txt
│   │   └── V_1.0.4
│   │       ├── lala.txt
│   │       └── testdy.txt
│   ├── tags
│   └── trunk
│       ├── do.sls
│       ├── do.txt
│       ├── lala.txt
│       ├── tets.txt
│       └── top.sls
└── b78262f6e39783dd05a8c1b379a767db

9 directories, 13 files

代码片段如下:

if not os.path.isdir(repo_dir):
            os.makedirs(repo_dir)
            log.debug('Checking out fileserver for svn_pillar module')
            try:
                CLIENT.checkout(repo_location, repo_dir)
            except pysvn.ClientError:
                log.error('Failed to initialize svn_pillar {0} {1}'.format(repo_location, repo_dir))

debug log如下:

2015-04-23 16:24:13,070 [salt.loaded.int.pillar.svn_pillar          ][INFO    ] =========ext_pillar_sources========[{'svn': 'trunk http://10.19.251.26/svn/salt_pillar'}]
2015-04-23 16:24:13,071 [salt.loaded.int.pillar.svn_pillar          ][INFO    ] +++++++repo_dir+++++++++/var/cache/salt/master/pillar_svnfs/27f84b5606cc8af977b1a947e394607f
2015-04-23 16:24:13,071 [salt.loaded.int.pillar.svn_pillar          ][INFO    ] ========repo_location=========http://10.19.251.26/svn/salt_pillar
2015-04-23 16:24:13,071 [salt.loaded.int.pillar.svn_pillar          ][DEBUG   ] Checking out fileserver for svn_pillar module
2015-04-23 16:24:13,433 [salt.loaded.int.pillar.svn_pillar          ][INFO    ] --------working_dir----------/var/cache/salt/master/pillar_svnfs/27f84b5606cc8af977b1a947e394607f/trunk/


你可能感兴趣的:(SALT,ext_pillar)