Skip to content

Commit 0fb61d4

Browse files
Adding default path to output_path
1 parent d56aa14 commit 0fb61d4

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

roles/playbook_upgrade_validator/docs/doc_playbook_upgrade_validator

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ options:
3535
output_path:
3636
description:
3737
- Path to the output JSON file where results should be saved.
38-
required: true
38+
- Default path is <<playbook_dir>>/logs/migration_report.json
39+
required: false
3940
type: str
4041
playbook_path:
4142
description:

roles/playbook_upgrade_validator/files/playbook_upgrade_validator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
output_path:
4040
description:
4141
- Path to the output JSON file where results should be saved.
42+
- Default path is <<playbook_dir>>/logs/migration_report.json
4243
required: true
4344
type: str
4445
playbook_path:

roles/playbook_upgrade_validator/tasks/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@
2020
register: python_path_result
2121

2222
- name: Load migration changes from JSON file
23-
set_fact:
23+
ansible.builtin.set_fact:
2424
data: "{{ lookup('file', 'dependency_config.json') | from_json }}"
2525
delegate_to: localhost
2626

27+
- name: Create logs directory when output_path is not defined
28+
ansible.builtin.file:
29+
path: "{{ playbook_dir }}/logs"
30+
state: directory
31+
when: output_path is not defined
32+
33+
- name: Set output_path variable if it was not defined
34+
ansible.builtin.set_fact:
35+
output_path: "{{ playbook_dir }}/logs/migration_report.json"
36+
when: output_path is not defined
37+
2738
- name: Run playbook upgrade validator to list migration changes
2839
ansible.builtin.command:
2940
cmd: >

0 commit comments

Comments
 (0)