Skip to content

Commit

Permalink
Allow configurable upload_cycle_seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
chambridge committed Sep 3, 2020
1 parent a8b820a commit 0ca561a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions roles/setup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ current_year: '{{ ansible_date_time.year | int }}'
setup_template_path: '/tmp/cost-mgmt-operator-collect'
setup_template_dir: "{{ lookup('password', '/dev/null chars=ascii_letters') }}"
setup_delete_after: 'true'
upload_cycle_seconds: 21600
15 changes: 11 additions & 4 deletions roles/setup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
- name: Set collect_data
set_fact:
collect_data: true
when: upload_time_diff is not defined or (( upload_time_diff | int ) > 360)
when: upload_time_diff is not defined or (( upload_time_diff | int ) > upload_cycle_seconds)

- name: print collect_data
debug:
Expand All @@ -99,23 +99,30 @@
msg: 'Metering has not been configured.'
when: not metering_objects.resources

- name: Set upload_cycle_seconds
set_fact:
upload_cycle_seconds: "{{ current_cr_spec.upload_cycle_seconds | int }}"
when:
- current_cr_spec is defined
- current_cr_spec.upload_cycle_seconds is defined

- name: Set current_day
set_fact:
current_day: "{{ cost_mgmt_setup.resources[0].spec.current_day | int }}"
current_day: "{{ current_cr_spec.current_day | int }}"
when:
- current_cr_spec is defined
- current_cr_spec.current_day is defined

- name: Set current_month
set_fact:
current_month: "{{ cost_mgmt_setup.resources[0].spec.current_month | int }}"
current_month: "{{ current_cr_spec.current_month | int }}"
when:
- current_cr_spec is defined
- current_cr_spec.current_month is defined

- name: Set current_year
set_fact:
current_year: "{{ cost_mgmt_setup.resources[0].spec.current_year | int }}"
current_year: "{{ current_cr_spec.current_year | int }}"
when:
- current_cr_spec is defined
- current_cr_spec.current_year is defined
Expand Down

0 comments on commit 0ca561a

Please sign in to comment.