Ansible使用AWS交互会引发异常

时间:2019-03-12 16:16:41

标签: amazon-web-services web service ansible amazon

我试图运行一个剧本来自动执行AWS,但是遇到了我无法理解的异常。我有以下剧本:

- name: Just for testing
  hosts: windows-server
  gather_facts: no
  vars:
    aws_a_key: accesskey
    aws_s_key: secretkey
  tasks:
    - name: Ping
      win_ping:
    - name: Create a file to C:\Temp\test.conf
      win_file:
        path: C:\Temp\test.conf
        state: touch
    - name: Create another file to C:\Temp\test2.conf
      win_file:
        path: C:\Temp\test2.conf
        state: touch
    - name: Gather S3 facts
      aws_s3_bucket_facts:
        aws_access_key: "{{ aws_a_key }}"
        aws_secret_key: "{{ aws_s_key }}"
        region: eu-central-1

当我尝试执行它时,出现以下错误:

PLAY [Just for testing] *******************************************************************************************************

TASK [Ping] *******************************************************************************************************************
ok: [WIN-40NQ43PHHA5]

TASK [Create a file to C:\Temp\test.conf] *************************************************************************************
changed: [WIN-40NQ43PHHA5]

TASK [Create another file to C:\Temp\test2.conf] ******************************************************************************
changed: [WIN-40NQ43PHHA5]

TASK [Gather S3 facts] ********************************************************************************************************
fatal: [WIN-40NQ43PHHA5]: FAILED! => {"changed": false, "module_stderr": "Exception calling \"Create\" with \"1\" argument(s): \"At line:4 char:21
+ def _ansiballz_main():
+                     ~
An expression was expected after '('.
At line:12 char:27
+     except (AttributeError, OSError):
+                           ~
Missing argument in parameter list.
At line:14 char:7
+     if scriptdir is not None:
+       ~
Missing '(' after 'if' in if statement.
At line:21 char:7
+     if sys.version_info < (3,):
+       ~
Missing '(' after 'if' in if statement.
At line:21 char:30
+     if sys.version_info < (3,):
+                              ~
Missing expression after ','.
At line:21 char:25
+     if sys.version_info < (3,):
+                         ~
The '<' operator is reserved for future use.
At line:23 char:32
+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)
+                                ~
Missing expression after ','.
At line:23 char:33
+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)
+                                 ~~~~~~~~~~~~~
Unexpected token 'imp.PY_SOURCE' in expression or statement.
At line:23 char:32
+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)
+                                ~
Missing closing ')' in expression.
At line:23 char:46
+         MOD_DESC = ('.py', 'U', imp.PY_SOURCE)
+                                              ~
Unexpected token ')' in expression or statement.
Not all parse errors were reported.  Correct the reported errors and try again.
\"
At line:6 char:1
+ $exec_wrapper = [ScriptBlock]::Create($split_parts[0])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ParseException

The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command 
name, a script block, or a CommandInfo object.
At line:7 char:2
+ &$exec_wrapper
+  ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : BadExpression
 ", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
    to retry, use: --limit @/Users/mpolgardi/ansible/test_playbook.retry

PLAY RECAP ********************************************************************************************************************
WIN-40NQ43PHHA5            : ok=3    changed=2    unreachable=0    failed=1  

有人可以帮助我解码此错误吗?我什至不知道在哪里看。还有办法让Ansible给我可读的错误消息吗?

0 个答案:

没有答案