{"id":58397,"date":"2020-04-27T11:43:40","date_gmt":"2020-04-27T10:43:40","guid":{"rendered":"http:\/\/content.n4stack.io\/?p=58397"},"modified":"2021-04-20T15:12:34","modified_gmt":"2021-04-20T14:12:34","slug":"ansible-and-the-azure-rest-api","status":"publish","type":"post","link":"http:\/\/content.n4stack.io\/2020\/04\/27\/ansible-and-the-azure-rest-api\/","title":{"rendered":"Ansible and the Azure REST API"},"content":{"rendered":"

[et_pb_section fb_built=”1″ fullwidth=”on” _builder_version=”4.9.1″ _module_preset=”default”][et_pb_fullwidth_post_title categories=”off” comments=”off” featured_image=”off” text_color=”light” _builder_version=”4.9.1″ _module_preset=”default” background_color=”#3d3d3d” custom_padding=”200px||100px||false|false”][\/et_pb_fullwidth_post_title][\/et_pb_section][et_pb_section fb_built=”1″ _builder_version=”4.0.11″][et_pb_row _builder_version=”4.0.11″][et_pb_column type=”4_4″ _builder_version=”4.0.11″][et_pb_text _builder_version=”4.4.3″ text_font=”Roboto||||||||” text_font_size=”17px” header_3_text_color=”#e05206″ header_5_text_color=”#00a9e0″]<\/p>\n

Over the last few months I have been doing more and more work with Ansible to manage end-to-end deployments in Azure. For the most part Ansible\u2019s core set of Azure modules work with no problems and more than do the job.\u200b<\/p>\n

However, with the rate which Microsoft are both adding new features and functionality it is difficult to keep up. The core Ansible modules rely on several Azure Python libraries to be updated before the functionality can be added or introduced to the core module set.<\/p>\n

One work around is to use the set of\u00a0preview modules on Ansible Galaxy\u00a0provided by Microsoft. However, being this cutting edge comes with a warning that using them could introduce breaking changes to the core Azure modules due to the preview modules reliance on the updated Python SDK.<\/p>\n

Typically I tend to ignore these as a lot of the work I do is for production systems and I don\u2019t want to rely on something which could change, potentially quite dramatically, before it gets merged into the core set of Ansible Azure modules.<\/p>\n

Luckily, Ansible 2.6 introduced the\u00a0azure_rm_resource<\/code>\u00a0module, this gives you access to create, update or delete any Azure resource using the Azure REST API, this means that if the Azure REST API supports managing the resource \/ feature you want to interact with then you will now be able to do it directly from Ansible.<\/p>\n

Great you may be thinking to yourself, end of blog post, I will go ahead and use azure_rm_resource<\/code>\u00a0for all of those bits I have been trying to put work arounds in place for \u2026<\/p>\n