CentOS7初始环境准备

  • 将所有刚安装好的主机分为test组:
# vim /etc/ansible/hosts[test]192.168.30.128
192.168.30.129
192.168.30.130

  • 环境准备prepare.yml:
---- hosts: test  remote_user: root  
  tasks:
    - name: 关闭firewalld 
      service: name=firewalld state=stopped enabled=no  
    - name: 临时关闭 selinux      shell: "setenforce 0"
      failed_when: false

    - name: 永久关闭 selinux      lineinfile:
        dest: /etc/selinux/config        regexp: "^SELINUX="
        line: "SELINUX=disabled"

    - name: 添加EPEL仓库      yum: name=epel-release state=latest    - name: 安装常用软件包      yum:
        name:
          - vim          - lrzsz          - net-tools          - wget          - curl          - bash-completion          - rsync          - gcc          - unzip          - git        state: latest    - name: 更新系统      shell: "yum update -y"
      args:
        warn: False

  • 执行:
# ansible-playbook prepare.yml


上一篇:安装docker-ce报错——Error: Package:docker-ce-rootless-extras-20.10.3-3.el7.x86_64 (docker-ce-stable


下一篇:linux的centos7防火墙firewalld