• 利用saltstack批量安装clamav杀毒软件


    源码包安装:
    clamav_source:
      file.managed:
        - name: /tmp/clamav-0.99.2.tar.gz
        - unless: test -f /tmp/clamav-0.99.2.tar.gz  //如果没有这个文件,才会执行。
        - source: salt://clamav/package/clamav-0.99.2.tar.gz
    clamav_unzip:
      cmd.run:
        - cwd: /tmp
        - name: tar -zxf clamav-0.99.2.tar.gz
        - unless: test -f /tmp/clamav-0.99.2
        - require:
          - file: clamav_source
    clamav_pkg:
      pkg.installed:
        - names:
          - gcc  //源码安装需要编译器
          - make
    clamav_install:
      cmd.run:
        - cwd: /tmp/clamav-0.99.2
        - unless: test
        - name: ./configure --prefix=/usr/local/clamav && make && make install
        - require:
          - cmd: clamav_unzip
          - pkg: clamav_pkg
    
    同步配置文件:
    conf_file1:
      file.managed:
        - name: /usr/local/clamav/etc/clamd.conf
        - source: salt://clamav/conf_file/clamd.conf
        - unless: test -f /usr/local/clamav/etc/clamd.conf
    conf_file2:
      file.managed:
        - name: /usr/local/clamav/etc/freshclam.conf
        - source: salt://clamav/conf_file/freshclam.conf
        - unless: test -f /usr/local/clamav/etc/freshclam.conf
    
    创建用户:
    create_user:
      user.present:
        - name: clamav
        - require:
          - group: creat_group
        - groups:
          - clamav
    creat_group:
      group.present:
        - name: clamav
    
    
    创建目录和文件:
    create_dir:
      cmd.run:
        - name: mkdir /usr/local/clamav/logs && mkdir /usr/local/clamav/updata
    create_log:
      cmd.run:
        - name: touch /usr/local/clamav/logs/clamd.log && touch /usr/local/clamav/logs/freshclam.log
        - require:
          - cmd: create_dir
    
    文件授权:
    change_perm:
      cmd.run:
        - name: chown clamav.clamav /usr/local/clamav/logs/clamd.log && chown clamav.clamav /usr/local/clamav/logs/freshclam.log && chown clamav.clamav /usr/local/clamav/updata
        - require:
          - cmd: create_log
          - cmd: create_user
     
    

      注:应把所需要的文件,复制到对应文件夹中。

  • 相关阅读:
    Vmware中“重新安装vmware-tools”按钮置灰如何解决
    如何实现Sublime Text3快速生成html代码
    Windows窗体编程你也行
    .NET基础技术总结
    C#考试题第一波
    C#认证题4(使用标准Windons窗体控件)
    通讯录数据库
    C#认证试题(3)
    c#认证题(2)
    c#认证试题
  • 原文地址:https://www.cnblogs.com/houyongchong/p/7976327.html
Copyright © 2020-2023  润新知