You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
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
Dick Davies
unread,
Jul 14, 2016, 3:31:57 PM7/14/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible list
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 ...