f5devcentral / ansible-role-f5_atc_deploy_declaration

Ansible role used to deploy declaratives to F5 Automated Tool Chain services: AS3, DO, and TS
Apache License 2.0
7 stars 11 forks source link

Ansible task succeded but partial result failed #33

Open alonsocamaro opened 4 years ago

alonsocamaro commented 4 years ago

Hi

The following ansible task succeeds when one of the members of the results array is not 200. Search below for "code": 422

I don't know how to report the version of ATC I used. If I'm not mistaken I downloaded it 4th Aug.

- name: Wait for DO Task to complete
  uri:
    url: "https://{{ provider.server }}:{{ provider.server_port }}{{ atc_url }}/task/{{ atc_DO_result.json.id }}"
    method: GET
    headers:
      X-F5-Auth-Token: "{{ f5_auth_token }}"
    return_content: true
    validate_certs: "{{ provider.validate_certs }}"
    status_code: 200
  register: atc_DO_status
  until: atc_DO_status is success
  retries: "{{ atc_retries }}"
  delay: "{{ atc_delay }}"
  delegate_to: localhost
  when:
    - atc_service == "Device"
    - atc_method == "POST"

Next is the ansible output

TASK [f5atc : POST AS3 declaration] ***********************************************************************************************************************************************************
ok: [localhost]
Tuesday 29 September 2020  08:46:04 -0400 (0:00:00.759)       0:00:35.975 ***** 
Tuesday 29 September 2020  08:46:04 -0400 (0:00:00.035)       0:00:36.010 ***** 
Tuesday 29 September 2020  08:46:04 -0400 (0:00:00.042)       0:00:36.053 ***** 
Tuesday 29 September 2020  08:46:04 -0400 (0:00:00.036)       0:00:36.090 ***** 
included: /home/ucamaro/src/roles/f5atc/tasks/atc_task_check.yaml for localhost
Tuesday 29 September 2020  08:46:04 -0400 (0:00:00.052)       0:00:36.143 ***** 
FAILED - RETRYING: Wait for AS3 Task to complete (5 retries left).

TASK [f5atc : Wait for AS3 Task to complete] **************************************************************************************************************************************************
changed: [localhost]
Tuesday 29 September 2020  08:46:16 -0400 (0:00:11.624)       0:00:47.767 ***** 
Tuesday 29 September 2020  08:46:16 -0400 (0:00:00.046)       0:00:47.813 ***** 

TASK [bigip-gslb-publish : show AS3 status] ***************************************************************************************************************************************************
ok: [localhost] => {
    "atc_AS3_status": {
        "attempts": 2,
        "cache_control": "no-store, no-cache, must-revalidate",
        "changed": true,
        "connection": "close",
        "content": "{\"id\":\"73040687-4d70-471a-a006-08da623ba054\",\"results\":[{\"code\":200,\"message\":\"success\",\"lineCount\":20,\"host\":\"localhost\",\"tenant\":\"Common\",\"runTime\":2486},{\"code\":422,\"message\":\"declaration failed\",\"response\":\"01070226:3: Pool Member http_hello_world_minikube_default references a nonexistent Virtual Server\",\"host\":\"localhost\",\"tenant\":\"gslb_f5bddemos_io\",\"runTime\":2502},{\"code\":200,\"message\":\"success\",\"lineCount\":27,\"host\":\"localhost\",\"tenant\":\"Common\",\"runTime\":3324}],\"declaration\":{\"Common\":{\"class\":\"Tenant\",\"Shared\":{\"class\":\"Application\",\"template\":\"shared\",\"minikube\":{\"class\":\"GSLB_Data_Center\"},\"minikube_default\":{\"class\":\"GSLB_Server\",\"dataCenter\":{\"use\":\"minikube\"},\

[...]

                },
                "id": "GSLB_Tool",
                "schemaVersion": "3.21.0",
                "updateMode": "selective"
            },
            "id": "73040687-4d70-471a-a006-08da623ba054",
            "results": [
                {
                    "code": 200,
                    "host": "localhost",
                    "lineCount": 20,
                    "message": "success",
                    "runTime": 2486,
                    "tenant": "Common"
                },
                {
                    "code": 422,
                    "host": "localhost",
                    "message": "declaration failed",
                    "response": "01070226:3: Pool Member http_hello_world_minikube_default references a nonexistent Virtual Server",
                    "runTime": 2502,
                    "tenant": "gslb_f5bddemos_io"
                },
                {
                    "code": 200,
                    "host": "localhost",
                    "lineCount": 27,
                    "message": "success",
                    "runTime": 3324,
                    "tenant": "Common"
                }
            ]
        },
        "msg": "OK (4437 bytes)",
        "pragma": "no-cache",
        "redirected": false,
        "server": "Jetty(9.2.22.v20170606)",
        "status": 200,
        "strict_transport_security": "max-age=16070400; includeSubDomains",
        "url": "https://192.168.200.27:443/mgmt/shared/appsvcs/task/73040687-4d70-471a-a006-08da623ba054",
        "x_content_type_options": "nosniff",
        "x_frame_options": "SAMEORIGIN",
        "x_powered_by": "Express",
        "x_xss_protection": "1; mode=block"
    }
}

PLAY RECAP ************************************************************************************************************************************************************************************
localhost                  : ok=134  changed=49   unreachable=0    failed=0    skipped=9    rescued=0    ignored=0   
megamattzilla commented 2 years ago

I have a customer running into this same problem on TMOS 15.1.5 using ATC to deploy AS3 for /common/shared tenant

We custom patched ATC deploy role with the following code to fix the issue: https://github.com/megamattzilla/ansible-role-f5_atc_deploy_declaration/blob/master/tasks/atc_task_check_bigip.yaml#L18-L19

The change is simple enough. I would like to see this fixed in ATC deploy role. Sad to see this has been outstanding since 2020 and multiple open PRs/issues in this repo.

I know ansible modules v2 will replace this functionality in the future, but there are outstanding issues open there as well that are preventing my customer from adopting them.