我想安排以下剧本:
- hosts: win_hv_hosts
tasks:
- name: Return list of found updates and log to C:\ans_found_updates.txt
win_updates:
category_names: SecurityUpdates
state: searched
log_path: C:/ans_found_updates.txt
我的win_hv_hosts:
[win_hv_hosts]
192.168.1.36
192.168.1.37
[win_hv_hosts:vars]
ansible_user = user@DOMAIN.COM
ansible_password = Password
ansible_connection = winrm
ansible_winrm_server_cert_validation=ignore
ansible_port = 5985
手动运行时
sudo ansible-playbook win_check_updates.yml -f 10
一切正常。我想安排它与cron一起运行:
0 * * * * /usr/bin/ansible-playbook /etc/ansible/win_check_updates.yml -f 10 > /home/user/crontab.log
我遇到错误:
fatal: [192.168.1.36]: UNREACHABLE! => {"changed": false, "msg": "plaintext: the specified credentials were rejected by the server", "unreachable": true}
fatal: [192.168.1.37]: UNREACHABLE! => {"changed": false, "msg": "plaintext: the specified credentials were rejected by the server", "unreachable": true}
PLAY RECAP *********************************************************************
192.168.1.36 : ok=0 changed=0 unreachable=1 failed=0
192.168.1.37 : ok=0 changed=0 unreachable=1 failed=0
我想念什么?
答案 0 :(得分:0)
那么凭据错误是因为您以纯文本指定了密码。使用加密或Ansible保管库对密码进行加密。
就正常执行而言,即您未提供纯文本密码,对吗?
如果这可行,那么ansible调用会出现一些问题
为什么您还使用sudo执行剧本?
答案 1 :(得分:0)
添加
name
解决我的问题