惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

Ansible

一个 tui 的 ansible playbook 执行引擎,欢迎使用 - V2EX 分享自己写的一个 ansible role,用来部署 meilisearch 有人同时用 PVE 和 Ansible 吗,用 Ansible 来管理 PVE 上的应用还挺方便 关于《大教堂与集市中》2.12 节的疑问 有时候 bug 出现的目标环境是其他发行版本,用 vagrant 还是 docker 来虚拟环境比较好? - V2EX yum install -y docker-ce-18.09.9-3.el7 还让我确认?怎么规避这个确认 - V2EX ansible sudo su - 不支持 - V2EX 关于 AWX 执行 ansible 的原理不解的地方 ansible-playbook 的剧本和相关的二进制文件怎么存比较好? - V2EX ansbile 怎么把连接的目标 HOST IP 通过变量传递过去 - V2EX ansible 远程自动交互式命令的响应 - V2EX jenkins 和 ansible 在不同服务器,想在 jenkins 配置远程 ansible 来调用对应 playbook 和 hosts 可以吗? - V2EX ansible api 里面的 ad-hoc 和 playbook 怎么做异步 - V2EX ansible 有没有关于 passphrase 的配置的 - V2EX Python 如何将 txt 导入 excel? - V2EX 刚刚在抢 S7 鸟巢的票,想到一个问题,之前大麦网说被 80W 并发量挤爆了 - V2EX Ansible 节点边栏链接错误 - V2EX ansible 中的 check 模式和 diff 模式到底神马意思? - V2EX ansible su 切换用户问题? - V2EX 请假 ansible 里 template 模板是否支持目录呢 - V2EX ansible 如何控制 windows 后台运行 nginx? - V2EX Ansible Container Ansible 使用 Dynamic inventory 的 Script 得到的所有主机信息有办法分类么? - V2EX Ansible 初学问题 - V2EX ansible 怎么关闭 ask sudo password? - V2EX 发个福利给 Ansible 的同学们,本人亲测有效 - V2EX ansible 不支持 windows 做控制端吗?我的 windows10 py3.4 用这个老是出错 - V2EX ansible 有什么优点么? - V2EX Ansible 官网的文档读起来好别扭 - V2EX Ansible 节点这么冷清? 没有人用吗? - V2EX 用 DigitalOcean 一键部署 Cisco IPSec - V2EX 有了解 ansible-playbook 的么 - V2EX
玩 Ansible 虐到自己了! - V2EX
dynaguy · 2017-03-15 · via Ansible

这是一个创建于 3379 天前的主题,其中的信息可能已经有所发展或是发生改变。

有个目录(内有文件,子目录, link)在控制机上,要复制到目标机上,咋就辣么难呢?

Playbook:
- hosts: testvbox
become: true
tasks:
- name: Copy Paraview lib files
src: /etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/
dest: /usr/local/lib/
archive: no
links: yes

报错:
TASK [Copy Paraview lib files] *************************************************
fatal: [192.168.123.165]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --links --rsh 'ssh -S none -o StrictHostKeyChecking=no' --rsync-path=\"sudo rsync\" --out-format='<<CHANGED>>%i %n%L' \"/etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/\" \"[email protected]:/usr/local/lib/\"", "failed": true, "msg": "sudo: no tty present and no askpass program specified\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]\n", "rc": 12}
to retry, use: --limit @/etc/ansible/test.retry

试了 copy 模块也失败了!

呼唤老司机!

hzlez

1

hzlez      2017 年 3 月 15 日

no tty present and no askpass program specified

hzlez

2

hzlez      2017 年 3 月 15 日

@hzlez sorry , 按快了。
我觉得,这个报错表示就是你的宿主机没权限直接连接到目标机器哇。还没有途径让你去输入密码,就跪了。
可以考虑把 ssh_key 拷贝到目标机器,这样就不用其他授权方式了。
你可以试试直接在主机 ssh 到目标机器是不是不行~

weiweiwitch

3

weiweiwitch      2017 年 3 月 15 日   ❤️ 1

ansible 有个问题。如果你需要切换到更高权限的账户来执行命令,那么你需要设置 nopasswd 到这个账户,否则会出现你遇到的这种问题。

比如在 Ubuntu 那种使用 sudo 来执行管理命令的,你需要在 /etc/sudoers 的 sudo 那行改成%sudo ALL=(ALL:ALL) NOPASSWD:ALL

在 CentOS 那种使用 su 来切换到 root 的。你直接使用 root 来连。

dynaguy

4

dynaguy      2017 年 3 月 15 日

@hzlez
@weiweiwitch

其实这个 playbook 前面还有很多 task,都执行了,包括这个:
- name: Copy Paraview bin files
copy:
src: /etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/bin/
dest: /usr/local/bin/

所以我不认为是权限问题。/usr/local/bin/可以写,而 /usr/local/lib/不能写,那也太诡异了!

这个成功执行的 copy, src 目录下只有几个文件,没有子目录和 link 。觉得问题在这里,但没有解决办法。愁 ing.

我会试试 @weiweiwitch 的建议,再报!

nosun

6

nosun      2017 年 6 月 21 日

遇到同样的问题,@weiweiwitch 的方法试了无效

nosun

7

nosun      2017 年 6 月 21 日

@lsj5031 的方法也无效。这种情况只在非 root 用户执行 需要 sudo 的情况下存在。我执行的是 sync 命令。

dynaguy

8

dynaguy      2017 年 6 月 22 日

@nosun 好几个月了,又翻了一下我的解决办法,希望有帮助。

```
- hosts: testvbox
become: true
tasks:

- name: Modify /etc/sudoers
lineinfile:
dest: /etc/sudoers
regexp: '^Defaults env_reset'
line: 'Defaults env_reset,!tty_tickets'

- name: Copy Paraview bin files
synchronize:
src: /etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/bin/
dest: /usr/local/bin/

- name: Copy Paraview lib files
synchronize:
src: /etc/ansible/files/ParaView-5.3.0-Qt5-OpenGL2-MPI-Linux-64bit/lib/
dest: /usr/local/lib/
archive: no
links: yes
recursive: yes

- name: Restore /etc/sudoers
lineinfile:
dest: /etc/sudoers
regexp: '^Defaults env_reset,!tts_tickets'
line: 'Defaults env_reset'

```