-
Couldn't load subscription status.
- Fork 167
Add a parameter to only do a commit check #109
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
Conversation
This is useful when doing first a "commit confirm" followed directly by a "commit check".
That way, if the commit breaks connectivity to the device, the configuration rollbacks, if there is still connectivity the commit check is faster than a full commit and doesn't trigger configuration archival, etc..
Example:
```yaml
- name: "Do a commit confirmed 2 or commit check"
junos_install_config:
host={{ inventory_hostname }}
port=22
file="{{ assembled_conf }}"
overwrite=false
replace=true
diffs_file="{{ logs_dir }}/{{ inventory_hostname }}.diff"
logfile="{{ logs_dir }}/{{ inventory_hostname }}.log"
timeout="300"
comment="Ansible"
confirm="2"
register: push_result
- name: "commit check to confirm the previous commit"
junos_commit:
host={{ inventory_hostname }}
check=true
when: not check_mode and push_result.changed
```
|
@XioNoX If I am not wrong if we can provide --check option on command line while running playbook. This would take care of commit check. |
|
@vnitinv The issue if I do that with the example tasks above is that "junos_install_config" will also be ran as --check, and thus will not commit anything. |
|
I'd look at working this into junos_install_config, instead. I have a PyEZ-based script that does a commit-confirm, followed by a probe after an arbitrary sleep, and a commit-check if still connected. The applicability of running this as a separate play is rather narrow. Hundreds of junos_install_config jobs could have their commit-confirm timeout and rollback before the commit-check is ever done. |
|
+1 |
|
@vnitinv ping? |
|
@vnitinv could that PR have some attention? |
|
@XioNoX Will look into this @stacywsmith Can you please look into this pull request and review the same. |
|
Sorry, but I'm trying to wrap my head around how this is useful. In your example, you modify the config using You then execute Yes, the I see two issues:
Maybe I'm still missing something about your change. If so, please try to enlighten me. ;-) |
|
@mortalius I believe what your requesting is slightly different. It's a change to |
Doh! My apologies! I now see this is an incorrect statement. A I now see the light (and the benefit of your pull request). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just requesting an addition to the comment to better explain the behavior.
| default: None | ||
| check: | ||
| description: | ||
| - Do a commit check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the Junos behavior was not obvious to me, can you please add a line or two to this comment explaining why this is useful? Something like:
Both a commit and a commit check can be used to confirm a previous commit confirmed <min>. However, a commit check confirms the previous commit without performing an actual commit and modifying the configuration rollback history.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, description updated.
Add to the commit check description the fact that it can be used to confirm a `commit confirmed`
Fix a regression caused by #109. The new check argument added to junos_commit by #109 was not correctly specified. Therefore, the following error was produced when the task ommitted the check argument (default behavior). ``` fatal: [r0]: FAILED! => {"changed": false, "failed": true, "msg": "value of check must be one of: yes,on,1,true,1,True,no,off,0,false,0,False, got: False"} ``` This change correctly specifies the argument's type as bool.
This is useful when doing first a "commit confirm" followed directly by a "commit check".
That way, if the commit breaks connectivity to the device, the configuration rollbacks, if there is still connectivity the commit check is faster than a full commit and doesn't trigger configuration archival, etc..
Example: