ansible playbook运行不正常
下面是我的ansible剧本ansible playbook运行不正常,ansible,Ansible,下面是我的ansible剧本 --- - name: Schema Backup Script hosts: hosts1:hosts2:hosts3 gather_facts: False tasks: - name: Copy the script to Managed node copy: src: backup.sh dest: ~/ mode: 0777 become: true become_user: user
---
- name: Schema Backup Script
hosts: hosts1:hosts2:hosts3
gather_facts: False
tasks:
- name: Copy the script to Managed node
copy:
src: backup.sh
dest: ~/
mode: 0777
become: true
become_user: user1
- name: Execute the Export command
shell: sh ~/backup.sh
become: true
become_user: user1
- name: Delete the script copied on Managed node
file:
path: ~/backup.sh
state: absent
become: true
become_user: user1
...
运行此playbook任务2(即执行导出命令)时出现的问题正在执行,但任务1未执行。1)您可以在远程节点上执行本地脚本时使用
2) 您不能在Ansible模块参数中使用
~
,因为它是一个shell功能您可以粘贴错误吗?@bosari无法通过ssh连接到主机:权限被拒绝(公钥、密码、基于主机)我已越过了我的文件权限一切正常哪个主机正在尝试复制backup.sh文件?它是一个远程服务器还是与您执行此剧本的服务器相同?