Automation 在Ansible的get_uri模块中注册网页后,设置事实或调试网页时出错
每次为注册网页设置事实时,我都会遇到一个问题,错误是: u'redirected':False}]}:模板化字符串时出现模板错误:1238处出现意外字符u'&' 剧本如下:Automation 在Ansible的get_uri模块中注册网页后,设置事实或调试网页时出错,automation,ansible,ansible-2.x,ansible-facts,ansible-template,Automation,Ansible,Ansible 2.x,Ansible Facts,Ansible Template,每次为注册网页设置事实时,我都会遇到一个问题,错误是: u'redirected':False}]}:模板化字符串时出现模板错误:1238处出现意外字符u'&' 剧本如下: - name: check webpage uri: url: http://{{ item.host }}.x.x.x validate_certs: False return_content: yes status_code: 200 register: webpa
- name: check webpage
uri:
url: http://{{ item.host }}.x.x.x
validate_certs: False
return_content: yes
status_code: 200
register: webpage3
with_items: "{{ servers }}"
when:
- lb is defined
- lb == "true"
- name: debug webpage
set_fact:
fact: "{{ webpage3 }}"
when:
- lb is defined
ignore_errors: yes
我的ansible版本是ansible 2.2.1.0
那么,我的网页本身有问题吗?有没有办法跳过这个错误
在排除故障后,我发现它失败是因为一条以
谢谢大家,我已经解决了这个问题,在uri模块中为一个文件提供dest,然后使用sed删除不需要的字符,然后将输出注册到一个新值以设置\u fact from,最后使用grep命令将所需的值变大。由于很难跳过输出中的那些字符您是否可以调试输出,并尝试更改事实
的标识?两个都尝试过甚至使用msg调试相同的输出集事实以产生新的结果,例如,但相同的输出请在代码段中显示实际的错误输出。