[student@workstation ansible]$ ansible-playbook -e "site=Default" --ask-vault-pass many-vms.yml
Vault password:
PLAY [Create Many VMs] **********************************************************************************************************************************************************************
TASK [Check if passwords.yml exists] ********************************************************************************************************************************************************
ok: [localhost]
TASK [Check if file vms.csv exists] *********************************************************************************************************************************************************
ok: [localhost]
TASK [Check if file vmtemplates.csv exists] *************************************************************************************************************************************************
ok: [localhost]
TASK [Check if file vmflavours.csv exists] **************************************************************************************************************************************************
ok: [localhost]
TASK [Check if file permissions.csv exists] *************************************************************************************************************************************************
ok: [localhost]
TASK [Terminate the play is any variable file is missing] ***********************************************************************************************************************************
skipping: [localhost]
TASK [Parse vms.csv file] *******************************************************************************************************************************************************************
ok: [localhost]
TASK [Test variables used to deploy multiple VMs] *******************************************************************************************************************************************
skipping: [localhost]
TASK [Deploy VMs for certain site] **********************************************************************************************************************************************************
failed: [localhost] (item={'key': 'ansible01', 'value': {'name': 'ansible01', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.50.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible01.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}}) => {"ansible_loop_var": "item", "changed": true, "cmd": "ansible-playbook -e \"vmchoice=ansible01\" --vault-password-file --vault-password-file /path/to/my/vault-password-file", "delta": "0:00:00.426266", "end": "2022-02-25 14:44:24.057347", "item": {"key": "ansible01", "value": {"class": "server", "cluster": "Default", "dns1": "172.30.50.5", "dns2": "172.30.50.8", "dns_domain": "
idm.nac-issa.org", "fqdn": "
ansible01.idm.nac-issa.org", "gw": "172.30.50.1", "ip": "172.30.50.50", "mask": "255.255.255.0", "name": "ansible01", "nic": "eth0", "os": "rhel_8x64", "site": "Default", "system": "ansible", "type": "small", "vmflavour": "small_vm"}}, "msg": "non-zero return code", "rc": 2, "start": "2022-02-25 14:44:23.631081", "stderr": "usage: ansible-playbook [-h] [--version] [-v] [-k]\n [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER]\n [-c CONNECTION] [-T TIMEOUT]\n [--ssh-common-args SSH_COMMON_ARGS]\n [--sftp-extra-args SFTP_EXTRA_ARGS]\n [--scp-extra-args SCP_EXTRA_ARGS]\n [--ssh-extra-args SSH_EXTRA_ARGS] [--force-handlers]\n [--flush-cache] [-b] [--become-method BECOME_METHOD]\n [--become-user BECOME_USER] [-K] [-t TAGS]\n [--skip-tags SKIP_TAGS] [-C] [--syntax-check] [-D]\n [-i INVENTORY] [--list-hosts] [-l SUBSET]\n [-e EXTRA_VARS] [--vault-id VAULT_IDS]\n [--ask-vault-pass | --vault-password-file VAULT_PASSWORD_FILES]\n [-f FORKS] [-M MODULE_PATH] [--list-tasks]\n [--list-tags] [--step] [--start-at-task START_AT_TASK]\n playbook [playbook ...]\nansible-playbook: error: argument --vault-password-file: expected one argument", "stderr_lines": ["usage: ansible-playbook [-h] [--version] [-v] [-k]", " [--private-key PRIVATE_KEY_FILE] [-u REMOTE_USER]", " [-c CONNECTION] [-T TIMEOUT]", " [--ssh-common-args SSH_COMMON_ARGS]", " [--sftp-extra-args SFTP_EXTRA_ARGS]", " [--scp-extra-args SCP_EXTRA_ARGS]", " [--ssh-extra-args SSH_EXTRA_ARGS] [--force-handlers]", " [--flush-cache] [-b] [--become-method BECOME_METHOD]", " [--become-user BECOME_USER] [-K] [-t TAGS]", " [--skip-tags SKIP_TAGS] [-C] [--syntax-check] [-D]", " [-i INVENTORY] [--list-hosts] [-l SUBSET]", " [-e EXTRA_VARS] [--vault-id VAULT_IDS]", " [--ask-vault-pass | --vault-password-file VAULT_PASSWORD_FILES]", " [-f FORKS] [-M MODULE_PATH] [--list-tasks]", " [--list-tags] [--step] [--start-at-task START_AT_TASK]", " playbook [playbook ...]", "ansible-playbook: error: argument --vault-password-file: expected one argument"], "stdout": "", "stdout_lines": []}
...
ansible02, 03, etc
...ignoring
TASK [Deploy VMs for certain system] ********************************************************************************************************************************************************
skipping: [localhost] => (item={'key': 'ansible01', 'value': {'name': 'ansible01', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.50.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible01.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible02', 'value': {'name': 'ansible02', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.55.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible02.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible03', 'value': {'name': 'ansible03', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.60.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible03.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible04', 'value': {'name': 'ansible04', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.65.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible04.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible05', 'value': {'name': 'ansible05', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.70.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible05.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible06', 'value': {'name': 'ansible06', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.75.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible06.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible07', 'value': {'name': 'ansible07', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.80.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible07.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible08', 'value': {'name': 'ansible08', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.85.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible08.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible09', 'value': {'name': 'ansible09', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.90.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible09.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
skipping: [localhost] => (item={'key': 'ansible10', 'value': {'name': 'ansible10', 'vmflavour': 'small_vm', 'type': 'small', 'site': 'Default', 'cluster': 'Default', 'class': 'server', 'os': 'rhel_8x64', 'nic': 'eth0', 'ip': '172.30.50.50', 'gw': '172.30.95.1', 'mask': '255.255.255.0', 'system': 'ansible', 'fqdn': '
ansible01.idm.nac-issa.org', 'dns1': '172.30.50.5', 'dns2': '172.30.50.8', 'dns_domain': '
idm.nac-issa.org'}})
PLAY RECAP **********************************************************************************************************************************************************************************
localhost : ok=7 changed=1 unreachable=0 failed=0 skipped=3 rescued=0 ignored=1