Hello, Based on the situation you define below, it sounds like you are wanting to add a custom yum repository to some hosts. Let's look at how you could go about doing it.
(1) You will need to create a yum repository file on your hosts. This file will point to your custom repository on your Yum server. You can achieve that via ansible module(s) or just copy the yum repository file that you created to each host. You will need to do some research on how to do it. As others have pointed out, the yum module is a good place to start. I'm only offering two ways to achieve this step but there might be others strategies. (2) You will need to have ansible update your systems. I'm including part of my upgrade playbook below to use as a reference (I'm on fedora so using dnf instead of yum). You can have your hosts defined in your ansible hosts file (/etc/ansible/hosts). I'm not sure your strategy for organizing your hosts as there is a lot to say here but again some investigation is needed. Finally, you could combine step 1 and 2 into a single playbook to have them be two playbooks depending on your needs. I hope this is helpful. --- - hosts: fedora tasks: - name: UPDATE | upgrade packages dnf: name: "*" state: latest - name: UPDATE | check if reboot is needed due to new kernel shell: if [ $(rpm -q kernel|tail -n 1) != kernel-$(uname -r) ]; then echo 'reboot'; else echo 'no'; fi register: reboot_hint - name: UPDATE | rebooting host... shell: shutdown -r now "Reboot required for updated kernel" async: 1 poll: 0 when: reboot_hint.stdout.find("reboot") != -1 - name: UPDATE | wait for host to reboot... wait_for_connection: connect_timeout: 20 sleep: 5 delay: 5 timeout: 300 when: reboot_hint.stdout.find("reboot") != -1 - name: UPDATE | remove unused packages dnf: autoremove: yes On 4/21/20 9:44 PM, Quad Zero wrote: > G'day all Ansible gurus, > > I am very new to Ansible and I am learning through youtube videos as I > am enquiring about this problem. It might be a simple one to some of > you guys: > > So I have multiple servers on my System. I have a VM by the name of > YUM which has all the updates (updates folder) on its /var/www/html > folder so it can be referenced from other systems if it was done > manually (which is what i have been doing until now). > > How do I specify this folder in Ansible to all other hosts? > > For eg: > > if my YUM server has all its updates in > http://192.168.0.5/rhel6pathes/april/ > > how do i get the other servers to look at this location and update it > from here? > > Thank you so much. -- Jack Morgan -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1ae55ac5-4443-bdb7-c72f-2831ba2a7434%40jento.io.
signature.asc
Description: OpenPGP digital signature