如何在AWS Lambda函数中运行Ansible Playbook

时间:2019-02-26 12:14:34

标签: amazon-web-services aws-lambda ansible

我正在尝试下面的链接方法,其中我已将zip文件上传到lambda函数,并通过传递参数来执行lambda。这引发如下错误。   请建议我如何解决此问题,如何使用Playbook来运行Lambda

[1]: https://medium.com/@jacoelho/ansible-in-aws-lambda-980bb8b5791b

START RequestId: 9c140646-5a3c-430b-81cf-458aaa7cdd77 Version: $LATEST
module initialization error: Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/home/sbx_user1051/.ansible/tmp):

 [Errno 30] Read-only file system: '/home/sbx_user1051'
Traceback (most recent call last):
  File "/var/task/ansible/config/manager.py",

 line 489, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/var/task/ansible/config/manager.py",

 line 434, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/var/task/ansible/config/manager.py", 

line 91, in ensure_type
    makedirs_safe(value, 0o700)
  File "/var/task/ansible/utils/path.py",

 line 81, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))
AnsibleError: Unable to create local directories(/home/sbx_user1051/.ansible/tmp): [Errno 30] Read-only file system: '/home/sbx_user1051'

END RequestId: 9c140646-5a3c-430b-81cf-458aaa7cdd77
REPORT RequestId: 9c140646-5a3c-430b-81cf-458aaa7cdd77  Duration: 45.12 ms  Billed Duration: 100 ms     Memory Size: 1472 MB    Max Memory Used: 65 MB  
module initialization error
Invalid settings supplied for DEFAULT_LOCAL_TMP: Unable to create local directories(/home/sbx_user1051/.ansible/tmp): [Errno 30] Read-only file system: '/home/sbx_user1051'
Traceback (most recent call last):
  File "/var/task/ansible/config/manager.py",

 line 489, in update_config_data
    value, origin = self.get_config_value_and_origin(config, configfile)
  File "/var/task/ansible/config/manager.py",

 line 434, in get_config_value_and_origin
    value = ensure_type(value, defs[config].get('type'), origin=origin)
  File "/var/task/ansible/config/manager.py", 

line 91, in ensure_type
    makedirs_safe(value, 0o700)
  File "/var/task/ansible/utils/path.py", 

line 81, in makedirs_safe
    raise AnsibleError("Unable to create local directories(%s): %s" % (to_native(rpath), to_native(e)))

AnsibleError: Unable to create local directories(/home/sbx_user1051/.ansible/tmp): [Errno 30] Read-only file system: '/home/sbx_user1051'

1 个答案:

答案 0 :(得分:0)

您没有按照帖子中的指示更改临时目录:

# use /tmp instead of $HOME
ansible.constants.DEFAULT_REMOTE_TMP = '/tmp/ansible'