ansible部署FTP服务,并将centos镜像制作为本地yum源

创建部署目录

[root@ansible ~]# mkdir install_ftp

将centos镜像文件出入

创建yum源

# 根据自己的实际情况进行编写
[root@ansible install_ftp]# cat http.repo 
[centos]
name=centos
baseurl=http://192.168.33.250/centos-repo
gpgcheck=0
enabled=1

创建部署剧本

[root@ansible install_ftp]# cat install_ftp.yaml 
- hosts: node1
  remote_user: root
  tasks:
    - name: rm repo
      shell: rm -rf /etc/yum.repos.d/*
    - name: copy repo
      copy: src=http.repo  dest=/etc/yum.repos.d/
    - name: install vsftpd
      shell: yum install -y vsftpd
    - name: set path
      shell: echo 'anon_root=/opt' >> /etc/vsftpd/vsftpd.conf
    - name: restart vsftpd
      shell: systemctl restart vsftpd && systemctl enable vsftpd
    - name: copy centos
      copy: src=CentOS-7-x86_64-DVD-2009.iso dest=/root
    - name: mount CentOS-7-x86_64-DVD-2009.iso
      shell: mount CentOS-7-x86_64-DVD-2009.iso /mnt
    - name: mkdir centos-repo
      shell: mkdir -p /opt/centos-repo
    - name: copy mnt
      shell: cp -frv /mnt/* /opt/centos-repo

运行剧本文件

[root@ansible install_ftp]# ansible-playbook install_ftp.yaml 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值