Showing Syntax error in a module

Hello, I am trying to deploying wordpress using Ansible for first time. I installed LAMP on my remote server using Ansible but there was a syntax error while I was trying to install wordpress. it shows–

The error appears to have been in ‘/home/nxadmin/wordpress-ansible/roles/wordpress/tasks/main.yml’: line 2, column 36, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

Hello, I am trying to deploying wordpress using Ansible for first time. I
installed LAMP on my remote server using Ansible but there was a syntax
error while I was trying to install wordpress. it shows--

The error appears to have been in
'/home/nxadmin/wordpress-ansible/roles/wordpress/tasks/main.yml': line 2,
column 36, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Download WordPress get_url:
                                   ^ here

My script for deploying Word Press in roles/wordpress/tasks/main.yml are-

---
- name: Download WordPress get_url:
    url=https://wordpress.org/latest.tar.gz
    dest=/tmp/wordpress.tar.gz
    validate_certs=no

The module name, get_url, must be on the next line, and not on the same line as - name:.
- name: Download WordPress
   get_url:
     url=https://wordpress.org/latest.tar.gz
     dest=/tmp/wordpress.tar.gz
     validate_certs=no

- name: Extract WordPress unarchive= src=/tmp/wordpress.tar.gz
dest=/var/www/ copy=no
  sudo: yes

The same goes for this one, unarchive: must be on the next line.
And you need to use a colon and not a equal sign after the module name.

Thank you for helping me I tried that solution but now it is showing syntax error on different module

The offending line appears to be:

  • name: Update default Apache site
    ^ here

Can you please check the whole script and tell me all the mistakes I have been done in this. It would be very thankful

Thank you

I did an corrected them all except for sudo: that should be become:, but sudo will work, you just get a deprecation message.
You have probably introduced new ones, so without the new code it's difficult to see what's wrong now.
But your code should look like this now.

It is working now. Thank you very much for helping me. :slight_smile: