Ansible win_find-不输入文件夹IIS日志

Ansible win_find-不输入文件夹IIS日志,ansible,Ansible,在LogFiles文件夹中,日志位于以下子文件夹中: 试验 W3SVC990866148 W3SVC1150242952 日志文件位于这些文件夹中。Ansible进入测试文件夹,但突然没有。为什么?UZ的管理员权限,根据该权限,用户可以 测试文件夹是手动创建的。如果路径:C:\inetpub\logs\LogFiles\W3SVC990866148 \-则他会看到所有文件 tasks: - name: Find older logs file win_find:

在LogFiles文件夹中,日志位于以下子文件夹中:

  • 试验
  • W3SVC990866148
  • W3SVC1150242952
日志文件位于这些文件夹中。Ansible进入测试文件夹,但突然没有。为什么?UZ的管理员权限,根据该权限,用户可以

测试文件夹是手动创建的。如果路径:C:\inetpub\logs\LogFiles\W3SVC990866148 \-则他会看到所有文件

tasks:
    - name: Find older logs file
      win_find:
        paths: C:\inetpub\logs\LogFiles\
        recurse: yes
      register: file_results

    - debug:
        msg: "{{ file_results.files }}"
我尝试这样做: --- -名称:清除IIS日志 主持人:全部 方法:runas

[WARNING]: win_find failed to check some files, these files were ignored and

TASK [debug] *******************************************************************
task path: /tmp/awx_2383_2n4lsy56/project/clear_iis_log.yml:12
ok: [dtc-srv-sp15] => {
    "msg": [
        {
            ...
            "path": "C:\\inetpub\\logs\\LogFiles\\test\\u_ex210112.log",
            "size": 1579
        },
        {
            ...
            "path": "C:\\inetpub\\logs\\LogFiles\\test\\u_ex210114.log",
            "size": 644
        },
        {
            ...
            "path": "C:\\inetpub\\logs\\LogFiles\\test\\u_ex210119.log",
            "size": 1486
        }
    ]
}
META: ran handlers
META: ran handlers
PLAY RECAP *********************************************************************
name_host               : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
用同样的方法
无论如何都不会进入此文件夹(

这些文件被忽略,并且……
=>您截断了警告。您还可以通过
-vvv
运行playbook获得更多信息。无论如何,您需要找出原因并提供更多调试细节。同时,这看起来确实是一个权限问题。我通过RDP引导到UZ下的此主机,其中sible已连接并通过资源管理器中的路径进入此文件夹。仅通过确认UAC进入文件夹。我如何告诉Ansible以管理员身份运行?使用awx启动playbook。调试不再提供您需要的信息
我如何告诉Ansible以管理员身份运行?
=>使用comm上的
-u
选项和线路和/或在播放级别设置
remote\u user
,和/或在您的资源清册中为该主机/组设置
ansible\u user
,和/或作为您的实际用户连接,设置更新1后添加更多方式,但它们也不起作用(您正在运行哪个版本的ansible?
  vars:
    ansible_become_password: password

  tasks:
    - name: Find older logs file
      win_find:
        paths: c:\inetpub\logs\LogFiles\
        recurse: yes
        use_patterns: yes
      register: file_results
      become: yes
      become_user: user
- name: Clear IIS Logs
  hosts: all

  tasks:
    - name: Find older logs file
      win_find:
        paths: c:\inetpub\logs\LogFiles\
        recurse: yes
        use_patterns: yes
      register: file_results
      vars:
        ansible_become: yes
        ansible_become_method: runas
        ansible_become_user: user
        ansible_become_password: password
        ansible_become_flags: logon_type=new_credentials logon_flags=netcredentials_only