我一直试图登录网页并从中获取/下载一些特定数据,但无法成功。可能吗?
如果需要下载特定文件,并且可以通过http://username:[email protected]/path/file.conf进行下载,则可以使用get_url模块:
- name: < Fetch file that requires authentication.
get_url:
url: http://example.com/path/file.conf
dest: /etc/foo.conf
url_username: bar
url_password: '{{ mysecret }}'
https://docs.ansible.com/ansible/latest/modules/get_url_module.html
如果您需要任意身份验证,为什么不只用普通的python / bash编写它并使用Ansible触发脚本,以使您不受Ansible身份验证支持的约束?
https://docs.ansible.com/ansible/latest/modules/script_module.html