When I use azure module , I saw "PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE"

Hi all,

  • Ansible 2.0.0 alpha 2
  • azure python module 1.0.2
  • python 2.7.6

Also, I try to use #2114 because it has exists issue(#2014).

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

I have already upload “mycert.cer” file to my management portal.

My playbook below;

  • hosts: localhost
    gather_facts: no

user: vagrant
sudo: yes

tasks:

  • name: Create Virtual Machine on Azure (for Linux)
    tags: azure_linux
    azure:
    auto_updates: no
    endpoints: “22”
    hostname: tkstudio
    image: ‘b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_3-LTS-amd64-server-20150908-en-us-30GB’
    location: ‘Japan West’
    name: myhostname
    management_cert_path: /home/vagrant/azure/mycert.pem
    os_type: linux
    user: azureuser
    password: “mypassword”
    reset_pass_atlogon: no
    role_size: Basic_A0
    ssh_cert_path: /home/vagrant/azure/ssh_key/cloud-key.pub
    state: present
    storage_account:
    subscription_id:
    virtual_network_name:
    wait: no
    wait_timeout: 600
    wait_timeout_redirects: 300

I saw error messages when I run a playbook to create vm with ansible azure module.

ESTABLISH LOCAL CONNECTION FOR USER: vagrant
127.0.0.1 EXEC (umask 22 && mkdir -p “$HOME/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356” && echo “$HOME/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356”)
127.0.0.1 PUT /tmp/tmp0jR7IG TO /home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/azure
127.0.0.1 EXEC /bin/sh -c ‘sudo -H -n -S -u root /bin/sh -c ‘"’“‘echo BECOME-SUCCESS-ojpvbfrddrrghbiuzpisxjjqbdatkyfq; LANG=C LC_MESSAGES=C LC_CTYPE=C /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/azure; rm -rf “/home/vagrant/.ansible/tmp/ansible-tmp-1444202389.06-143864791731356/” > /dev/null 2>&1’”’"‘’
fatal: [127.0.0.1]: FAILED! => {“changed”: false, “failed”: true, “msg”: “failed to generate the key fingerprint, error was: unable to load certificate\n139986364962464:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE\n”}

PLAY RECAP *********************************************************************
127.0.0.1 : ok=0 changed=0 unreachable=0 failed=1

I cannot solute this problem yet, any ideas?

Regards,
Takeshi.K