写着写着就偷懒了,里面运行了很多shell脚本,后面我会把那些脚本全部符在后面。
别学我,初学者还是能用Ansible-playbook模块尽可能使用。
- hosts: test
remote_user: root
gather_facts: false
tasks:
- name: set disabled selinux
lineinfile:
dest: /etc/selinux/config
regexp: '^SELINUX='
line: 'SELINUX=disabled'
- name: close selinux
shell: setenforce 0
failed_when: false
- name: close firewalld service
service: name=firewalld state=stopped enabled=no
- name: yum install
yum: name=tree,nmap,dos2unix,lrzsz,nc,lsof,wget,tcpdump,htop,iftop,iotop,sysstat,nethogs,psmisc,net-tools,bash-completion,vim-enhanced,yum-utils,ntpdate state=latest
- name: run script module
script: /etc/ansible/script/yumins.sh
- name: run kernel optimize
script: /etc/ansible/script/kernel.optimize.sh