我对Ansible还是陌生的,他试图使安装TeamSpeak 3服务器的工作自动化。不幸的是,我遇到了一些错误:
ansible-playbook
命令运行它,即使我在清单中明确声明了become_pass
,它也会要求输入sudo密码--ask-become-pass
参数重试它,则会运行前两个步骤,并指出在连接到服务器时找不到下载的文件,但是我可以确保它存在这是权限错误吗?还是因为尚未存储ssh密钥而无法访问主目录?
这是剧本(目前):
---
- hosts: all
gather_facts: false
become: yes
tasks:
- name: Adding TeamSpeak User
user:
name: ts3
- name: Download TeamSpeak
get_url:
url: https://files.teamspeak-services.com/releases/server/3.9.1/teamspeak3-server_linux_amd64-3.9.1.tar.bz2
dest: /home/ts3/
- name: Extract downloaded folder
unarchive:
src: /home/ts3/teamspeak3-server_linux_amd64-3.9.1.tar.bz2
dest: /home/ts3
答案 0 :(得分:1)
- name: Unarchive a file that is already on the remote machine
unarchive:
src: /tmp/foo.zip
dest: /usr/local/bin
remote_src: yes
- name: Unarchive a file that needs to be downloaded (added in 2.0)
unarchive:
src: https://example.com/example.zip
dest: /usr/local/bin
remote_src: yes