- name: Attach CSV to record
uri:
url: "https://dev53556.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id={{ sysid }}&file_name=ticketCSV.csv"
method: POST
user: "{{ sn_username }}"
password: "{{ sn_password }}"
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
src: .....
remote_src: yes/no
return_content: yes
我当前正在使用ansible v2.3.5,因此无法访问uri模块内置的“ src”参数。在较低版本的ansible中,是否有其他替代方法?谢谢
答案 0 :(得分:0)
您可以自己使用file lookup
加载文件 - name: Attach CSV to record
uri:
url: "https://dev53556.service-now.com/api/now/attachment/file?table_name=incident&table_sys_id={{ sysid }}&file_name=ticketCSV.csv"
method: POST
user: "{{ sn_username }}"
password: "{{ sn_password }}"
force_basic_auth: yes
headers:
Content-Type: "application/json"
Accept: "application/json"
body: '{{ lookup("file", "path/to/file") }}'
remote_src: yes/no
return_content: yes