Skip to content
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

Ansible Module #126

Open
rabin-io opened this issue Jan 2, 2020 · 4 comments
Open

Ansible Module #126

rabin-io opened this issue Jan 2, 2020 · 4 comments

Comments

@rabin-io
Copy link

rabin-io commented Jan 2, 2020

Hi,

First I like to thank you for this project, which make working with tc much more sane for us mortals.

One thing I like to ask is if you would consider porting the code base into an Ansible Module ?
I started testing this with a client side support where tcconfig is installed on the destination machine. And I have as small lib which I was able to compile from several places which tried to do the same, which works for my small use case, but I think that having the support directly as ansible module/lib which compile the commands on the managing host and push the required commands to the provisioned machine is the right why to accomplish this.

---
- hosts: all
  become: True
  user: vagrant
  vars:
    ansible_python_interpreter: /usr/bin/python
  tasks:

    - tc:
        device: eth1
        loss: 30%
        delay: 70ms
        delay_distro: 30ms
        dst_network: 192.168.56.202
@thombashi thombashi self-assigned this Jan 5, 2020
@thombashi
Copy link
Owner

thombashi commented Jan 5, 2020

Hi,

Thank you for your feedback and information.

It looks interesting.
However, I'm not familiar with Ansible module development, so let me clarify your expectations.
Did you expect me to take over your module development, and fill out module info then make a PR to Ansible repository?
Are there any test codes for the module?

@rabin-io
Copy link
Author

rabin-io commented Jan 5, 2020

Hi,

I was more thinking you can write a better version for this module, as my experience with Python is almost zero to none, and the above gist was hacked by looking on the Ansible Module development example.

I see this like this...
The Ansible Module abstract the configuration of using tc, much like the CLI format you have provided to simplify the usage of tc and apply the command on the managed machine. Since Ansible is Python based just like your library/tool I was thinking that would be a "easy" task. The thing is that Ansible modules need to be consistent so that it should only change when there is something to change and bring the system to the desired state, just like you have implemented the overwrite/change/add options.

My thinking was to have a module which only need the library installed on the manage machine, which compile the commands and push/run them on the remote machine. But that was over my head, so I installed tcconfig on the remote machine and compiled the tcset command line and pushed it to the machine and run the command as is with overwrite option.

I know I'm asking for a lot, but that was my wish for "Ansible Module" for tc

@thombashi
Copy link
Owner

Thank you for your detailed explanation.

Looks like this will need more investigation.
I'm not sure this would even be possible or not.

tcconfig client/server #128 can be used for setup shaping rules to remote hosts.

@rabin-io
Copy link
Author

Hi,

The option to import external libs are there ... but I won't know what to do with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants