Assumptions

For use with eg CentOS.

Assumes you have a file /etc/ansible/hosts with groups and members already configured.

A properly formatted .yml-file can be found at the end of the article.

---
- hosts: centos-cli:centos-srv
  gather_facts: no 
  tasks:   
  - name: upgrade centos-cr   
    ini_file:     
      dest: /etc/yum.repos.d/CentOS-CR.repo       
      section: cr     
      option: enabled       
      value: 1
...

 

Sources

https://github.com/ansible/ansible-modules-extras/issues/2384

https://stackoverflow.com/questions/44606514/ansible-2-3-1-0-enable-repo-on-centos-7

https://docs.ansible.com/ansible/2.5/modules/yum_repository_module.html

 

 

 

 

 

Stop Spam Harvesters, Join Project Honey Pot

 

Get a free SSL certificate!

 

The leading nonprofit defending digital privacy, free speech, and innovation.

 

The Linux Foundation provides a neutral, trusted hub for developers and organizations to code, manage, and scale open technology projects and ecosystems.

 

Kubuntu is an operating system built by a worldwide community of developers, testers, supporters and translators.

 

 43ef5c89 CanonicalUbuntudarktext