hi all

I am running a very very simple test with the ansible.builtin.uri and it is 
failing.

This is in a development setup and the terraform infra and the apps are all 
made to be up and running before this simple test.

*I verify that the apps are running on EC2 with a browser hit to each of 
the ip addresses (I know is its redirecting because url changes in browser)*
There are 2 EC2 nodes up each running an ansible installed Granfana and 
prometheus app on a terraform infra.

*I also verified from my IDE (Cloud9 instance) that a wget on each of the 
Urls is returning the 302.*

The access rules on the EC2 nodes are pretty much open


When I run the ansible playbook I am seeing these errors (I replaced public 
IPs with XXXX and YYYY)
I am running the ansible playbook from the same Cloud9 IDE where I tested 
the wget that works with a returned 302.

The url looks to be correctly formed.  The correct ip addresses are pulled 
from inventory

My simple playbook that I wanted to append to the main playbook is below.
I am not getting any syntax errors.

warm regards
Dave
==========


dave:~/environment/mtc-terraform-ansible-jenkins (Jenkins_development) $ 
ansible-playbook -i aws_hosts --key-file /home/ubuntu/.ssh/mtckey 
playbooks/node-test.yml --limit 
@/home/ubuntu/environment/mtc-terraform-ansible-jenkins/.ansible-retry/node-test.retry

PLAY [Test for Granana and Prometheus access] 
***************************************************************************************************

TASK [Grafana] 
**********************************************************************************************************************************
fatal: [XXXX]: FAILED! => {"ansible_facts": 
{"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, 
"content": "", "elapsed": 30, "msg": *"Status code was -1 and not [302]*: 
Request failed: <urlopen error timed out>", "redirected": false, "status": 
-1, "url": "http://XXXX:3000"}
fatal: [YYYY]: FAILED! => {"ansible_facts": 
{"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, 
"content": "", "elapsed": 30, "msg": "Status code was -1 and not [302]: 
Request failed: <urlopen error timed out>", "redirected": false, "status": 
-1, "url": "http://YYYY:3000"}
        to retry, use: --limit 
@/home/ubuntu/environment/mtc-terraform-ansible-jenkins/.ansible-retry/node-test.retry

PLAY RECAP 
**************************************************************************************************************************************
XXXX               : ok=0    changed=0    unreachable=0    failed=1   
 skipped=0    rescued=0    ignored=0   
YYYY             : ok=0    changed=0    unreachable=0    failed=1   
 skipped=0    rescued=0    ignored=0   


=======

*playbook for this test:*

---
- name: Test for Granana and Prometheus access
  hosts: main
  gather_facts: no
  tasks:
  # 
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/uri_module.html
  - name: Grafana
    ansible.builtin.uri:
      url: http://{{ inventory_hostname }}:3000
      follow_redirects: none
      status_code: [302]
      
  - name: Prometheus
    ansible.builtin.uri:
      url: http://{{ inventory_hostname }}:9090
      follow_redirects: none
      status_code: [302]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/afa91f36-4e80-43b6-9610-136eb002a25en%40googlegroups.com.

Reply via email to