playbook剧本-初始化yum

- hosts: eladmin-ruoyi
  remote_user: root
  tasks:
    - name: mkdir yum_bak
      file: path=/etc/yum_bak state=directory

    - name: mv yum.repo to yum_bak
      shell: mv /etc/yum.repos.d/*  /etc/yum_bak

    - name: install Centos-7.repo
      shell: curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

    - name: yum install wget
      yum: name=wget state=installed

    - name: install epel.repo
      get_url: url=http://mirrors.aliyun.com/repo/epel-7.repo dest=/etc/yum.repos.d/epel.repo

    - name: yum install tree nmap dos2unix lrzsz nc lsof wget tcpdump htop iftop iotop sysstat nethogs psmisc net-tools bash-completion vim-enhanced
      shell: yum install tree nmap dos2unix lrzsz nc lsof wget tcpdump htop iftop iotop sysstat nethogs psmisc net-tools bash-completion vim-enhanced -y
posted @ 2025-08-23 21:55  阿峰博客站  阅读(11)  评论(0)    收藏  举报