各位先進不好意思打擾,想請問如何使用Ansible大量更新系統版本?
環境:
內有五台CentOS Linux,版本分布如下:
1. CentOS 7.6 (Main主機,己掛載好CentOS 7.6 ISO)
2. CentOS 7.2
3. CentOS 7.2
4. CentOS 7.2
5. CentOS 7.2
目標:更新版本為CentOS 7.2至CentOS 7.6
使用工具:Ansible(己佈署完成)
Ansible PlayBook內容:
- hosts: all
gather_facts: no
tasks:
- name: backup old repo
file: path=/etc/yum.repos.d/bak state=directory
- name: mv default repo file to bak dir
shell: mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
- name: create yum repo
yum_repository:
name: c78yum
description: centos78
baseurl:
gpgcheck: no
enabled: 1
- name: update cache
yum:
update_cache: yes
- name: upgrade all packages
yum:
name: '*'
state: latest
問題:
請問PlayBook中的yum_repository的baseurl如何指向Server1所掛載的裝置上?
煩請各位先進解惑,或是有更好的方案也請不吝嗇指點一下小弟,感謝。