|
5 | 5 | - name: Debug
|
6 | 6 | ansible.builtin.debug:
|
7 | 7 | msg:
|
8 |
| - - "{{ awx_playbook_filename }}" |
9 |
| - - "{{ awx_job_template }}" |
| 8 | + - "{{ nfc_pb_awx_playbook_filename }}" |
| 9 | + - "{{ nfc_pb_awx_job_template }}" |
| 10 | + - "{{ nfc_pb_awx_job_template_name | default('Not Yet Defined') }}" |
10 | 11 |
|
11 | 12 | # - name: Create fact from Playbook
|
12 | 13 | # ansible.builtin.set_fact:
|
13 |
| - # playbook_contents: "{{ lookup('file', awx_playbook_filename) | from_yaml }}" |
14 |
| - # when: awx_playbook_filename | default('') != '' |
| 14 | + # playbook_contents: "{{ lookup('file', nfc_pb_awx_playbook_filename) | from_yaml }}" |
| 15 | + # when: nfc_pb_awx_playbook_filename | default('') != '' |
15 | 16 | # failed_when: false
|
16 | 17 |
|
17 | 18 |
|
18 | 19 | # - name: Job Template from Playbook
|
19 | 20 | # ansible.builtin.set_fact:
|
20 | 21 | # # playbook_contents: "{{ playbook_contents[0] }}"
|
21 |
| - # # awx_name: "{{ playbook_contents[0].name }}" |
22 |
| - # awx_tower_template: "{{ awx_job_template.vars.awx_tower_template }}" |
23 |
| - # when: playbook_contents[0].vars.awx_tower_template | default([]) | length | int > 0 |
| 22 | + # # nfc_pb_awx_name: "{{ playbook_contents[0].name }}" |
| 23 | + # nfc_pb_awx_tower_template: "{{ nfc_pb_awx_job_template.vars.nfc_pb_awx_tower_template }}" |
| 24 | + # when: playbook_contents[0].vars.nfc_pb_awx_tower_template | default([]) | length | int > 0 |
24 | 25 | # loop: "{{ playbook_contents }}"
|
25 | 26 | # loop_control:
|
26 | 27 | # loop_var: job_template
|
27 | 28 | # failed_when: false
|
28 | 29 |
|
29 | 30 | - name: Create Labels
|
30 | 31 | awx.awx.label:
|
31 |
| - controller_host: "{{ awx_controller_host | default(omit) }}" |
32 |
| - controller_oauthtoken: "{{ awx_controller_oauthtoken | default(omit) }}" |
33 |
| - controller_username: "{{ awx_controller_username | default(omit) }}" |
34 |
| - controller_password: "{{ awx_controller_password | default(omit) }}" |
| 32 | + controller_host: "{{ nfc_pb_awx_controller_host | default(omit) }}" |
| 33 | + controller_oauthtoken: "{{ nfc_pb_awx_controller_oauthtoken | default(omit) }}" |
| 34 | + controller_username: "{{ nfc_pb_awx_controller_username | default(omit) }}" |
| 35 | + controller_password: "{{ nfc_pb_awx_controller_password | default(omit) }}" |
35 | 36 | name: "{{ item }}"
|
36 |
| - organization: "{{ awx_organization.name }}" |
| 37 | + organization: "{{ nfc_pb_awx_organization.name }}" |
37 | 38 | state: present
|
38 | 39 | validate_certs: "{{ validate_certs | default(true) }}"
|
| 40 | + loop: "{{ nfc_pb_awx_job_template.labels | default([]) }}" |
39 | 41 |
|
40 | 42 |
|
41 |
| - - name: "Configure Job Template {{ awx_playbook_dir | default('') }}{{ awx_playbook_filename }}" |
| 43 | + - name: "Configure Job Template {{ nfc_pb_awx_playbook_dir | default('') }}{{ nfc_pb_awx_playbook_filename }}" |
42 | 44 | awx.awx.job_template:
|
43 |
| - name: "{{ awx_job_template.name }}" |
44 |
| - description: "{{ awx_job_template.description | default(omit) }}" |
45 |
| - controller_host: "{{ awx_controller_host | default(omit) }}" |
46 |
| - controller_oauthtoken: "{{ awx_controller_oauthtoken | default(omit) }}" |
47 |
| - controller_username: "{{ awx_controller_username | default(omit) }}" |
48 |
| - controller_password: "{{ awx_controller_password | default(omit) }}" |
49 |
| - execution_environment: "{{ awx_job_template.execution_environment | default(omit) }}" |
50 |
| - job_type: "{{ awx_job_template.job_type | default('run') }}" |
51 |
| - job_tags: "{{ awx_job_template.job_tags | default(omit) }}" |
52 |
| - organization: "{{ awx_organization.name }}" |
53 |
| - # inventory: "{{ awx_inventory.name | default(omit) }}" |
54 |
| - project: "{{ awx_project.name }}" |
55 |
| - playbook: "{{ awx_project.path | default('') }}{{ awx_playbook_filename }}" |
56 |
| - # scm_branch: "{{ awx_branch }}" |
57 |
| - ask_tags_on_launch: "{{ awx_job_template.ask_tags_on_launch | default(false) | bool }}" |
58 |
| - ask_inventory_on_launch: "{{ awx_job_template.ask_inventory_on_launch | default(true) | bool }}" |
59 |
| - credentials: "{{ awx_job_template.credentials | default(omit) }}" |
60 |
| - state: "{{ awx_job_template.state | default('present') }}" |
61 |
| - survey_enabled: "{{ awx_job_template.survey_enabled | default(false) | bool }}" |
62 |
| - # survey_spec: "{{ awx_job_template.survey_spec | from_yaml | to_json | default(omit) }}" |
| 45 | + name: "{{ nfc_pb_awx_job_template.name }}" |
| 46 | + description: "{{ nfc_pb_awx_job_template.description | default(omit) }}" |
| 47 | + controller_host: "{{ nfc_pb_awx_controller_host | default(omit) }}" |
| 48 | + controller_oauthtoken: "{{ nfc_pb_awx_controller_oauthtoken | default(omit) }}" |
| 49 | + controller_username: "{{ nfc_pb_awx_controller_username | default(omit) }}" |
| 50 | + controller_password: "{{ nfc_pb_awx_controller_password | default(omit) }}" |
| 51 | + execution_environment: "{{ nfc_pb_awx_job_template.execution_environment | default(omit) }}" |
| 52 | + job_type: "{{ nfc_pb_awx_job_template.job_type | default('run') }}" |
| 53 | + job_tags: "{{ nfc_pb_awx_job_template.job_tags | default(omit) }}" |
| 54 | + organization: "{{ nfc_pb_awx_organization.name }}" |
| 55 | + # inventory: "{{ nfc_pb_awx_inventory.name | default(omit) }}" |
| 56 | + project: "{{ nfc_pb_awx_project.name }}" |
| 57 | + playbook: "{{ nfc_pb_awx_project.path | default('') }}{{ nfc_pb_awx_playbook_filename }}" |
| 58 | + # scm_branch: "{{ nfc_pb_awx_branch }}" |
| 59 | + ask_tags_on_launch: "{{ nfc_pb_awx_job_template.ask_tags_on_launch | default(false) | bool }}" |
| 60 | + ask_inventory_on_launch: "{{ nfc_pb_awx_job_template.ask_inventory_on_launch | default(true) | bool }}" |
| 61 | + credentials: "{{ nfc_pb_awx_job_template.credentials | default(omit) }}" |
| 62 | + state: "{{ nfc_pb_awx_job_template.state | default('present') }}" |
| 63 | + survey_enabled: "{{ nfc_pb_awx_job_template.survey_enabled | default(false) | bool }}" |
| 64 | + # survey_spec: "{{ nfc_pb_awx_job_template.survey_spec | from_yaml | to_json | default(omit) }}" |
63 | 65 | survey_spec: >-
|
64 |
| - {%- if awx_job_template.survey_spec | default ('') == '' -%} |
| 66 | + {%- if nfc_pb_awx_job_template.survey_spec | default ('') == '' -%} |
65 | 67 | {{ omit }}
|
66 | 68 | {%- else -%}
|
67 |
| - {{ awx_job_template.survey_spec | from_yaml | to_json }} |
| 69 | + {{ nfc_pb_awx_job_template.survey_spec | from_yaml | to_json }} |
68 | 70 | {%- endif -%}
|
| 71 | + labels: "{{ nfc_pb_awx_job_template.labels | default(omit) }}" |
| 72 | + verbosity: "{{ nfc_pb_awx_job_template.verbosity | default(2) }}" |
| 73 | + ask_scm_branch_on_launch: "{{ nfc_pb_awx_job_template.ask_scm_branch_on_launch | default(false) | bool }}" |
| 74 | + ask_limit_on_launch: "{{ nfc_pb_awx_job_template.ask_limit_on_launch | default(false) | bool }}" |
| 75 | + ask_job_type_on_launch: "{{ nfc_pb_awx_job_template.ask_job_type_on_launch | default(true) | bool }}" |
| 76 | + use_fact_cache: "{{ nfc_pb_awx_job_template.use_fact_cache | default(true) | bool }}" |
69 | 77 | validate_certs: "{{ validate_certs | default(true) }}"
|
70 | 78 | # no_log: true
|
71 |
| - when: awx_tower_template | default('') != '' |
| 79 | + when: nfc_pb_awx_tower_template | default('') != '' |
72 | 80 | diff: true
|
73 | 81 |
|
74 | 82 |
|
75 |
| - - name: "RBAC - {{ awx_organization.name }}/Project/{{ awx_project.name }}/Job/{{ awx_job_template.name }}" |
| 83 | + - name: "RBAC - {{ nfc_pb_awx_organization.name }}/Project/{{ nfc_pb_awx_project.name }}/Job/{{ nfc_pb_awx_job_template.name }}" |
76 | 84 | ansible.builtin.include_tasks:
|
77 | 85 | file: tasks/awx/rbac.yaml
|
78 |
| - loop: "{{ awx_project.rbac.job }}" |
| 86 | + loop: "{{ nfc_pb_awx_project.rbac.job }}" |
79 | 87 | loop_control:
|
80 |
| - loop_var: awx_rbac |
| 88 | + loop_var: nfc_pb_awx_rbac |
81 | 89 | when:
|
82 | 90 | (
|
83 |
| - awx_project.type | lower == 'playbook' |
| 91 | + nfc_pb_awx_project.type | lower == 'playbook' |
84 | 92 | or
|
85 |
| - awx_project.type | lower == 'both' |
| 93 | + nfc_pb_awx_project.type | lower == 'both' |
86 | 94 | )
|
87 | 95 | vars:
|
88 |
| - job_template_name: "{{ awx_job_template.name }}" |
| 96 | + nfc_pb_awx_job_template_name: "{{ nfc_pb_awx_job_template.name }}" |
89 | 97 |
|
90 | 98 | # - name: Fact Cleanup - job_template
|
91 | 99 | # ansible.builtin.set_fact:
|
92 |
| - # awx_tower_template: |
| 100 | + # nfc_pb_awx_job_template_name: |
0 commit comments