I am trying to install and configure a FTP server using Ansible. I an running into syntax error. Can you please tell me correct syntax? I am not sure if it is a problem with looping through the list. The error message is not very helpful. It is saying that there is a problem with the first item in the list. Thanks.
---
- name: Deploy VSFTP and Web Server
hosts: ftpservers #Group name of the server going to host FTP service
tasks:
- block:
- name: Install FTP package on RHEL
yum:
name: vsftpd
state: present
- block:
- name: Modify FTP configuation
lineinfile:
dest: /etc/vsftpd/vsftpd.conf
backup: yes
backrefs: yes
state: present
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: anonymous_enable=NO, line: anonymous_enable=YES }
- { regexp: anon_upload_enable, line: anon_upload_enable=YES }
- { regexp: anon_mkdir_write_enable, line: anon_mkdir_write_enable=YES }
- block:
- name: Start FTP service
service: name=vsftpd state=restarted enabled=yes
I was able to solve my problem using this online YAML linter. I am posting the working code below.