SaltStack源码分析之pkg状态模块
pkg状态模块使用各个操作系统自带的包管理工具来安装各种软件包,例如RedHat系列使用YUM安装软件包,Ubuntu使用apt-get安装等/usr/lib/python2.6/site-packages/salt/states/pkg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Installation of packages using OS package managers such as yum or apt-get
=========================================================================
Salt can manage software packages via the pkg state module, packages can be
set up to be installed, latest, removed and purged. Package management
declarations are typically rather simple:
.. code-block:: yaml
vim:
pkg.installed
A more involved example involves pulling from a custom repository.
Note that the pkgrepo has a require_in clause.
This is necessary and can not be replaced by a require clause in the pkg.
.. code-block:: yaml
base:
pkgrepo.managed:
- humanname: Logstash PPA
- name: ppa:wolfnet/logstash
- dist: precise
- file: /etc/apt/sources.list.d/logstash.list
- keyid: 28B04E4A
- keyserver: keyserver.ubuntu.com
- require_in:
- pkg: logstash
logstash:
pkg.installed
'''
页:
[1]