ansible-playbook 初始化系统配置


##ansible-playbook 初始化系统配置

##init-sys.yml

---                       
- hosts: all     
  remote_user: root       
  tasks:                           
    - name: yum install epel-release
      yum: name="epel-release"
      
    - name: yum install package
      yum: name={{ item }}
      with_items:
      - net-tools
      - bind-utils
      - curl
      - telnet
      - iotop
      - sysstat
      - iftop
      - rsync
      - strace    
      - tree
- name: disable Selinux shell: setenforce 0 - name: change Selinux config lineinfile: dest: /etc/selinux/config regexp: '^SELINUX=' line: 'SELINUX=disabled' - name: Firewalld disable service: name=firewalld state=stopped enabled=no ########Ulimit Init######## - name: Ulimit change shell: ulimit -HSn 65535;ulimit -u 81920 - name: Change limits.conf nofile lineinfile: dest: /etc/security/limits.conf regexp: '\* - nofile [0-9]+' #backrefs: no line: '* - nofile 65535' - name: Change limits.conf nproc lineinfile: dest: /etc/security/limits.conf regexp: '\* - nproc [0-9]+' #backrefs: no line: '* - nproc 81920' - name: change hostname shell: "hostnamectl set-hostname node$(ip addr |grep global |grep $(route |grep default |awk '{print $NF}') |head -n1 |awk '{print $2}' |cut -d '/' -f1 |cut -d '.' -f4)"


#ansible-playbook init-sys.yml


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM