首先,我还是个有责任感的新手,所以请原谅我的无知。
我不知道这是否可能,但我正试图获取此命令生成的url:

curl -s https://api.github.com/repos/Radarr/Radarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4

并在播放中使用它下载软件包:
这是我的剧本:
  - name: download Radarr
    get_url:
      url: "{{ Radarr_exe_url }}" #should be the url from above
      dest: "{{ Radarr_data_path }}"
    become: true
    become_user: "{{ Radarr_user_name }}"
    notify:
      - Restart Radarr service

最佳答案

- name:               Get Radar exe url
  shell:              curl -s https://api.github.com/repos/Radarr/Radarr/releases | grep linux.tar.gz | grep browser_download_url | head -1 | cut -d \" -f 4
  register:           shell_output
- set_fact:
    Radarr_exe_url : "{{ shell_output.stdout }}"

关于linux - 如何执行shell脚本并在ansible中使用结果,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46268590/

10-13 05:33