Hello Team
Am pretty new to Ansible trying , am getting an error while executing yml file .
Here am trying to install httpd services on one of web server i have inventory file below are the details ip details added am able to ping all these IP
inventory file:
mintty screen dump
[webserver]
172.31.17.222
[webserver:vars]
package_name=httpd
[dbserver]
172.31.17.101
[local]
localhost
|
mintty screen dump
ansible@ip-172-31-18-96:/etc/playbook$ ansible -i inventory -m ping all
172.31.17.101 | SUCCESS => {
"changed": false,
"ping": "pong"
}
172.31.17.222 | SUCCESS => {
"changed": false,
"ping": "pong"
}
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
|
This is YMl file i have written :
---
- hosts: webserver
sudo: yes
tasks:
- name: install apache
package:
name: "{{package_name}}"
state: present
- name: start and enable apache service
service:
name: "{{package_name}}"
enabled: yes
state: started
mintty screen dump
ansible@ip-172-31-18-96:/etc/playbook$ ansible-playbook -i inventory webserver.y
ml
ERROR! Syntax Error while loading YAML.
mapping values are not allowed in this context
The error appears to have been in '/etc/playbook/webserver.yml': line 2, column
10, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- hosts: webserver
^ here
|
Need your help for the same ..
Thanks for advance
Regards
Vikram