找回密码
 注册
查看: 4095|回复: 0

ansible中用户如果没有家目录使用报错和解决办法

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2017-12-23 17:27:12 | 显示全部楼层 |阅读模式
当我们配置的用户没有家目录执行命令之后,发现以下问题:
) W% q3 N; j# c说明我们已经更改过ansible下的hosts文件了。: Y; {1 V9 J; _6 L# R, g

- L- a4 S+ I3 \$ ansible  -m shell -a "uptime" 192.168.13.5) D; A$ t! M1 Q! @
192.168.13.5 | UNREACHABLE! => {5 ^# T: {. K7 g
    "changed": false, / E) f4 s3 W; P, P3 g  U3 K$ {
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo /home/victor/.ansible/tmp/ansible-tmp-1514033210.52-982392478156 `\" && echo ansible-tmp-1514033210.52-982392478156=\"` echo /home/victor/.ansible/tmp/ansible-tmp-1514033210.52-982392478156 `\" ), exited with result 1",
& |; ?) `- k3 d3 f4 E  Y# x6 P5 v    "unreachable": true
0 n" [# h7 ~9 h" J/ U}% Z  I3 M9 }' Q  U9 j( [0 ~

7 H. ^* l$ b2 }  i( h解决方法:
. L3 s( \9 [. |需要修改下ansible.cfg 文件:
( r' @) s( _- z8 k# n2 R0 C, i2 \! F' u) ]2 V. p0 P" P' x* _
$ sudo vim/etc/ansible/ansible.cfg  将文件配置为/tmp目录下即可:
remote_tmp     = /tmp/.ansible/tmp
9 S. w; w0 N! H5 u  a4 `

5 K! _# \* J4 F0 O
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 04:22 , Processed in 0.016779 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表