Hi I have just started learning ansible. I am trying to write playbook as:
vpc-setup.yml which including
hosts: localhost
connection: local
gather_facts: False
tasks:
- name: Import VPC Variables
include_vars: vars/vpc_setup.md
- name: Create vprofile VPC
ec2_vpc_net:
name: "{{vpc_name}}"
cidr_block: "{{vpcCidr}}"
region: "{{region}}"
dns_hostnames: yes
tenancy: default
state: "{{state}}"
register: vpcout
the error is coming in 1st line:
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all'
ERROR! A playbook must be a list of plays, got a <class 'ansible.parsing.yaml.objects.AnsibleMapping'> instead
The error appears to be in '/home/ubuntu/ansible-aws-vpc/vpc-setup.yml': line 1, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
hosts: localhost
^ here
Kindly help