Hi Bvitnik.
I performed the command that you passed me. Now it is all correct. I maked the test with the other template that there is a same error. Now, the ansible created a vm correctly .
ansible@ansible:~/ansible/playbooks_apresentacao/producao$ ansible-playbook --ask-vault-pass teste-criacao-vm-prod.yml -vvv
ansible-playbook [core 2.15.8]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
Using /etc/ansible/ansible.cfg as config file
Vault password:
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: While constructing a mapping from /home/ansible/ansible/playbooks_apresentacao/producao/teste-criacao-vm-prod.yml, line 8, column
9, found a duplicate dict key (home_server). Using last defined value only.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: teste-criacao-vm-prod.yml ************************************************************************************************************
1 plays in teste-criacao-vm-prod.yml
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
PLAY [Tentativa de criação VM] *****************************************************************************************************************
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
TASK [Gathering Facts] *************************************************************************************************************************
task path: /home/ansible/ansible/playbooks_apresentacao/producao/teste-criacao-vm-prod.yml:2
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<127.0.0.1> EXEC /bin/sh -c 'echo ~ansible && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982 `" && echo ansible-tmp-1718380185.9401252-839001-241008283097982="` echo /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982 `" ) && sleep 0'
Using module file /usr/lib/python3/dist-packages/ansible/modules/setup.py
<127.0.0.1> PUT /home/ansible/.ansible/tmp/ansible-local-8389974fywt08r/tmpbxo8ibqt TO /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982/AnsiballZ_setup.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982/ /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982/AnsiballZ_setup.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1718380185.9401252-839001-241008283097982/ > /dev/null 2>&1 && sleep 0'
ok: [localhost]
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
TASK [Criando VM] ******************************************************************************************************************************
task path: /home/ansible/ansible/playbooks_apresentacao/producao/teste-criacao-vm-prod.yml:6
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: ansible
<localhost> EXEC /bin/sh -c 'echo ~ansible && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir "` echo /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722 `" && echo ansible-tmp-1718380187.0203605-839083-111205290269722="` echo /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722 `" ) && sleep 0'
Using module file /home/ansible/.ansible/collections/ansible_collections/community/general/plugins/modules/xenserver_guest.py
<localhost> PUT /home/ansible/.ansible/tmp/ansible-local-8389974fywt08r/tmpyotu3qaa TO /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722/AnsiballZ_xenserver_guest.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722/ /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722/AnsiballZ_xenserver_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722/AnsiballZ_xenserver_guest.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1718380187.0203605-839083-111205290269722/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
"changed": true,
"instance": {
"cdrom": {
"type": "none"
},
"customization_agent": "custom",
"disks": [
{
"name": "Ubuntu22.04_Disk30GB_Ram8GB 0",
"name_desc": "Created by template provisioner",
"os_device": "xvda",
"size": 32212254720,
"sr": "STORAGE2",
"sr_uuid": "50075613-8d27-cc00-47f5-857275566265",
"vbd_userdevice": "0"
}
],
"domid": "-1",
"folder": "/ansible",
"hardware": {
"memory_mb": 2096,
"num_cpu_cores_per_socket": 1,
"num_cpus": 1
},
"home_server": "xcp-ng-server1,
"is_template": false,
"name": "Deletar_vm_criada_ansible",
"name_desc": "",
"networks": [
{
"gateway": "",
"gateway6": "",
"ip": "",
"ip6": [],
"mac": "da:97:83:46:22:87",
"mtu": "1500",
"name": "Server2-MGMT",
"netmask": "",
"prefix": "",
"prefix6": "",
"vif_device": "3"
}
],
"other_config": {
"base_template_name": "Ubuntu Jammy Jellyfish 22.04",
"folder": "/ansible",
"import_task": "OpaqueRef:4a36ea24-37e9-47a7-a3bd-d227495739c4",
"install-methods": "cdrom,nfs,http,ftp",
"instant": "true",
"linux_template": "true",
"mac_seed": "1b771e63-1346-a651-8145-8653560d3b83"
},
"platform": {
"acpi": "1",
"apic": "true",
"device-model": "qemu-upstream-compat",
"device_id": "0001",
"hpet": "true",
"nx": "true",
"pae": "true",
"secureboot": "false",
"timeoffset": "0",
"vga": "std",
"videoram": "8",
"viridian": "false"
},
"state": "poweredon",
"uuid": "e17e6e65-eb04-b040-d4b4-6af403222e3f",
"xenstore_data": {
"vm-data": "",
"vm-data/mmio-hole-size": "268435456"
}
},
"invocation": {
"module_args": {
"cdrom": null,
"custom_params": null,
"disks": [
{
"name": null,
"name_desc": null,
"size": null,
"size_b": null,
"size_gb": "30",
"size_kb": null,
"size_mb": null,
"size_tb": null,
"sr": null,
"sr_uuid": "50075613-8d27-cc00-47f5-857275566265"
}
],
"folder": "/ansible",
"force": false,
"hardware": {
"memory_mb": 2096,
"num_cpu_cores_per_socket": 1,
"num_cpus": 1
},
"home_server": "xcp-ng-server1",
"hostname": "z.z.z.z",
"is_template": false,
"linked_clone": false,
"name": "Deletar_vm_criada_ansible",
"name_desc": null,
"networks": [
{
"gateway": null,
"gateway6": null,
"ip": null,
"ip6": null,
"mac": null,
"name": "R740-MGMT",
"netmask": null,
"type": null,
"type6": null
}
],
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"state": "poweredon",
"state_change_timeout": 0,
"template": null,
"template_uuid": "fc0280a3-706a-c97c-2821-03cbc53f0f13",
"username": "user",
"uuid": null,
"validate_certs": true,
"wait_for_ip_address": false
}
}
}
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
TASK [deploy] **********************************************************************************************************************************
task path: /home/ansible/ansible/playbooks_apresentacao/producao/teste-criacao-vm-prod.yml:28
ok: [localhost] => {
"msg": {
"changed": true,
"failed": false,
"instance": {
"cdrom": {
"type": "none"
},
"customization_agent": "custom",
"disks": [
{
"name": "Ubuntu22.04_Disk30GB_Ram8GB 0",
"name_desc": "Created by template provisioner",
"os_device": "xvda",
"size": 32212254720,
"sr": "VMDATA-02-NEW",
"sr_uuid": "50075613-8d27-cc00-47f5-857275566265",
"vbd_userdevice": "0"
}
],
"domid": "-1",
"folder": "/ansible",
"hardware": {
"memory_mb": 2096,
"num_cpu_cores_per_socket": 1,
"num_cpus": 1
},
"home_server": "xcp-ng-server2",
"is_template": false,
"name": "Deletar_vm_criada_ansible",
"name_desc": "",
"networks": [
{
"gateway": "",
"gateway6": "",
"ip": "",
"ip6": [],
"mac": "da:97:83:46:22:87",
"mtu": "1500",
"name": "Server2-MGMT",
"netmask": "",
"prefix": "",
"prefix6": "",
"vif_device": "3"
}
],
"other_config": {
"base_template_name": "Ubuntu Jammy Jellyfish 22.04",
"folder": "/root",
"import_task": "OpaqueRef:4a36ea24-37e9-47a7-a3bd-d227495739c4",
"install-methods": "cdrom,nfs,http,ftp",
"instant": "true",
"linux_template": "true",
"mac_seed": "1b771e63-1346-a651-8145-8653560d3b83"
},
"platform": {
"acpi": "1",
"apic": "true",
"device-model": "qemu-upstream-compat",
"device_id": "0001",
"hpet": "true",
"nx": "true",
"pae": "true",
"secureboot": "false",
"timeoffset": "0",
"vga": "std",
"videoram": "8",
"viridian": "false"
},
"state": "poweredon",
"uuid": "e17e6e65-eb04-b040-d4b4-6af403222e3f",
"xenstore_data": {
"vm-data": "",
"vm-data/mmio-hole-size": "268435456"
}
}
}
}
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
Read vars_file '/home/ansible/ansible/vars/xen_localhost_vars.yml'
PLAY RECAP *************************************************************************************************************************************
localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Thanks for help me.