AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-526466

mitchell2423's questions

Martin Hope
mitchell2423
Asked: 2021-08-16 19:55:44 +0800 CST

使用 ansible tower 加载其他模块

  • 0

我正在尝试在 ansible Tower 上运行剧本,但在加载额外模块时遇到问题。我检查了剧本的配置是否正确,但仍然失败并显示以下消息...

[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details
ERROR! couldn't resolve module/action 'ansible.windows.win_package'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/tmp/bwrap_371_vfy0csh9/awx_371_vu6g6dfa/project/windows-playbook.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
    - name: Test Install
      ^ here

我可能是盲人,但我如何让 ansible tower 加载这些模块?我不确定它是我错过的设置还是剧本本身需要额外的配置......任何帮助将不胜感激。我将在下面弹出我的剧本。

---
- hosts: all

  tasks:
    - name: Test Install
      ansible.windows.win_package:
        path: \\FILESHARE\data\Software\Installer.msi
        arguments: '/q /norestart'
        state: present
ansible ansible-playbook ansible-tower
  • 1 个回答
  • 325 Views
Martin Hope
mitchell2423
Asked: 2019-12-04 21:18:20 +0800 CST

Powershell脚本未按日期过滤的问题

  • 2

我已经把这个powershell函数放在一起,基本上从脚本运行的最后一点($date变量)从NPS日志(特别拒绝身份验证尝试)中提取事件,整理出日志条目的IP和日期写入和将其添加到数组 ($array) 并将其导出到 CSV 日志。

然后我使用相同的数组 ($array) 对最近一小时的日志进行排序,查看是否存在 10 个或更多,并将符合该条件的任何日志移动到新数组 ($getip)。(有点像 fail2ban 设置,但适用于 Windows)

一切正常,除了在函数的末尾有一行我正在使用排序和计数记录,我算得很好,但它实际上不会删除 1 小时后的记录。

谁能看到我遗漏的任何东西?我很感激任何帮助。

function Get-DeniedIP {
$denied = 'C:\bin\denied.csv' #CSV log of IP's that have been linked to denied auth attempts
$whitelist = Import-Csv 'C:\bin\whitelist.csv' #Location of whitelist csv
$datepath = 'C:\bin\cache' #If it does not exist that is fine
$bannedip = 'C:\bin\banned.csv' #CSV log of IP's that have reached the max failed auth and are banned
$check = [System.IO.File]::Exists($datepath)
if ($check -like '*False*') {
    (get-date).ToString() | Out-File $datepath
    $date = Get-Date
}
else {
    $date = Get-Content $datepath
    $date = Get-Date -Date $date
}
$log = Get-EventLog -LogName Security -Message "*Network Policy Server denied*" -After $date
$array = @()
foreach ($message in $log) {
    $address = ($message.message |  Select-String -Pattern "Calling Station Identifier:\s*\d{1,3}(\.\d{1,3}){3}" -AllMatches).Matches.Value
    $address = ($address |  Select-String -Pattern "\d{1,3}(\.\d{1,3}){3}" -AllMatches).Matches.Value
    $object = New-Object -TypeName PSObject
    $object | Add-Member -Name 'IP' -MemberType Noteproperty -Value $address
    $object | Add-Member -Name 'Date' -MemberType NoteProperty -Value $message.TimeWritten
    $array += $object
}
$final = $array | where {$whitelist.IP -notcontains $_.IP}
if ($final -eq $null) {}
else {$final | Export-Csv $denied -Append}
$final

$DT = [DateTime]::Now.AddHours(-1)
$getip = $array | group-object -property IP  | where {$_.Count -gt 10 -and 

$array.Date -ge $DT} | Select -Property Name | Export-Csv $bannedip -Append

}
powershell
  • 1 个回答
  • 95 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve