Ansible gave "Error fetching server list on envvars:RegionOne" error

334 views
Skip to first unread message

Balu Kompalli

unread,
Mar 29, 2017, 4:55:50 PM3/29/17
to Ansible Project


Hello team,

warm wishes to all the Ansible team.

I got the below error while try to create the provisioning ansible in openstack.

I searched for so  many websites but never found any solution. Please help me to come out of the error and its my high priority task on Ansible.


Thank you.


and this is my playbook:
---
latest.yml
----

- name: Deploy on OpenStack
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Deploy an instance
    os_server:
      state: present
      auth:
       auth_url: http://{{ip}}:{{port}}/v3/
       username: admin
       password: ******
       project_name: sample

      name: webserver
      image: CentOs_image
      region_name: RegionOne
      availability_zone: nova
      key_name: root
      wait: yes
      flavor: m1.medium
      auto_floating_ip: yes
      network: private
      meta:
        hostname: webserver.localdomain
    register: webserver
  - debug: var=webserver

  - name: ensure apache is at the latest version
    yum: name=httpd state=latest
  - name: make sure apache is running
    service: name=httpd state=running




Amarjeet Raja

unread,
Mar 30, 2017, 1:01:54 PM3/30/17
to ansible...@googlegroups.com
Hi, 

The issue is not related to your playbook. The error is from openstack side looks like you are missing domain in environment varibales. Try adding domain in your your openrc file  and run the playbook in verbose mode.

Also  it looks like your system is trying to connect to region two and in Playbook is configured with Region one. As you can see in error message the error is for region2. Can you cross check the env variables? 

Regards,
Amarjeet


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e23475a0-f505-4dca-807d-50e1bda396e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

balubhai555

unread,
Mar 30, 2017, 4:05:55 PM3/30/17
to Ansible Project
Hello Raja,

Thanks for your reply. 




1.) Here Domain means is that the Openstack OS_AUTH_URL=https://identityHost:portNumber/v2.0  Right?


2.) Yes, I cross check about error and uploaded image. For both RegionOne and RegionTwo, I got the same error.

Please reply ASAP.

  Thank you in advance.

balubhai555

unread,
Mar 30, 2017, 4:19:50 PM3/30/17
to Ansible Project
I gave 

export OS_USER_DOMAIN_NAME=default

in openrc.sh and Is this one you mentioned above?



Amarjeet Raja

unread,
Mar 31, 2017, 7:01:09 AM3/31/17
to ansible...@googlegroups.com
Hi,

Looks like you misunderstood my previous mail, there is no need to edit your openrc file. The OS_server module can load the login details from openrc file. Hard coding openstack logins in playbook is not a recommended practice. You can use the sample snippet given below to create an instance in openstack using ansible and assign floating IP address.

----
[centos@centos7 ~]# cat createinstance.yml
- name: launch a compute instance
  hosts: localhost
  tasks:
    - name: launch an instance
      os_server:
        name: vmtest
        state: present
        image: Cirros
        flavor: m1.medium
        security_groups: default
        auto_ip: yes

[centos@centos7 centos]# source openrc.sh
[centos@centos7 ~]# ansible-playbook createinstance.yml

PLAY [launch a compute instance] ***********************************************

TASK [setup] *******************************************************************
Friday 31 March 2017  10:44:31 +0000 (0:00:00.045)       0:00:00.045 **********
ok: [localhost]

TASK [launch an instance] ******************************************************
Friday 31 March 2017  10:44:33 +0000 (0:00:01.498)       0:00:01.543 **********
changed: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0

Friday 31 March 2017  10:45:19 +0000 (0:00:46.442)       0:00:47.986 **********
===============================================================================
launch an instance ----------------------------------------------------- 46.44s
setup ------------------------------------------------------------------- 1.50s
Playbook run took 0 days, 0 hours, 0 minutes, 47 seconds
--

Regards,
Amarjeet


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

balubhai555

unread,
Mar 31, 2017, 1:51:18 PM3/31/17
to Ansible Project

 
Hello Amarjeet Raja,

I worked out on your above example with again and again by changing the openstack integration with ansible.
But i got the below error. 

"Problem with auth parameters"

my original code :

#create a new instance in HP Cloud AE1 region availability zone az2 and
# automatically assigns a floating IP
- name: launch a compute instance
  hosts: localhost
  sudo: yes
  tasks:
#  - name: echo PATH into bashrc
#    action: lineinfile dest=~/.bash_profile line='export user_domain_name=default' insertafter='EOF' regexp='export user_domain_name.*'  state=present

  - name: launch an instance
    os_server:
     state: present
     auth:
      auth_url: http://192.168.8.25:5000/v3/
      username: admin
      password: MiracleIT
     # password: admin
      project_name: admin
      register: catalog
     auth_type: password
     name: vm1
     region_name: RegionOne
     availability_zone: nova
     image: 913ef163-e2aa-4161-85d4-16a9924abfa1
     key_name: ubuntutestkeypair1
     timeout: 200
     flavor: m1.medium
     security_groups: default
     auto_ip: yes
  - debug: var=catalog



I attached the error.  will you please suggest me any guide to do ansible integration with Openstack,


Thank you.

 
Reply all
Reply to author
Forward
0 new messages