Questions about expanding Azure module

This is my first time looking to join an open-source project, so apologies in advance if I am committing social faux pas(es?).

Anyway, I read over the CONTRIBUTING.md and the page it links to, and I am interested in expanding the features in the azure module. I am working to move some of my cluster management into Ansible, and figured it would be a good opportunity to contribute something back to the community if I just build with the intent of submitting back to the main project. I have some questions:

  1. Is this the right kind of thing to do? Or should I only be trying to develop and submit back if I am focused on the actual thing itself (developing for Ansible) as opposed to it being something I am contributing as an artifact of other development?
  2. Do I understand the workflow correctly?
    a. fork project
    b. make changes
    c. submit pull request when I have everything working and tested
  3. Is this a feature that is even cared enough about to bother worrying about developing it fully enough for others? Should I actually be making requests as Issues on github first before working on them?

Appreciate any insight/guidance the community might have for me.

Cheers,
Nate

Hi Nate,

Sorry for the late reply as was travelling and am just now catching up on email.

I definitely view Ansible as a tool for people who use the tools - nearly everyone who adds something is a user of that thing, so in that vein, contributions are quite welcome! I think very few of us develop on Ansible to be developing on Ansible, except those of us who are now working for a company called Ansible, and even then, are doing things for users of Ansible :slight_smile:

Definitely doing a fork and submitting a pull request is a way to go. GitHub has some good help on pull requests available.

As for whether this feature is a good idea or not - yes - it usually helps to talk about it first to make sure we’re on the same page.

Can you go into a bit more detail about what the feature would do and what the changes to the “user interface” of the module would be in terms of new parameters?

I added a couple as issues on GitHub. I’m looking at two areas.

  1. The azure module itself is lacking some features for basic VM creation. You cannot use it to add VMs to an existing service, or specify a custom-data file, which is needed in order to start up a CoreOS VM (at least) properly.
  2. There are a lot more capabilities in azure that this does not really allow management of. I would like to add the ability to create/destroy services, provision things like caches, virtual networks, storage accounts (and tables/queue/containers inside), Service Bus entities, and so on. This wouldn’t all be able to go into one module, and would have to be more like the EC2 setup with a module for each thing.

Cheers,
Nate

I added a couple as issues on GitHub. I'm looking at two areas.

Can you please link to these?

Generally I like to keep GitHub somewhat organized, so if it's feature
request tickets, that's not always the best (implementing almost always is)
- and it's easy to miss discussion on them. Though if they are bugs, this
is definitely the right place.

1) The azure module itself is lacking some features for basic VM
creation. You cannot use it to add VMs to an existing service, or specify
a custom-data file, which is needed in order to start up a CoreOS VM (at
least) properly.

Not sure I grok what a "service" is here, but I'm not the one who built the
Azure support. It seems the goal was to spin up new VMs. Can you provide
background info?

2) There are a lot more capabilities in azure that this does not really
allow management of. I would like to add the ability to create/destroy
services, provision things like caches, virtual networks, storage accounts
(and tables/queue/containers inside), Service Bus entities, and so on.
This wouldn't all be able to go into one module, and would have to be more
like the EC2 setup with a module for each thing.

Yep, this should definitely be done in other modules, as per the other
cloud modules.

We need not follow the EC2 nouns, if there's some modelling in Azure which
is more idiomatic to Azure, but yep.

My apologies:
https://github.com/ansible/ansible-modules-core/issues/329
https://github.com/ansible/ansible-modules-core/issues/328

In Azure, VMs and worker roles are organized into “services**”.** It’s how Azure groups related compute resources for tracking and scaling. Services also are how the DNS names (like service.cloudapp.net) are allocated. Not sure what the EC2 parallel is. It’s useful to spin up VMs, but, in my case for instance, I want to spin up VMs that are associated and managed together, share a common private network, etc. That is what services do. (Reference you can read: http://azure.microsoft.com/en-us/documentation/articles/cloud-services-what-is/). Hope that makes more sense?

Thanks – yes it does make sense to surface them in ways that are native to the cloud provider, I think.

It might be useful to show what the proposed syntax to the module might be, as it might help with my conception of what features are being requested/proposed.

Hi Nathan,

I’m no python expert, more of a system operations guy. I also find that the built-in azure module that ships with ansible to be lacking. The module only supports Linux VMs, and it depends upon python-azure. Strangely the python-azure library has difficulties with terminating Linux VMs - it aborts on an error and leaves the cloud service container (which normally wraps around the VM) up. I tried to debug python-azure, but I found the documentation and the user community almost non-existant.

There is an excellent CLI provided by Microsoft called azure-xplat-cli. It is written in javascript and requires nodejs and as a result is cross-platform (can run on Linux/Windows/Mac).

http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/

https://github.com/Azure/azure-xplat-cli

The feature set, documentation and usage examples provided by azure-xplat-cli are very complete.

I was able to provision Linux and Windows VMs with a minimal learning curve. The tool is “smart” so that it will automatically create needed cloud service container, as well as attach the VM disk image blob to the closest storage account container.

I did run into a bug, but I was able to troubleshoot it and get feedback fairly quickly with the active developers on the github site hosting the source code.

I’m interested in writing my own ansible module to wrap around azure-xplat-cli. I think I can write it with bash as that should keep it simple in terms of calling azure-xplat-cli.
I know that the azure-xplat-cli is a bit heavy (it’s not just a simple library, as it required nodejs and other stuff).

Thanks,
Jeff

Azure provides a SDK for Python [1] that seems fairly complete and well
documented. Isn't it the case of improving the azure module in Ansible
rather than bring a complete JavaScript stack into the picture?

[1] - http://azure.microsoft.com/en-us/develop/python/

Giovanni

I’ve looked at that site before, and while it does provide some examples, I didn’t find the documentation to be complete.

For example, maybe I’m not looking in the right place, but where can I find the details for WindowsConfigurationSet:

# Linux VM configuration, you can use WindowsConfigurationSet
# for a Windows VM instead
linux_config = LinuxConfigurationSet('myhostname', 'myuser', 'mypassword', True)

http://azure.microsoft.com/en-us/documentation/articles/cloud-services-python-how-to-use-service-management/#CreateVM

I totally get the point that rather introducing an entire JavaScript stack, it makes much more sense to use the existing Python library. Any way, maybe I just have tried hard enough. :wink:

Thanks,
Jeff

I've looked at that site before, and while it does provide some examples, I didn't find the documentation to be complete.

For example, maybe I'm not looking in the right place, but where can I find the details for WindowsConfigurationSet:
# Linux VM configuration, you can use WindowsConfigurationSet# for a Windows VM instead

linux_config
=LinuxConfigurationSet('myhostname','myuser','mypassword',True)

http://azure.microsoft.com/en-us/documentation/articles/cloud-services-python-how-to-use-service-management/#CreateVM

You're right, the docs about how to create Windows VMs aren't that
great.

I suggest you take a look at
site-packages/azure/servicemanagement/__init__.py for more details as
well as the REST API specification. It'll explain the fields in more
details that you can use to understand how to make it work.

http://msdn.microsoft.com/en-us/library/jj157194.aspx

I'd like to work on this in the near future, but Azure isn't a priority
right now.

Giovanni

Thanks. I think you’ve pointed me in the right direction. At least looking at the class in init.py shows me all the different possible parameters.

Thanks!