ERROR! conflicting action statements: hosts, tasks
The error appears to be in '/home/a899444/aerospike-ansible/roles/java_install/tasks/main.yml': line 1, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Java installation ^ here
- name: Java installation
hosts: remote_server
become: true
tasks:
- name: Download the JDK binaries
get_url:
url: https://download.java.net/java/GA/jdk18.0.2.1/db379da656dc47308e138f21b33976fa/1/GPL/openjdk-18.0.2.1_linux-x64_bin.tar.gz
dest: /opt/openjdk-18.0.2.1_linux-x64_bin.tar.gz
- name: Unzip the downloaded file
unarchive:
src: /opt/openjdk-18.0.2.1_linux-x64_bin.tar.gz
dest: /opt
remote_src: yes
- name: Set the JAVA_HOME in /etc/profile file
lineinfile:
path: /etc/profile
state: present
line: "{{ item }}"
with_items:
- 'export JAVA_HOME="/opt/jdk-18.0.2.1"'
- 'export PATH=$PATH:$JAVA_HOME/bin'
- name: Reload /etc/profile file
shell:
cmd: source /etc/profile