首页 > 解决方案 > 当我使用 ansible 同步模块时,许多服务器总是有些服务器有 ssh 错误无法访问

问题描述

我的 ansible-playbook 是这样的:

---
- hosts: yanchu
  gather_facts: True
  remote_user: root
  tasks:
    - name: confirm date
      shell: date +"%Y%m%d"
      register: log_date
    - set_fact:
         log_info: "{{ log_date['stdout'] }}"

    - name: sync log directory
      synchronize:
        src: /home/work/orp/log/yanchu/yanchu.log.{{ log_info }}*
        dest: /data/yanchu/{{ ansible_eth0['ipv4']['address'] }}/log/
        mode: pull
        rsync_timeout: 20
      delegate_to: 10.193.2.139

    - name: sync wf.log directory
      synchronize:
        src: /home/work/orp/log/yanchu/yanchu.log.wf.{{ log_info }}*
        dest: /data/yanchu/{{ ansible_eth0['ipv4']['address'] }}/log/
        mode: pull
      delegate_to: 10.193.2.139

盐初集团有10台服务器

像并发但总是出现一些服务器错误,比如在我的 crontab 中无法访问

但我在控制台上执行没有错误

标签: pythonansible

解决方案


推荐阅读