ansible задача aws_s3 или любой другой запрос не может быть захвачен - PullRequest
0 голосов
/ 07 мая 2020

У меня есть эта задача, которая не удастся, foo.zip не существует, и предполагается, что он завершится неудачно, но в конце концов он никогда не попадает в журналы сообщений, конечным результатом для меня является вызов задач на основе регистра: s3_response

  - debug:
        msg: "####################### This is start #######################"

    - name: get
      local_action:
         module: aws_s3
         bucket: foo
         object: "packages/foo.zip"
         dest: "/home/foo.zip"
         mode: get
      register: s3_response


    - debug:
        msg: "####################### This is false #######################"
      when: s3_response.changed==False
    - debug:
        msg: "####################### This is True #######################"
      when: s3_response.changed==True
    - debug:
        msg: "####################### This is end #######################"

вывод

TASK [debug] ********************************************************************************************************************************************************************************************************************************
task path: /home/ec2-user/backup/test5.yml:17
Thursday 07 May 2020  12:30:15 +0000 (0:00:00.073)       0:00:00.073 **********
ok: [localhost] =>
  msg: '####################### This is start #######################'

 *********************************************************************************************************************************************************************************************************
task path: /home/ec2-user/backup/test5.yml:20
Thursday 07 May 2020  12:30:15 +0000 (0:00:00.014)       0:00:00.087 **********
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: ec2-user
<localhost> EXEC /bin/sh -c 'echo ~ec2-user && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ec2-user/.ansible/tmp `"&& mkdir /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513 && echo ansible-tmp-1588854615.157985-2674-47102509236513="` echo /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513 `" ) && sleep 0'
Using module file /home/home/lib64/python3.7/site-packages/ansible/modules/cloud/amazon/aws_s3.py
<localhost> PUT /home/ec2-user/.ansible/tmp/ansible-local-2667lvy8gjcm/tmp_9f5w0u4 TO /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513/AnsiballZ_aws_s3.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513/ /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513/AnsiballZ_aws_s3.py && sleep 0'
<localhost> EXEC /bin/sh -c '/home/home/bin/python3 /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513/AnsiballZ_aws_s3.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/ec2-user/.ansible/tmp/ansible-tmp-1588854615.157985-2674-47102509236513/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost -> localhost]: FAILED! => changed=false
  invocation:
    module_args:
      aws_access_key: null
      aws_secret_key: null
      bucket: foo
      debug_botocore_endpoint_logs: false
      dest: /home/foo.zip
      dualstack: false
      ec2_url: null
      encrypt: true
      encryption_kms_key_id: null
      encryption_mode: AES256
      expiry: 600
      headers: null
      ignore_nonexistent_bucket: false
      marker: ''
      max_keys: 1000
      metadata: null
      mode: get
      object: packages/foo.zip
      overwrite: always
      permission:
      - private
      prefix: ''
      profile: null
      region: null
      retries: 0
      rgw: false
      s3_url: null
      security_token: null
      src: null
      validate_certs: true
      version: null
  msg: Key packages/foo.zip does not exist.
...