-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from plajusticia/refactor_projects
Refactor projects
- Loading branch information
Showing
6 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
roles/controller_casc_from_aap/tasks/projects_from_aap_improved.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: "Get current Projects from the API" | ||
set_fact: | ||
projects_lookvar: "{{ query('ansible.controller.controller_api', 'api/v2/projects/', host=controller_hostname, username=controller_username, password=controller_password, verify_ssl=controller_validate_certs, return_all=true) }}" | ||
|
||
- name: "Create the output directory: {{ output_path }}" | ||
file: | ||
path: "{{ output_path }}" | ||
state: directory | ||
|
||
- name: "Add current projects to the output yaml file: {{ output_path }}/current_projects.yaml" | ||
template: | ||
src: "templates/current_projects_improved.j2" | ||
dest: "{{ output_path }}/current_projects.yaml" | ||
vars: | ||
current_projects_asset_value: "{{ projects_lookvar }}" | ||
... |
2 changes: 1 addition & 1 deletion
2
roles/controller_casc_from_aap/templates/current_job_templates_improved.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
roles/controller_casc_from_aap/templates/current_projects_improved.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
controller_projects: | ||
{% for project in current_projects_asset_value %} | ||
- name: "{{ project.name }}" | ||
description: "{{ project.description }}" | ||
organization: "{{ project.summary_fields.organization.name | default('ToDo: The project \'' + project.name + '\' must have an organization') }}" | ||
{% if project.scm_type %} | ||
scm_type: "{{ project.scm_type }}" | ||
scm_url: "{{ project.scm_url }}" | ||
scm_credential: "{{ project.summary_fields.credential.name | default('ToDo: The project \'' + project.name + '\' is missing the SCM credential') }}" | ||
scm_branch: "{{ project.scm_branch }}" | ||
scm_clean: "{{ project.scm_clean }}" | ||
scm_delete_on_update: "{{ project.scm_delete_on_update }}" | ||
scm_update_on_launch: "{{ project.scm_update_on_launch }}" | ||
scm_update_cache_timeout: "{{ project.scm_update_cache_timeout }}" | ||
{% endif %} | ||
allow_override: "{{ project.allow_override }}" | ||
timeout: {{ project.timeout }} | ||
{% endfor %} | ||
... |