【salt】salt学习笔记

1、ZMQ版本小于3.2,升级问题
a、下载zeromq源码包,编译安装,但未成功,原因尚不完全清楚。
b、rpm包安装,升级也未成功,原因也不清楚。
c、通过网络发现可以通过yum的方式升级,于是更新yum的源,yum update更新成功。

2、机器太多,希望通过salt state sls批量更新
a、zmq.sls文件规则编写:

get_source_repo:
  cmd.run:
   - name: wget -O /etc/yum.repos.d/ownsource.repo http://www.comingchina.com:8080/testing/ownsource/ownsource.repo
   - unless: test -f /etc/yum.repos.d/ownsource.repo

zmq_update:
  pkg.installed:
   - pkgs:
     - zeromq: 3.2.2-13.1
     - libzmq3
     - python26-zmq: 13.1.0-1
   - require:
     - cmd:get_source_repo

salt-minion:
  service.running:
    - enable: True
    - watch:
      - pkg: zmq_update

b、执行:salt ‘*’ state.sls zmq
c、发现部分机器更新失败,报错信息:“The following package(s) were not found, and no possible matches were found in the package db: libzmq3, python26-zmq, zeromq”。
d、在更新失败机器手动升级,提示:“6/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 – “The requested URL  returned error: 404″”。原因:机器是32位机器,源上面没有相应的问题。另寻他发升级。
e、执行失败提示:

[root@chen-123 salt]# salt 'local_18' state.sls zmq
local_18:
----------
          ID: get_source_repo
    Function: cmd.run
        Name: wget -O /etc/yum.repos.d/ownsource.repo http://www.comingchina.com:8080/testing/ownsource/ownsource.repo
      Result: True
     Comment: unless execution succeeded
     Changes:
----------
          ID: zmq_update
    Function: pkg.installed
      Result: False
     Comment: The following package(s) were not found, and no possible matches were found in the package db: libzmq3, python26-zmq, zeromq
     Changes:
----------
          ID: salt-minion
    Function: service.running
      Result: False
     Comment: One or more requisite failed
     Changes:

Summary
------------
Succeeded: 1
Failed:    2
------------
Total:     3

执行成功提示:

local_19:
----------
          ID: get_source_repo
    Function: cmd.run
        Name: wget -O /etc/yum.repos.d/ownsource.repo http://www.comingchina.com:8080/testing/ownsource/ownsource.repo
      Result: True
     Comment: unless execution succeeded
     Changes:
----------
          ID: zmq_update
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed and are at the desired version.
     Changes:
----------
          ID: salt-minion
    Function: service.running
      Result: True
     Comment: Service salt-minion is already enabled, and is in the desired state
     Changes:

Summary
------------
Succeeded: 3
Failed:    0
------------
Total:     3
此条目发表在技术生涯分类目录,贴了标签。将固定链接加入收藏夹。