# Local repo in CentOs7 using Ansible

**URL:** <https://forum.ansible.com/t/local-repo-in-centos7-using-ansible/22001>\
**Category:** Ansible Project\
**Created:** [July 13, 2016, 5:04am UTC](https://forum.ansible.com/t/local-repo-in-centos7-using-ansible/22001 "2016-07-13T05:04:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hariprasad\_S](https://avatars.discourse-cdn.com/v4/letter/h/ed8c4c/32.png) [@Hariprasad\_S](https://forum.ansible.com/u/Hariprasad_S)\
**Post date:** [July 13, 2016, 5:04am UTC](https://forum.ansible.com/t/local-repo-in-centos7-using-ansible/22001/1 "2016-07-13T05:04:48Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [July 14, 2016, 7:31pm UTC](https://forum.ansible.com/t/local-repo-in-centos7-using-ansible/22001/2 "2016-07-14T19:31:51Z")

</div>

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!
