Ansible вызов aws_s3 windows хост в блоке / аварийно-спасательная ошибка, которая трудно понять - PullRequest
0 голосов
/ 17 апреля 2020

этот блок работает нормально в Linux! я пытаюсь использовать aws_s3 для загрузки пакета и использую аварийную загрузку с веб-сайта, если она не удалась, но я получаю ошибку, которую трудно понять, и точно указываю причину ошибки: я представляю только код prablemati c, поскольку он является pard очень большого ansible проекта:

- name: Download package
  block:
    - name: Download package from S3
      aws_s3:
        bucket: s3_pack
        object: "{{ package_url | regex_replace('^.*\\.[a-zA-Z]+\/', '') }}"
        dest: "{{ ansible_env.HOME }}/"
        mode: get
  rescue:
    - name: Download package from FTP
      get_url:
        url_username: xxxxx
        url_password: xxxxx
        dest: "{{ ansible_env.HOME }}/"
        url: "{{ package_url }}"

и это ошибка:

TASK [package_deploy : Download package from S3] ********************************************************************************************************************************************************************************************
task path: /main.yml:74
Friday 17 April 2020  09:44:09 +0000 (0:00:01.608)       0:04:08.479 **********
<10.0.6.69> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5116 TO 10.0.6.6
checking if winrm_host 10.0.6.69 is an IPv6 address
EXEC (via pipeline wrapper)
Using module file /home//lib64/python3.6/dist-packages/ansible/modules/cloud/amazon/aws_s3.py
EXEC (via pipeline wrapper)
EXEC (via pipeline wrapper)
fatal: [10.0.6.69]: 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
    See stdout/stderr for the exact error
  rc: 1

TASK [package_deploy : Download package from FTP] *******************************************************************************************************************************************************************************************
task path: /main.yml:81
Friday 17 April 2020  09:44:12 +0000 (0:00:02.549)       0:04:11.028 **********
Using module file /home//lib64/python3.6/dist-packages/ansible/modules/net_tools/basics/get_url.py
<10.0.6.69> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5116 TO 10.0.6.6
checking if winrm_host 10.0.6.69 is an IPv6 address
EXEC (via pipeline wrapper)
fatal: [10.0.6.69]: 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
    See stdout/stderr for the exact error
  rc: 1
        to retry, use: --limit @/home//ansible/site.retry

PLAY RECAP **********************************************************************************************************************************************************************************************************************************
10.0.6.69                  : ok=16   changed=13   unreachable=0    failed=2
localhost                  : ok=12   changed=4    unreachable=0    failed=0

1 Ответ

1 голос
/ 17 апреля 2020

У вас, похоже, установлен ansible_python_interpreter на PowerShell или что-то похожее плохое; для предельной ясности использование Windows в качестве управляющего хоста не поддерживается: https://docs.ansible.com/ansible/2.9/installation_guide/intro_installation.html#control -node-требования

В них есть инструкции о том, что может сойдет с рук использование WSL, но оно не поддерживается: https://docs.ansible.com/ansible/2.9/user_guide/windows_faq.html#can - ansible -run-on- windows

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...