-
Notifications
You must be signed in to change notification settings - Fork 104
FortiOS: update logic in the initial playbook #3336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,30 +7,28 @@ | |
| fortinet.fortios.fortios_system_global: | ||
| vdom: "{{ vdom }}" | ||
| system_global: | ||
| management_vdom: "{{ vdom }}" | ||
| vdom_mode: multi-vdom | ||
| hostname: '{{ inventory_hostname.replace("_","-") }}' | ||
| vdom_mode: "{{ netlab_vdom_is_enabled|ternary('multi-vdom', 'no-vdom') }}" | ||
| register: vdom_mode_result | ||
| when: netlab_vdom_is_enabled | ||
|
|
||
| - name: Ensure FortiGate is ready after VDOM mode change | ||
| block: | ||
| - name: Wait 60 seconds after VDOM mode change | ||
| - name: Wait after VDOM mode change | ||
|
a-v-popov marked this conversation as resolved.
Outdated
|
||
| ansible.builtin.wait_for: | ||
| host: "{{ ansible_host }}" | ||
| port: 443 | ||
| timeout: 180 | ||
| sleep: 10 # time in seconds between checks | ||
| delay: 60 # Initial delay in seconds before first check | ||
| sleep: 10 # time in seconds between checks | ||
| delay: "{{ netlab_vdom_timer }}" # Initial delay in seconds before first check | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be replaced with until/delay/retries parameters (see my response to @sdargoeuves comment)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To my understanding the key part was to sit there quietly for |
||
| state: started | ||
| when: netlab_vdom_timer|default(0) > 0 | ||
| - name: Test FortiGate API readiness after VDOM mode change | ||
| fortinet.fortios.fortios_system_global: | ||
| vdom: "{{ vdom }}" | ||
| system_global: | ||
| hostname: '{{ inventory_hostname.replace("_","-") }}' | ||
| register: hostname_result | ||
| retries: 5 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use the same |
||
| delay: 10 # Initial delay and waiting time between retries | ||
| delay: 10 # waiting time between retries | ||
| until: hostname_result is not failed and hostname_result.meta.http_status == 200 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would simple |
||
| when: >- | ||
| vdom_mode_result.meta is defined and | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand it correctly, this applies the hostname only when we switched into multi-VDOM mode before, but isn't the hostname applied in the configuration template? I'm probably missing some nuance here. Also, if the purpose of this task is to check the API readiness (and setting the hostname is just a convoluted way of doing that), then maybe we could use a simpler R/O call and have it executed all the time (without the "when" condition)?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more thought: if the "when" condition is identifying whether we changed the VDOM, maybe we can just put the two waiting tasks in a |
||
|
|
@@ -43,13 +41,5 @@ | |
| vdom_type: admin | ||
| when: netlab_vdom_is_enabled | ||
|
|
||
| - name: Configure `{{ netlab_vdom }}` virtual domain | ||
| fortinet.fortios.fortios_system_vdom: | ||
| vdom: "{{ vdom }}" | ||
| state: present | ||
| system_vdom: | ||
| name: "{{ netlab_vdom }}" | ||
| when: netlab_vdom_is_enabled | ||
|
|
||
| - name: Deploy initial configuration from template | ||
| include_tasks: tasks/deploy-config/fortios.yml | ||
Uh oh!
There was an error while loading. Please reload this page.