i had a play like this

  - name: Install jdk
    become: yes
    become_method: sudo
    become_user: root
    command: rpm -ivf /tmp/kafka-src/{{ jdkInstaller }}
    when: "'oraclejdk' not in is_jdkInstalled.stdout"

i wanted to add directory delete,  directory create and file copy

  - name: Install jdk
    become: yes
    become_method: sudo
    become_user: root
    shell: rm -rf /tmp/kafka-src
    - file:
        path=/tmp/kafka-src state=directory
        state: directory
    - copy:
        src: "{{ BuildSrvPkgLoc }}/{{ jdkInstaller }}"
        dest: /tmp/kafka-src/
    command: rpm -ivf /tmp/kafka-src/{{ jdkInstaller }}
    when: "'oraclejdk' not in is_jdkInstalled.stdout"

it did not like the -file or -copy

then i tried

  - name: Install jdk
    become: yes
    become_method: sudo
    become_user: root
    shell: rm -rf /tmp/kafka-src
    file: path=/tmp/kafka-src state=directory
    copy: src={{ BuildSrvPkgLoc }}/{{ jdkInstaller }} dest=/tmp/kafka-src/
    command: rpm -ivf /tmp/kafka-src/{{ jdkInstaller }}
    #when: is_installed.rc == 1
    when: "'oraclejdk' not in is_jdkInstalled.stdout"

this says syntax error at -name now.

can you please help me understand where the syntax error is? Is there a way 
to get more useful syntax errors? Is there a syntax checker or synta helper 
online?

I spend more time fixing syntax errors than actually creating play logic. 
Please help. thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7191f935-3f21-4996-989d-01876268f447%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to