- hosts: test
remote_user: root
gather_facts: no
tasks:
- name: Copy Aliyun YUM repo
copy:
src: /root/CentOS-Base.repo
dest: /etc/yum.repos.d/CentOS-Base.repo
- name: Clean YUM cache and flush iptables
shell: |
yum clean all
yum makecache
iptables -F
- name: Stop and disable firewalld
service:
name: firewalld
state: stopped
enabled: no
- name: Install tools
yum:
name:
- vim
- wget
- ntp
- net-tools
state: installed
- name: Start NTP service
service:
name: ntpd
state: started
enabled: yes
- name: Enable NTP synchronization
command: timedatectl set-ntp true
- name: Set SELinux to disabled
lineinfile:
path: /etc/selinux/config
regexp: '^SELINUX='
line: 'SELINUX=disabled'
ansible剧本模式下执行初始化
最新推荐文章于 2024-11-11 09:53:49 发布