refactor: migrate to fully qualified module names
This commit is contained in:
parent
8b600a9830
commit
a708450260
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Set default api parameters for HTTP
|
- name: Set default api parameters for HTTP
|
||||||
meta: noop
|
ansible.builtin.meta: noop
|
||||||
vars: &api_defaults
|
vars: &api_defaults
|
||||||
http_agent: "{{ nc_ldap_meta_http_agent }}"
|
http_agent: "{{ nc_ldap_meta_http_agent }}"
|
||||||
headers: "{{ nc_ldap_api_headers }}"
|
headers: "{{ nc_ldap_api_headers }}"
|
||||||
@ -11,7 +11,7 @@
|
|||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
- name: Check if configuration with given config ID already exists
|
- name: Check if configuration with given config ID already exists
|
||||||
uri:
|
ansible.builtin.uri:
|
||||||
<<: *api_defaults
|
<<: *api_defaults
|
||||||
url: "{{ nc_ldap_api_path }}/{{ nc_ldap_config_id }}{{ query_params }}"
|
url: "{{ nc_ldap_api_path }}/{{ nc_ldap_config_id }}{{ query_params }}"
|
||||||
method: GET
|
method: GET
|
||||||
@ -21,19 +21,19 @@
|
|||||||
|
|
||||||
# TODO: Can we force an ID on POST?
|
# TODO: Can we force an ID on POST?
|
||||||
- name: Create ldap configuration with id={{ nc_ldap_config_id }}
|
- name: Create ldap configuration with id={{ nc_ldap_config_id }}
|
||||||
uri:
|
ansible.builtin.uri:
|
||||||
<<: *api_defaults
|
<<: *api_defaults
|
||||||
url: "{{ nc_ldap_api_path }}"
|
url: "{{ nc_ldap_api_path }}"
|
||||||
method: POST
|
method: POST
|
||||||
when: nc_ldap_existing_config_api.status != 200
|
when: nc_ldap_existing_config_api.status != 200
|
||||||
|
|
||||||
- name: Parse output of query command to dict
|
- name: Parse output of query command to dict
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
nc_ldap_existing_config: "{{ nc_ldap_existing_config_api.stdout | from_json }}"
|
nc_ldap_existing_config: "{{ nc_ldap_existing_config_api.stdout | from_json }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Create changeset
|
- name: Create changeset
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
nc_ldap_config_changeset: "{{ nc_ldap_config_changeset | combine(changed_entry) }}"
|
nc_ldap_config_changeset: "{{ nc_ldap_config_changeset | combine(changed_entry) }}"
|
||||||
vars:
|
vars:
|
||||||
changed_entry: "{{ { item : nc_ldap_config_keys[item] } }}"
|
changed_entry: "{{ { item : nc_ldap_config_keys[item] } }}"
|
||||||
@ -41,7 +41,7 @@
|
|||||||
when: nc_ldap_config_keys[item] is defined and nc_ldap_config_keys[item] and nc_ldap_config_keys[item] != nc_ldap_existing_config[nc_ldap_config_id][item]
|
when: nc_ldap_config_keys[item] is defined and nc_ldap_config_keys[item] and nc_ldap_config_keys[item] != nc_ldap_existing_config[nc_ldap_config_id][item]
|
||||||
|
|
||||||
- name: Ensure ldap configuration is in sync (http)
|
- name: Ensure ldap configuration is in sync (http)
|
||||||
uri:
|
ansible.builtin.uri:
|
||||||
<<: *api_defaults
|
<<: *api_defaults
|
||||||
url: "{{ nc_lap_api_path }}/{{ nc_ldap_config_id }}"
|
url: "{{ nc_lap_api_path }}/{{ nc_ldap_config_id }}"
|
||||||
method: PUT
|
method: PUT
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Check if configuration with given config ID already exists
|
- name: Check if configuration with given config ID already exists
|
||||||
docker_container_exec:
|
community.docker.docker_container_exec:
|
||||||
container: "{{ nc_ldap_container }}"
|
container: "{{ nc_ldap_container }}"
|
||||||
command: "{{ nc_ldap_occ_command }} ldap:show-config --output json {{ '--show-password' if nc_ldap_config_agent_password else '' }} {{ nc_ldap_config_id }}"
|
command: "{{ nc_ldap_occ_command }} ldap:show-config --output json {{ '--show-password' if nc_ldap_config_agent_password else '' }} {{ nc_ldap_config_id }}"
|
||||||
user: "{{ nc_ldap_occ_user }}"
|
user: "{{ nc_ldap_occ_user }}"
|
||||||
@ -11,7 +11,7 @@
|
|||||||
register: nc_ldap_existing_config_occ
|
register: nc_ldap_existing_config_occ
|
||||||
|
|
||||||
- name: Create ldap configuration with id={{ nc_ldap_config_id }}
|
- name: Create ldap configuration with id={{ nc_ldap_config_id }}
|
||||||
docker_container_exec:
|
community.docker.docker_container_exec:
|
||||||
container: "{{ nc_ldap_container }}"
|
container: "{{ nc_ldap_container }}"
|
||||||
command: "{{ nc_ldap_occ_command }} ldap:create-empty-config --output json {{ nc_ldap_config_id }}"
|
command: "{{ nc_ldap_occ_command }} ldap:create-empty-config --output json {{ nc_ldap_config_id }}"
|
||||||
user: "{{ nc_ldap_occ_user }}"
|
user: "{{ nc_ldap_occ_user }}"
|
||||||
@ -19,12 +19,12 @@
|
|||||||
when: nc_ldap_existing_config_occ.rc != 0 and nc_ldap_config_id not in (nc_ldap_existing_config_occ.stdout | from_json).keys()
|
when: nc_ldap_existing_config_occ.rc != 0 and nc_ldap_config_id not in (nc_ldap_existing_config_occ.stdout | from_json).keys()
|
||||||
|
|
||||||
- name: Parse output of query command to dict
|
- name: Parse output of query command to dict
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
nc_ldap_existing_config: "{{ nc_ldap_existing_config_occ.stdout | from_json }}"
|
nc_ldap_existing_config: "{{ nc_ldap_existing_config_occ.stdout | from_json }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
- name: Create changeset
|
- name: Create changeset
|
||||||
set_fact:
|
ansible.builtin.set_fact:
|
||||||
nc_ldap_config_changeset: "{{ nc_ldap_config_changeset | combine(changed_entry) }}"
|
nc_ldap_config_changeset: "{{ nc_ldap_config_changeset | combine(changed_entry) }}"
|
||||||
vars:
|
vars:
|
||||||
changed_entry: "{{ { item : nc_ldap_config_keys[item] } }}"
|
changed_entry: "{{ { item : nc_ldap_config_keys[item] } }}"
|
||||||
@ -32,7 +32,7 @@
|
|||||||
when: nc_ldap_config_keys[item] is defined and nc_ldap_config_keys[item] and nc_ldap_config_keys[item] != nc_ldap_existing_config[nc_ldap_config_id][item]
|
when: nc_ldap_config_keys[item] is defined and nc_ldap_config_keys[item] and nc_ldap_config_keys[item] != nc_ldap_existing_config[nc_ldap_config_id][item]
|
||||||
|
|
||||||
- name: Ensure ldap configuration is in sync
|
- name: Ensure ldap configuration is in sync
|
||||||
docker_container_exec:
|
community.docker.docker_container_exec:
|
||||||
container: "{{ nc_ldap_container }}"
|
container: "{{ nc_ldap_container }}"
|
||||||
command: "{{ nc_ldap_occ_command }} ldap:set-config \"{{ nc_ldap_config_id }}\" \"{{ item.key }}\" \"{{ item.value }}\""
|
command: "{{ nc_ldap_occ_command }} ldap:set-config \"{{ nc_ldap_config_id }}\" \"{{ item.key }}\" \"{{ item.value }}\""
|
||||||
user: "{{ nc_ldap_occ_user }}"
|
user: "{{ nc_ldap_occ_user }}"
|
||||||
@ -40,7 +40,7 @@
|
|||||||
loop: "{{ nc_ldap_config_changeset | dict2items }}"
|
loop: "{{ nc_ldap_config_changeset | dict2items }}"
|
||||||
|
|
||||||
- name: Ensure ldap configuration is working
|
- name: Ensure ldap configuration is working
|
||||||
docker_container_exec:
|
community.docker.docker_container_exec:
|
||||||
container: "{{ nc_ldap_container }}"
|
container: "{{ nc_ldap_container }}"
|
||||||
command: "{{ nc_ldap_occ_command }} ldap:test-config {{ nc_ldap_config_id }}"
|
command: "{{ nc_ldap_occ_command }} ldap:test-config {{ nc_ldap_config_id }}"
|
||||||
user: "{{ nc_ldap_occ_user }}"
|
user: "{{ nc_ldap_occ_user }}"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Load config {{ nc_ldap_config_id }} (and create if not exists) when running mode is http
|
- name: Load config {{ nc_ldap_config_id }} (and create if not exists) when running mode is http
|
||||||
include_tasks: load_config_http.yml
|
ansible.builtin.include_tasks: load_config_http.yml
|
||||||
when: nc_ldap_api_method == 'http'
|
when: nc_ldap_api_method == 'http'
|
||||||
|
|
||||||
- name: Load config {{ nc_ldap_config_id }} (and create if not exists) when running mode is occ
|
- name: Load config {{ nc_ldap_config_id }} (and create if not exists) when running mode is occ
|
||||||
include_tasks: load_config_occ.yml
|
ansible.builtin.include_tasks: load_config_occ.yml
|
||||||
when: nc_ldap_api_method == 'occ'
|
when: nc_ldap_api_method == 'occ'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user