You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/awx/tasks/awx-get-typ-id.yml

28 lines
881 B
YAML

---
- name: "Search {{ awx_rest_api_type }} informations for {{ awx_search_name }} on awx server"
uri:
url: "{{ awx_base_url }}/api/v2/{{ awx_rest_api_type }}/?search={{ awx_search_name | urlencode }}"
method: GET
user: "{{ awx_rest_api_access_user }}"
password: "{{ awx_rest_api_access_pw }}"
return_content: true
validate_certs: false
force_basic_auth: yes
status_code: 200
no_log: true
register: awx_type_info
tags:
- awx_communication
- name: "Get {{ awx_rest_api_type }} id for {{ awx_search_name }} on awx server"
vars:
query: '[? {{ awx_search_key }}==`{{ awx_search_name }}`].id'
set_fact:
awx_type_id: "{{ item.results | json_query(query) | first }}"
when: (item.results is defined) and (item.results | length > 0)
loop:
- "{{ awx_type_info['content'] }}"
no_log: true
tags:
- awx_communication