Local repo in CentOs7 using Ansible

Hi All,
I’m pretty new to Ansible. Have started working on Ansible about a week back.
I have given a task to create a local repo using ansible in CentOs system.

This is my yaml file:

Hi

you want to use a "command:" task.

If I was you I'd

* create a handler to run the createrepo command
* have a list of files you want to fill that directory
* upload the files with Ansible e.g. with a copy: task into the directory
* have a notify: clause on the file upload task (see docs) that
triggers the createrepo handler when the upload task changes
* oh, and use a different directory from /root ...

Have fun!