如何配置ansible蔚蓝模块 [英] how to configure azure module in ansible

查看:185
本文介绍了如何配置ansible蔚蓝模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于受上提,我想配置ansible蔚蓝的模块中,还发现在GitHub上蔚蓝的模块,但我不也不怎么设置,请帮我安装和配置。

As mention on subject,I want to configure azure module in ansible, also find out azure module in github but i don't not how to setup, please help me to install and configure.

推荐答案

  • you need to install sudo pip install azure==0.11.1(newest azure version > 1.0 not compatible with ansible yet here is github issue https://github.com/ansible/ansible-modules-core/pull/2114)

    现在你需要在蔚蓝控制台创建STORAG​​E_ACCOUNT(后来在剧本中指定它)

    Now you need to create Storage_account in the azure console(and later specify it in the playbook)

    生成的VM SSH密钥

    Generate ssh key for VM

    OpenSSL的REQ -x509 -key的〜/ .ssh / id_rsa -nodes -days 365 -newkey RSA:2048退房手续的〜/ .ssh / ssh_key.pem


    • 给予生成的密钥只有所有者的权限

    搭配chmod 600的〜/ .ssh / ssh_key.pem


    • 上传该证书到你的Azure订阅。我通过节点蔚CLI做到了

    • Upload this certificate to your azure subscription. I did it via node azure-cli

    百胜安装NPM或apt-get安装NPM

    nsudo NPM安装-g蔚CLI

    蔚蓝帐户下载

    按显示的链接下载您订阅文件。

    downloading your subscription file by displayed link.

    蔚蓝帐户导入<路径下载的文件>

    导出管理证书为您的订阅

    Export manage certificate for your subscription

    蔚蓝帐户证书导出-f的〜/ .ssh / manage.cer

    此外,我需要通过azurecli获得VM映像的名字,因为我无法在蔚蓝的控制台中找到它。

    Also I needed to get VM image name via azurecli because I could not find it in the azure console.

    蔚蓝的VM映像列表| grep的CentOS的

    然后你需要写剧本这将启动VM蔚蓝:

    then you need to write playbook which will launch azure VM:

    - local_action:
        module: azure
        name: 'vm_name'
        role_size: Small
        image: '5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-67-20150815'
        password: 'some_pass'
        location: 'East US 2'
        user: admin
        wait: yes
        subscription_id: 'some subscription'    
        management_cert_path: '~/.ssh/manage.cer'
        storage_account: 'some account'
        endpoints: '22,8080,80'
      register: azure_vm
    
    
    - add_host:
        name: '{{ azure_vm.public_dns_name }}'
    
    - name: wait when instance become ready to use
      wait_for:
       host: '{{ azure_vm.public_dns_name }}'
       port: "22"
       delay: "60"
       timeout: "320"
       state: "started"
    

    这个剧本将创建Centos6机管理​​用户和密码。目前,我无法SSH密钥认证创造的机器。我不断收到味精:password参数需要新的实例

    This playbook will create Centos6 machine with admin user and password. Currently I could not create machine with ssh-key authentication. I'm keep getting msg: password parameter is required for new instance

    更新:修复证书生成程序

    UPDATED: Fixed certificate generation procedure.

    这篇关于如何配置ansible蔚蓝模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆