我正在尝试通过Ansible在Ubuntu 20上安装Java 1.7。
攻略:
- hosts: all
tasks:
- name: Get the JDK installer
become: true
get_url:
url: https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz
dest: /usr/lib/jvm/
java_home: "{{ dest }}/jdk-{{ java_version }}"
- name: Unarchive Java distribution file.
unarchive:
src: /usr/lib/jvm/openjdk-17_linux-x64_bin.tar.gz
dest: /usr/lib/jvm/
remote_src: yes
list_files: yes它在第一个- name块上抛出错误。
ERROR! conflicting action statements: get_url, url
The error appears to be in '/home/ubuntu/ansible01/install_jdk17.yml': line 5, column 7, but may
be elsewhere in the file depending on the exact syntax problem.令人不快的行看起来是
tasks:
- name: Get the JDK installer
^ here如果有人给我解决这个问题的建议或方向,我将非常感谢。
发布于 2021-09-29 06:18:00
根据错误消息和您的攻略,您缺少参数url的缩进。
- name: Get the JDK installer
become: true
get_url:
url: https://download.java.net/java/GA/jdk17/0d483333a00540d886896bac774ff48b/35/GPL/openjdk-17_linux-x64_bin.tar.gz
dest: /usr/lib/jvm/module get_url也没有参数java_home。
您可以通过以下方式总结您的步骤
- name: Download and unpack
unarchive:
src: "https://{{ URL }}/{{ FILENAME }}-{{ JAVA_VERSION }}_linux-x64_bin.tar.gz"
dest: /usr/lib/jvm
remote_src: yes
tags: download,unpack来自module unarchive:“如果remote_src=yes和src包含://__,远程机器将首先从URL下载文件。”
https://stackoverflow.com/questions/69367649
复制相似问题