본문 바로가기

Automation Tools/Ansible

8.3 ansible | [playbook] centos6 yum repository 변경

반응형

centos6의 공식 repository가 만료되어 아래와 같이 주소 변경.

---
- name: "Modify CentOS6 Base Repo"
  hosts: all
  become: true
  tasks:
    - name: "Modify CentOS6 Base Repo"
      replace:
        path: /etc/yum.repos.d/CentOS-Base.repo
        regexp: "{{ item.origin }}"
        replace: "{{ item.replace }}"
      with_items:
        - { origin: "mirrorlist=http://mirrorlist.centos.org", replace: "#mirrorlist=http://mirrorlist.centos.org" }
        - { origin: "#baseurl=http://mirror.centos.org", replace: "baseurl=http://vault.centos.org" }
      when:
        - ansible_facts['distribution'] == "CentOS"
        - ansible_facts['distribution_major_version'] == "6"
    - name: "libselinux-python  install"
      yum:
        name: "{{ item }}"
        state: installed
      loop:
        - libselinux-python

 

참고. 우분투의 경우 https://old-releases.ubuntu.com/ 로 변경

반응형