-
Notifications
You must be signed in to change notification settings - Fork 107
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
[RFE] implement async module to support changing IP address #32
Comments
Hello, I would like to work on this issue. Please give me some follow-ups. |
@codetronaut great! @thom311 @tyll could you please give advice? By the way, using the CheckPoint feature is already implemented in #119 , I believe. |
@codetronaut from a quick look I think the best place to start would be to read about the CheckPoint feature referenced above and look in PR #119 to see how it is used in the network role (in the internal module which implements most of the functionality, which is here: https://github.com/linux-system-roles/network/blob/master/library/network_connections.py). Then you could modify the module to introduce a timeout, after which the state is rolled back. And introduce a new operation which would cancel the timeout. Finally, you would change the Ansible parts of the role so that it calls the module asynchronously, then reconnects and invokes the cancellation of the timeout. (Unless the maintainers have different suggestions.) |
I think the important bit here are how to implement async modules. It's more a question about ansible module development... I am not familiar with it, but I'd look how other modules handle that. For example, how can the SSH module change the port? How does reboot work? |
An example of a test which reboots the managed host can be seen here: |
here is some information about async tasks: https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html |
@thom311 what is the SSH module? I don't see it in the module index. |
@codetronaut in this case, because most of the role functionality is implemented in an Ansible module, the Ansible documentation about developing modules could be useful: https://docs.ansible.com/ansible/latest/dev_guide/index.html |
@codetronaut you don't need to dive too much into the details of Ansible module development though, as you are not developing a module from scratch, the module already exists and you will need to only extend it a bit. |
sure @pcahyna , will do it. |
@codetronaut : @tyll uncovered some problems in the checkpoint implementation, see #154, so the code in #119 is likely to get changed. |
Sure. |
Then you could modify the module to introduce a timeout, after which the state is rolled back. And introduce a new operation which would cancel the timeout. please guide me for this, I understand the part after the creation of the module i.e to insert into the ansible's python file. |
@codetronaut thank you for your patience. I just submitted a PR to fix the current bug in the implementation (#193) and I thought about this feature. IMHO the next step after the bug is fixed is to refactor the code to
when the network_provider is nm. Afterwards we can consider additional checks that would call |
Actually my comment probably belongs better to #123 but this all needs to play well together. |
Commonly, the role will connect to the host via SSH. Hence, it cannot currently support to change the IP address of the host, because it will cut itself off.
ansible supports reboot of the system or changing the TCP port of the SSH server via async requests and poll for completion. Something similar should be possible for the network role.
The user should be able to specify that the role works asynchronously, and that afterwards the host is reachable via a new IP address.
Also interesting is to combine this with the CheckPoint feature of NetworkManager.
The text was updated successfully, but these errors were encountered: