# RegEXP ansible ERROR! Syntax Error while loading YAML.

**URL:** <https://forum.ansible.com/t/regexp-ansible-error-syntax-error-while-loading-yaml/27960>\
**Category:** Ansible Project\
**Created:** [July 5, 2018, 3:42pm UTC](https://forum.ansible.com/t/regexp-ansible-error-syntax-error-while-loading-yaml/27960 "2018-07-05T15:42:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VS1](https://avatars.discourse-cdn.com/v4/letter/v/bbe5ce/32.png) [@VS1](https://forum.ansible.com/u/VS1)\
**Post date:** [July 5, 2018, 3:42pm UTC](https://forum.ansible.com/t/regexp-ansible-error-syntax-error-while-loading-yaml/27960/1 "2018-07-05T15:42:34Z")

</div>

`

- name: Configure filebeat  
lineinfile:  
dest= /etc/filebeat/filebeat.yml  
regexp = “{{ item.regexp }}”  
line = “{{ item.regexp }}”  
with\_items:  
{ regexp: ‘#output.elasticsearch:’, line: ‘output.elasticsearch:\n hosts: [“X.x.x.x:9200”]’ }  
{ regexp: ‘#setup.kibana:’, “line”: ‘setup.kibana::\n hosts: [“X.x.x.x:5601”]\n user: “admin”\n password: “Spiderman1”’ }

`

The error appears to have been in ‘/home/user/.ansible/roles/filebeat/tasks/main.yml’: line 12, column 5, but may  
be elsewhere in the file depending on the exact syntax problem.

What i am doing wrong ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [July 5, 2018, 3:50pm UTC](https://forum.ansible.com/t/regexp-ansible-error-syntax-error-while-loading-yaml/27960/2 "2018-07-05T15:50:07Z")

</div>

with\_items takes a list:  
with\_items:  
&nbsp;&nbsp;&nbsp;&nbsp;- { regexp: '#output.elasticsearch:', line:  
'output.elasticsearch:\n hosts: ["X.x.x.x:9200"]' }  
&nbsp;&nbsp;&nbsp;&nbsp;- { regexp: '#setup.kibana:', "line": 'setup.kibana::\n hosts:  
["X.x.x.x:5601"]\n user: "admin"\n password: "Spiderman1"' }
