如果系统安装了 Oracle Linux,如何检查已安装的操作系统并继续下载文件。
这就是我要做的
- hosts: all
become: true
gather_facts: true
tasks:
- name: Check if oracle linux is installed
shell: |
cat: /etc/system-release
register: os_name
ignore_errors: yes
- debug:
msg: "{{os_name.stdout}}"```
Run Code Online (Sandbox Code Playgroud)
- hosts: all
become: yes
gather_facts: true
tasks:
- name: downloading file if Oracle Linux is there
get_url:
url: #url of the file to download
dest: #path where you want to store it eg. /etc/downloaded-file
mode: '0600' #permissions to be given to the file
when: ansible_facts['distribution'] == "OracleLinux"
Run Code Online (Sandbox Code Playgroud)
您可能想阅读此参考资料。
1.从系统发现变量:事实
2.从 HTTP、HTTPS 或 FTP 下载文件到节点
| 归档时间: |
|
| 查看次数: |
29775 次 |
| 最近记录: |