Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,40 @@

when: orgs is defined and dir_orgs_vars is defined

- name: "DESIRED STATE: Get the API list of all Job Templates"
set_fact:
__controller_api_job_templates: "{{ query('ansible.controller.controller_api', 'job_templates',
host=controller_hostname, username=controller_username,
password=controller_password, verify_ssl=false) }}"

- debug:
var: "{{ item }}"
loop:
- __controller_api_job_templates

- name: "DESIRED STATE: Find the difference of Job Templates between what is on the Controller versus CasC on SCM"
set_fact:
__job_templates_difference: "{{ lookup('redhat_cop.controller_casc.controller_object_diff_temp',
api_list=__controller_api_job_templates, compare_list=controller_templates,
with_present=false, set_absent=true ) }}"

- debug:
var: "{{ item }}"
loop:
- __job_templates_difference

- name: "DESIRED STATE: Set job_template's list to be configured"
set_fact:
controller_templates: "{{ __job_templates_difference }}"

- name: "DESIRED STATE: Configure Controller Job Templates"
import_role:
name: redhat_cop.controller_configuration.job_templates
- block:

- name: Get the organization ID
set_fact:
__controller_organization_id: "{{ lookup('ansible.controller.controller_api', 'organizations', query_params={ 'name': orgs },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- name: "DESIRED STATE: Get the API list of all Job Templates {{ orgs }} Organization"
set_fact:
__controller_api_job_templates: "{{ query('ansible.controller.controller_api', 'job_templates',
query_params={ 'organization': __controller_organization_id.id },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- debug:
var: "{{ item }}"
loop:
- __controller_api_job_templates

- name: "DESIRED STATE: Find the difference of Job Templates between what is on the Controller versus CasC on SCM"
set_fact:
__job_templates_difference: "{{ lookup('redhat_cop.controller_casc.controller_object_diff_temp',
api_list=__controller_api_job_templates, compare_list=controller_templates,
with_present=false, set_absent=true ) }}"

- debug:
var: "{{ item }}"
loop:
- __job_templates_difference

- name: "DESIRED STATE: Set job_template's list to be configured"
set_fact:
controller_templates: "{{ __job_templates_difference }}"

- name: "DESIRED STATE: Configure Controller Job Templates"
import_role:
name: redhat_cop.controller_configuration.job_templates
...
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
__controller_api_current_user_check_is_admin: "{{ lookup('ansible.controller.controller_api', 'users', query_params={ 'username': controller_username },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"
- block:
- name: Get the organization ID
set_fact:
__controller_organization_id: "{{ lookup('ansible.controller.controller_api', 'organizations', query_params={ 'name': orgs },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- name: "DESIRED STATE: Get the API list of all teams"
- name: "DESIRED STATE: Get the API list of all teams {{ orgs }} Organization"
set_fact:
__controller_api_teams: "{{ query('ansible.controller.controller_api', 'teams',
host=controller_hostname, username=controller_username,
password=controller_password, verify_ssl=false) }}"
query_params={ 'organization': __controller_organization_id.id },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- debug:
msg: "{{ __controller_api_teams }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,24 @@

when: orgs is defined and dir_orgs_vars is defined

- name: "DESIRED STATE: Get the API list of all Workflow Job Template Nodes"
set_fact:
__controller_api_workflow_job_template_nodes: "{{ query('ansible.controller.controller_api', 'workflow_job_template_nodes',
host=controller_hostname, username=controller_username,
password=controller_password, verify_ssl=false) }}"
- block:

- name: Get the organization ID
set_fact:
__controller_organization_id: "{{ lookup('ansible.controller.controller_api', 'organizations', query_params={ 'name': orgs },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- name: "DESIRED STATE: Get ID of the API list of all Workflow Job Templates {{ orgs }} Organization"
set_fact:
__controller_api_workflow_job_templates_id: "{{ query('ansible.controller.controller_api', 'workflow_job_templates',
query_params={ 'organization': __controller_organization_id.id },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) | selectattr('id', 'defined') | map(attribute='id') }}"

- name: "DESIRED STATE: Get the API list of all Workflow Job Template Nodes {{ orgs }} Organization"
set_fact:
__controller_api_workflow_job_template_nodes: "{{ query('ansible.controller.controller_api', 'workflow_job_template_nodes',
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) | selectattr('workflow_job_template', 'defined') | selectattr('workflow_job_template','in',__controller_api_workflow_job_templates_id) }}"

- block:
- debug:
var: "{{ item }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,39 @@

when: dir_orgs_vars is defined and orgs is defined

- name: "DESIRED STATE: Get the API list of all Workflow Job Templates"
set_fact:
__controller_api_workflow_job_templates: "{{ query('ansible.controller.controller_api', 'workflow_job_templates',
host=controller_hostname, username=controller_username,
password=controller_password, verify_ssl=false) }}"

- debug:
var: "{{ item }}"
loop:
- __controller_api_workflow_job_templates

- name: "DESIRED STATE: Find the difference of Workflow Job Templates between what is on the Controller versus CasC on SCM"
set_fact:
__workflow_job_templates_difference: "{{ lookup('redhat_cop.controller_casc.controller_object_diff_temp',
api_list=__controller_api_workflow_job_templates, compare_list=controller_workflows,
with_present=false, set_absent=true ) }}"

- debug:
var: "{{ item }}"
loop:
- __workflow_job_templates_difference

- name: "DESIRED STATE: Set job_template's list to be configured"
set_fact:
controller_workflows: "{{ __workflow_job_templates_difference }}"

- name: "DESIRED STATE: Configure Controller Workflow Job Templates"
import_role:
name: redhat_cop.controller_configuration.workflow_job_templates
- block:
- name: Get the organization ID
set_fact:
__controller_organization_id: "{{ lookup('ansible.controller.controller_api', 'organizations', query_params={ 'name': orgs },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- name: "DESIRED STATE: Get the API list of all Workflow Job Templates"
set_fact:
__controller_api_workflow_job_templates: "{{ query('ansible.controller.controller_api', 'workflow_job_templates',
query_params={ 'organization': __controller_organization_id.id },
host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=false) }}"

- debug:
var: "{{ item }}"
loop:
- __controller_api_workflow_job_templates

- name: "DESIRED STATE: Find the difference of Workflow Job Templates between what is on the Controller versus CasC on SCM"
set_fact:
__workflow_job_templates_difference: "{{ lookup('redhat_cop.controller_casc.controller_object_diff_temp',
api_list=__controller_api_workflow_job_templates, compare_list=controller_workflows,
with_present=false, set_absent=true ) }}"

- debug:
var: "{{ item }}"
loop:
- __workflow_job_templates_difference

- name: "DESIRED STATE: Set job_template's list to be configured"
set_fact:
controller_workflows: "{{ __workflow_job_templates_difference }}"

- name: "DESIRED STATE: Configure Controller Workflow Job Templates"
import_role:
name: redhat_cop.controller_configuration.workflow_job_templates
...