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!

On 13 July 2016 at 06:04, Hariprasad S <[email protected]> wrote:
> 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:
> ---
>
> - name: configuring yum local repository
>   hosts: testServer
>   remote_user: root
>   become: yes
>
>   tasks:
>   - name: Add repository
>     yum_repository:
>       name: custom_repository
>       description: local_repository
>       baseurl: file:///root/
>       enabled: yes
>
> The .repo file is create /etc/yum.repos.d/ ,but i couldn't able to install
> any package using this repo. When i tried to install rpm which is place in
> /root/, it give the following error:
>
> Setting up Install Process
> Loading mirror speeds from cached hostfile
> file:///root/repodata/repomd.xml: [Errno 14] Could not open/read
> file:///root/repodata/repomd.xml
> Trying other mirror.
> Error: Cannot retrieve repository metadata (repomd.xml) for repository:
> custom_repository. Please verify its path and try again
>
> I understand this repomd.xml can be created by using manually by executing
> "createrepo /root/" executable which come as part of yum commands. I want to
> know, how the "createrepo command" can be executed using ansible scripts?
> what is parameter i have to set in Ansible script to create the repomd.xml ?
>
> Kindly help.
>
>
> Thanks
> Hari
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/41f8519a-e693-4187-a541-99d4834565ed%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAK5eLPSygnrCEv3uUws%2BgLgHDbqVH4qPVLdLxcp7o2hyhLpciA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to