Ansible modules extremely slow
Hello,
I'm using the Ansible module from the Collection to create a VM. It works, but compared to the openstack CLI it's very very slow. Ansible takes 4.5 mins versus few seconds with the CLI.
Check below with the CLI: 10 seconds, and I immediately see the VM, with the IP, in the control plane.
$ date && \
> openstack server create \
> --image "CentOS-7" \
> --flavor m5.large \
> --security-group default \
> --key-name fusion \
> --availability-zone STANDARD \
> --network INTERNAL_NET \
> fabcli \
> && date
Wed 03 Jun 2020 08:40:00 AM EDT
+-----------------------------+-------------------------------------------------+
| Field | Value |
+-----------------------------+-------------------------------------------------+
| adminPass | xxxxyyyzzz |
| config_drive | |
| created | 2020-06-03T12:40:09Z |
| flavor | m5.large (xxxxyyyzz) |
| hostId | |
| id | xxxxyyyzzz-ef2b-xxxxyyyzzzxxxxyyyzzz |
| image | CentOS-7 (xxxxyyyzzz |
| key_name | xxxxyyyzzz |
| name | fabcli |
| progress | 0 |
| project_id | xxxxyyyzzz |
| properties | |
| security_groups | name='63a5-xxxxyyyzzz-8167-xxxxyyyzzz' |
| status | BUILD |
| updated | 2020-06-03T12:40:09Z |
| user_id | xxxxyyyzzz |
| volumes_attached | |
+-----------------------------+-------------------------------------------------+
Wed 03 Jun 2020 08:40:10 AM EDT
Here's with Ansible: 4.5 minutes!
$ ansible-playbook play.yml
PLAY [PROVISION HOSTS AND BUILD ANSIBLE HOSTS INVENTORY] ***********************************************
TASK [openstack.cloud.server] **************************************************************************
2020-06-03 08:48:55 (0:00:00.017) 0:00:00.018 ***************************
ok: [localhost]
TASK [debug] *******************************************************************************************
2020-06-03 08:53:23 (0:04:28.521) 0:04:28.540 ***************************
Below is the playbook:
---
- name: PROVISION HOSTS AND BUILD ANSIBLE HOSTS INVENTORY
hosts: localhost
connection: local
gather_facts: no
become: no
tasks:
- openstack.cloud.server:
name: fab-vm1
state: present
region_name: Fabnet
availability_zone: STANDARD
network: INTERNAL_NET
image: "CentOS-7"
key_name: fusion
security_groups: default
flavor: m5.xlarge
auto_ip: no
register: out
- debug: var=out
I must be doing something very very wrong, but can't see it. any suggestion, please?
I would check the documentation. How does the Ansible module determine that the instance is "present"? Perhaps it waits until the instance is ACTIVE? Or until it can ssh into it?
after I start the play, I refresh the openstack control plane to see if my instance comes up. but it doesn't. It just takes ages to create the instance, let alone waiting for it to be ready