2 - name: Build scoped path
4 rundeck_key_full_path: "{{ rundeck_keys_base_path }}/{{ item.path }}"
6 - name: Check key existence
8 url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/storage/keys/{{ rundeck_key_full_path }}"
11 Accept: application/json
12 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}"
13 status_code: [200, 404]
14 register: rundeck_existing_key
18 rundeck_key_uri_method: "{{ (rundeck_existing_key.status == 404) | ternary('POST', 'PUT') }}"
22 url: "{{ rundeck_api_url }}/{{ rundeck_api_version }}/storage/keys/{{ rundeck_key_full_path }}"
23 method: "{{ rundeck_key_uri_method }}"
25 Accept: application/json
26 Content-Type: "{{ item.type }}"
27 X-Rundeck-Auth-Token: "{{ rundeck_api_token }}"
28 status_code: [200, 201]
29 body: "{{ item.value }}"