简体   繁体   中英

Could not make dir /$HOME/.ansible/cp: [Errno 13] Permission denied: '/$HOME

I've got a python script that uses the ansible package to ping some remote servers. When executed manually ( python devmanager.py ) it works ok, but when the script is managed with supervisor it raises the following error:

Could not make dir /$HOME/.ansible/cp: [Errno 13] Permission denied: '/$HOME

The ansible command is quite simple:

    runner = ansible.runner.Runner(
            module_name='ping',
            module_args='',
            forks=10,
            inventory=inventory
    )

Same user in source and target systems. I've check permissions for the $HOME folder and didn't find anything weird.

Any idea what's is going on? Doesn't it know to translate the $HOME variable?

You may give a try by altering the parameter "remote_tmp" in ansible.cfg.

Default:- $HOME/.ansible/tmp

Update:- /tmp/.ansible/tmp

On this case who ever the user try to run the playbook will have enough permission to create necessary temporary files in /tmp directory.

是的,它似乎没有转义$HOME变量并尝试在/$HOME下写入。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM