• 大小: 752KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-18
  • 语言: 其他
  • 标签: zabbix  ansible  IT监控  

资源简介

windows、 linux、 zabbix agent自动化安装 windows直接写的playbook linux写得是个role ,还有之前做的一个proxy批量自动化升级的,打包给大家

资源截图

代码片段和文件信息

import os
import pytest

import testinfra.utils.ansible_runner

testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
    os.environ[‘MOLECULE_INVENTORY_FILE‘]).get_hosts(‘all‘)


def test_zabbixagent_running_and_enabled(host):
    zabbixagent = host.service(“zabbix-agent“)
    # Find out why this is not working for linuxmint and opensuse
    if host.system_info.distribution not in [‘linuxmint‘ ‘opensuse‘ ‘ubuntu‘]:
        assert zabbixagent.is_running
        assert zabbixagent.is_enabled


def test_zabbix_agent_dot_conf(host):
    if host.system_info.distribution in [‘opensuse‘]:
        passwd = host.file(“/etc/zabbix/zabbix-agentd.conf“)
    else:
        passwd = host.file(“/etc/zabbix/zabbix_agentd.conf“)
    assert passwd.user == “root“
    assert passwd.group == “root“
    assert passwd.mode == 0o644

    assert passwd.contains(“Server=192.168.3.33“)
    assert passwd.contains(“ServerActive=192.168.3.33“)
    assert passwd.contains(“DebugLevel=3“)
    assert passwd.contains(“TLSAccept=psk“)
    assert passwd.contains(“TLSPSKIdentity=my_Identity“)
    assert passwd.contains(“TLSPSKFile=/data/certs/zabbix.psk“)


def test_zabbix_agent_psk(host):
    psk_file = host.file(“/data/certs/zabbix.psk“)
    assert psk_file.user == “zabbix“
    assert psk_file.group == “zabbix“
    assert psk_file.mode == 0o400
    assert psk_file.contains(“97defd6bd126d5ba7fa5f296595f82eac905d5eda270207a580ab7c0cb9e8eab“)


def test_zabbix_include_dir(host):
    zabbixagent = host.file(“/etc/zabbix/zabbix_agentd.d“)
    assert zabbixagent.is_directory
    assert zabbixagent.user == “root“
    assert zabbixagent.group == “root“


def test_socket(host):
    # Find out why this is not working for linuxmint and opensus
    if host.system_info.distribution not in [‘linuxmint‘ ‘opensuse‘]:
        assert host.socket(“tcp://0.0.0.0:10050“).is_listening


@pytest.mark.parametrize(“zabbix_packages“ [
    (“zabbix-agent“)
])
def test_zabbix_package(host zabbix_packages):
    zabbixagent = host.package(zabbix_packages)
    assert zabbixagent.is_installed

    if host.system_info.distribution == ‘debian‘:
        assert zabbixagent.version.startswith(“1:4.0“)
    if host.system_info.distribution == ‘centos‘:
        assert zabbixagent.version.startswith(“4.0“)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件         34  2019-06-19 10:24  zabbix installation\windows_agent\ansible.cfg

     文件       9997  2019-06-20 09:27  zabbix installation\windows_agent\files\zabbix_agentd.conf

     文件     692282  2019-06-19 14:42  zabbix installation\windows_agent\files\zabbix_agents-4.2.3-win-amd64.zip

     文件        198  2019-06-19 13:57  zabbix installation\windows_agent\group_vars\test

     文件        198  2019-06-19 13:57  zabbix installation\windows_agent\group_vars\windows

     文件        157  2019-06-19 13:55  zabbix installation\windows_agent\inventory

     文件       1113  2019-06-20 09:38  zabbix installation\windows_agent\playbook.yml

     文件         33  2019-06-13 17:00  zabbix installation\zabbix_agent\ansible.cfg

     文件        996  2019-06-14 11:14  zabbix installation\zabbix_agent\inventory

     文件        935  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\.github\ISSUE_TEMPLATE\bug---issue-report.md

     文件        428  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\.github\ISSUE_TEMPLATE\feature_request.md

     文件        110  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\.gitignore

     文件        516  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\.travis.yml

     文件        196  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\.yamllint

     文件       9786  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\CHANGELOG.md

     文件       3358  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\CODE_OF_CONDUCT.md

     文件       3013  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\CONTRIBUTING.md

     文件       6809  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\defaults\main.yml

     文件        109  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\files\sample.conf

     文件        398  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\handlers\main.yml

     文件       1073  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\LICENSE

     文件        721  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\meta\main.yml

     文件        961  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\before-last-version\Dockerfile.j2

     文件        369  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\before-last-version\INSTALL.rst

     文件       1212  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\before-last-version\molecule.yml

     文件       1079  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\before-last-version\playbook.yml

     文件       2287  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\before-last-version\tests\test_default.py

     文件       3814  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\default\create.yml

     文件       1097  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\default\destroy.yml

     文件        961  2019-06-04 22:47  zabbix installation\zabbix_agent\roles\ansible-zabbix-agent-master\molecule\default\Dockerfile.j2

............此处省略114个文件信息

评论

共有 条评论