Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better result content #19

Closed
mkyrc opened this issue Jan 26, 2022 · 2 comments
Closed

Better result content #19

mkyrc opened this issue Jan 26, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mkyrc
Copy link

mkyrc commented Jan 26, 2022

Is your feature request related to a problem? Please describe.

When AS3 JSON file is deployed with f5networks.f5_bigip.bigip_as3_deploy module, the "error response" (result of the REST call in case of error) is not detailed. Example:

TASK [F5AS3-DEPLOY-02-021: Deploy JSON file to device] ******************************
skipping: [dca_bigip_guesttst_01]
fatal: [dca_bigip_guesttst_02]: FAILED! => {"changed": false, "msg": "declaration failed"}

When the same JSON file is deployed using Postman, the response looks much clearly:

{
    "code": 422,
    "errors": [
        "/test-as3-01/appB/vs_web2-443/profileTCP: should NOT have fewer than 2 properties"
    ],
    "declarationFullId": "",
    "message": "declaration is invalid"
}

Describe the solution you'd like

Is it possible get the same result from ansible module? I'd like to see what is happen, not only "declaration failed"

Describe alternatives you've considered

Working alternative to bigip_as3_deploy module is builtin uri module:

    ## 02 Deploy
    - block:

        # ## 02-01 Deploy JSON file to device
        # - name: "{{pb_prfx}}-02-01: Deploy JSON file to device (bigip_as3_deploy module)"
        #   f5networks.f5_bigip.bigip_as3_deploy:
        #     content: "{{ lookup('file', JSON_FILE ) }}"
        #   register: DEPLOY_RESULT
        #   when:
        #     - active_member is defined
        #     - active_member == true
        #   tags:
        #     - deploy
        #     - deploy-debug

        - name: "{{pb_prfx}}-02-02: Deploy JSON file to device (uri module)"
          ansible.builtin.uri:
            url: "https://{{ bigip_host }}:{{ provider.server_port }}/mgmt/shared/appsvcs/declare"
            method: POST
            body: "{{ lookup('file', JSON_FILE ) }}"
            body_format: json
            status_code: [200, 201, 202, 422]
            timeout: 300
            force_basic_auth: yes
            user: "{{ provider.user }}"
            password: "{{ provider.password }}"
            validate_certs: "{{ provider.validate_certs }}"
          register: DEPLOY_RESULT
          failed_when: DEPLOY_RESULT.status != 200
          no_log: true
          when:
            - active_member is defined
            - active_member == true
          tags:
            - deploy
            - deploy-debug

      rescue:
        - name: "(debug) ERROR: Deploy error"
          debug:
            msg:
              - "RESULTS: {{ DEPLOY_RESULT }}"
          tags:
            - deploy-debug

        - name: "ERROR: Deploy error"
          debug:
            msg:
              - "msg: {{ DEPLOY_RESULT.msg }}"
              - "results: {{ DEPLOY_RESULT.json.results }}"
          tags:
            - deploy-debug
            - deploy
@mkyrc mkyrc added the enhancement New feature or request label Jan 26, 2022
@mkyrc
Copy link
Author

mkyrc commented Jan 26, 2022

My "feature request" seems the same to #3. Is it any progress there?

@wojtek0806
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants