您好,登錄后才能下訂單哦!
一、描述
拿到一批機器,需要做首先是修改ssh端口,防火墻配置,以及limits.conf控制文件描述符,進程數,棧大小等。
二、劇本如下:
--- - hosts: "{{ host }}" remote_user: "{{ user }}" gather_facts: false tasks: - name: Modify ssh port 69410 lineinfile: dest: /etc/ssh/{{ item }} regexp: '^Port 69410' insertafter: '#Port 22' line: 'Port 69410' with_items: - sshd_config - ssh_config tags: - sshport - name: Set sysctl file limiits # pam_limits: domain='*' limit_type=`item`.`limit_type` limit_item=`item`.`limit_item` value=`item`.`value` pam_limits: dest: "{{ item.dest }}" domain: '*' limit_type: "{{ item.limit_type }}" limit_item: "{{ item.limit_item }}" value: "{{ item.value }}" with_items: - { dest: '/etc/security/limits.conf',limit_type: 'soft',limit_item: 'nofile', value: '655350' } - { dest: '/etc/security/limits.conf',limit_type: 'hard',limit_item: 'nofile', value: '655350'} - { dest: '/etc/security/limits.conf',limit_type: 'soft',limit_item: 'nproc', value: '102400' } - { dest: '/etc/security/limits.conf',limit_type: 'hard',limit_item: 'nproc', value: '102400' } - { dest: '/etc/security/limits.conf',limit_type: 'soft',limit_item: 'sigpending', value: '255377' } - { dest: '/etc/security/limits.conf',limit_type: 'hard',limit_item: 'sigpending', value: '255377' } - { dest: '/etc/security/limits.d/90-nproc.conf', limit_type: 'soft',limit_item: 'nproc', value: '262144' } - { dest: '/etc/security/limits.d/90-nproc.conf', limit_type: 'hard',limit_item: 'nproc', value: '262144' } tags: - setlimits
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。