运维开发网

CentOS7初始环境准备

运维开发网 https://www.qedev.com 2021-04-25 15:21 出处:51CTO 作者:80民工
将所有刚安装好的主机分为test组:# vim /etc/ansible/hosts[test]192.168.30.128192.168.30.129192.168.30.130环境准备prepare.yml:---- hosts: test remote_user: root tasks: - name: 关闭firewalld s...

  • 将所有刚安装好的主机分为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


0

精彩评论

暂无评论...
验证码 换一张
取 消