Hello ,
I am new to Ansible and I am trying to follow the steps in the below links 
to to Install nginx and webserver but when I am copy the code as it is and 
run it  , it gives me an error similar to "ERROR! Syntax Error while 
loading YAML." although I am using online Yaml Validator and it says "YAML 
IS VALID" 

I need Ansible/Yaml Editor when I past the code on it , it can restructure 
the file automatically to a valid one and adjust spaces and tabs!


   - *Ansible PlayBook *copied from 
   (https://linuxhint.com/ansible-tutorial-beginners/):
   
---
- hosts: Appserver
  become: true
  tasks:
        - name: install apache
          apt: name=apache2 state=present update_cache=yes
        - name: deleted index.html
          file: path=/var/www/html/index.html state=absent
          notify: restart apache2

  handlers:
        - name: restart apache2
          service: name=apache2 state=restarted

- hosts: App1
  become: true
  tasks:
        - name: set up index.html for first web server
          copy: content="<html><header><title>Welcome to Server 
1</title></header><body>Hello from Server 1!</body></html>" 
dest=/var/www/html/index.html mode=0644
          notify: restart apache2

  handlers:
        - name: restart apache2
          service: name=apache2 state=restarted

- hosts: App2
  become: true
  tasks:
        - name: set up index.html for second web server
          copy: content="<html><header><title>Welcome to Server 
2</title></header><body>Hello from Server 2!</body></html>" 
dest=/var/www/html/index.html mode=0644
          notify: restart apache2

  handlers:
        - name: restart apache2
          service: name=apache2 state=restarted


   - *Sample output* after Running Playbook:
   
The offending line appears to be:

- hosts: Appserver
    become: true
          ^ here


-- 
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/28ae06fb-6bf4-45ab-b21b-673e78ae0c8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to