Syntax Error while loading YAML.

Hi All,

I have written a YAML to install Nginx on my AWS Slave server. But every time i got below error while running my playbook. I googled to resolve this issue, but unable to do so. Can you guys help me in sorting what i am doing wrong here. I am using Ubuntu 16 and my YAML is,

- hosts: AWS_Slave
tasks:
- name: nginx
apt_key: url=http://nginx.org/keys/nginx_signing.key state=present

- name: nginx | Adding sources.list deb url for nginx
lineinfile: dest=/etc/apt/sources.list line=“deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx”

- name: nginx | Updating apt cache
apt:
update_cache: yes

- name: nginx | Installing nginx
apt:
pkg: nginx
state: latest

- name: nginx | Starting nginx
service:
name: nginx
state: started

Hi All,

I have written a YAML to install Nginx on my AWS Slave server. But every
time i got below error while running my playbook. I googled to resolve this
issue, but unable to do so. Can you guys help me in sorting what i am doing
wrong here. I am using Ubuntu 16 and my YAML is,

In YAML indentation is very important, and you need to be consistent in the indentation.

- hosts: AWS_Slave
  tasks:
        - name: nginx
        apt_key: url=http://nginx.org/keys/nginx_signing.key state=present

        - name: nginx | Adding sources.list deb url for nginx
        lineinfile: dest=/etc/apt/sources.list line="deb
http://nginx.org/packages/mainline/ubuntu/ xenial nginx"

        - name: nginx | Updating apt cache
                apt:
                update_cache: yes

        - name: nginx | Installing nginx
                apt:
                pkg: nginx
                state: latest

        - name: nginx | Starting nginx
                service:
                name: nginx
                state: started

Here is an example with indentation that should work.

- hosts: AWS_Slave
   tasks:
     - name: nginx
       apt_key: url=http://nginx.org/keys/nginx_signing.key state=present

     - name: nginx | Adding sources.list deb url for nginx
       lineinfile: dest=/etc/apt/sources.list line="deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx"

     - name: nginx | Updating apt cache
       apt:
         update_cache: yes

     - name: nginx | Installing nginx
       apt:
         pkg: nginx
         state: latest

     - name: nginx | Starting nginx
       service:
         name: nginx
         state: started

In YAML indentation is very important, and you need to be consistent
in the indentation.

Also, all indentation should be space characters, not tabs.

(If you've got tabs in your playbook, could Ansible catch that and
identify the problem more clearly than it currently does?)

                                      -Josh (jbs@care.com)

(apologies for the automatic corporate disclaimer that follows)
This email is intended for the person(s) to whom it is addressed and may contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized use, distribution, copying, or disclosure by any person other than the addressee(s) is strictly prohibited. If you have received this email in error, please notify the sender immediately by return email and delete the message and any attachments from your system.