snowdrop/k8s-infra

Creation of the VM on opnstack fails: Command '['pass', 'insert', '-f', '-m', 'openstack/test1/groups//masters']' returned non-zero exit status 1.

cmoulliard opened this issue · 7 comments

Issue

Th following as documented here is failing

ansible-playbook playbook/openstack/openstack_vm_create_passwordstore.yml -e k8s_type=masters -e k8s_version=123 -e '{"openstack": {"vm": {"network": "provider_net_shared","image": "Fedora-Cloud-Base-35", "flavor": "m1.medium"}}}' -e key_name=test-adm-key -e vm_name=${VM_NAME}
[WARNING]: log file at /opt/log/ansible.log is not writeable and we cannot create it, aborting

[DEPRECATION WARNING]: DEFAULT_GATHER_TIMEOUT option, the module_defaults keyword is a more generic version and can apply to all calls to the M(ansible.builtin.gather_facts) or M(ansible.builtin.setup) actions, use 
module_defaults instead. This feature will be removed from ansible-core in version 2.18. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]:  * Failed to parse /Users/cmoullia/code/snowdrop/k8s-infra/ansible/inventory/id_openstack.rsa with ini plugin: /Users/cmoullia/code/snowdrop/k8s-infra/ansible/inventory/id_openstack.rsa:1: Expected key=value host
variable assignment, got: OPENSSH
[WARNING]: Unable to parse /Users/cmoullia/code/snowdrop/k8s-infra/ansible/inventory/id_openstack.rsa as an inventory source

PLAY [Check the passwordstore installation] ************************************************************************************************************************************************************************************

TASK [Check passwordstore installation] ****************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.021)       0:00:00.021 ******** 

TASK [passstore/check : Validate pass is installed] ****************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.038)       0:00:00.060 ******** 
changed: [localhost]

TASK [passstore/check : Validate PASSWORD_STORE_DIR environment variable is set if password_store_dir is not set] **************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.590)       0:00:00.651 ******** 
ok: [localhost]

TASK [passstore/check : Print password_store_dir] ******************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.094)       0:00:00.745 ******** 
ok: [localhost] => {
    "msg": "my_passwordstore_folder: /Users/cmoullia/.password-store-snowdrop"
}

TASK [passstore/check : Validate password_store_dir environment variable is set] ***********************************************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.072)       0:00:00.817 ******** 
skipping: [localhost]

TASK [passstore/check : Check Hetzner structure] *******************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:58 +0200 (0:00:00.060)       0:00:00.877 ******** 
ok: [localhost]

TASK [passstore/check : Check Openstack minimal configuration] *****************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:59 +0200 (0:00:00.325)       0:00:01.203 ******** 
ok: [localhost]

PLAY [Generate inventory files on the controller] ******************************************************************************************************************************************************************************

TASK [Validate required variables] *********************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:40:59 +0200 (0:00:00.660)       0:00:01.863 ******** 
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [Pull pass git database] **************************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:00 +0200 (0:00:00.050)       0:00:01.913 ******** 
changed: [localhost]

TASK [Check k8s_type value] ****************************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:05.129)       0:00:07.043 ******** 
skipping: [localhost]

TASK [Check k8s_version value] *************************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.043)       0:00:07.086 ******** 
skipping: [localhost]

TASK [Create inventory] ********************************************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.049)       0:00:07.136 ******** 

TASK [passstore/ansible_inventory : Get passwordstore work folder from password_store_dir override variable] *******************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.051)       0:00:07.187 ******** 
skipping: [localhost]

TASK [passstore/ansible_inventory : Get passwordstore work folder from PASSWORD_STORE_DIR env variable] ************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.050)       0:00:07.238 ******** 
ok: [localhost]

TASK [passstore/ansible_inventory : Set the pass URL] **************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.064)       0:00:07.303 ******** 
included: /Users/cmoullia/code/snowdrop/k8s-infra/ansible/roles/passstore/ansible_inventory/tasks/set_pass_facts.yml for localhost

TASK [passstore/ansible_inventory : Set the pass URL] **************************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.031)       0:00:07.334 ******** 
ok: [localhost]

TASK [passstore/ansible_inventory : Generate pass structure] *******************************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.056)       0:00:07.391 ******** 
included: /Users/cmoullia/code/snowdrop/k8s-infra/ansible/roles/passstore/ansible_inventory/tasks/generate_pass_structure.yml for localhost

TASK [passstore/ansible_inventory : Check if a folder already exists in pass for this host] ************************************************************************************************************************************
Wednesday 14 June 2023  16:41:05 +0200 (0:00:00.067)       0:00:07.459 ******** 
ok: [localhost]

TASK [passstore/ansible_inventory : If the folder already exists, fail!] *******************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:06 +0200 (0:00:00.444)       0:00:07.903 ******** 
skipping: [localhost]

TASK [passstore/ansible_inventory : Build the password creation statement] *****************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:06 +0200 (0:00:00.025)       0:00:07.929 ******** 
ok: [localhost]

TASK [passstore/ansible_inventory : Set pass facts (user, pw, ssh_port)] *******************************************************************************************************************************************************
Wednesday 14 June 2023  16:41:06 +0200 (0:00:00.041)       0:00:07.971 ******** 
fatal: [localhost]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'passwordstore'. Error was a <class 'ansible.errors.AnsibleError'>, original message: Command '['pass', 'insert', '-f', '-m', 'openstack/test1/os_user']' returned non-zero exit status 1.. Command '['pass', 'insert', '-f', '-m', 'openstack/test1/os_user']' returned non-zero exit status 1."}
...ignoring

Did the process stop right there? because it says it's ignoring...

Did the process stop right there? because it says it's ignoring...

No it continued till the end but no VM has ben created

I got a GPG issue when I try to execute manually the command

pass insert test
Enter password for test:
Retype password for test:
gpg: 6DFDB8EBC77867DBE5FD9B5AB8F45B0E87BCF823: skipped: No public key
gpg: [stdin]: encryption failed: No public key
Password encryption aborted.

As I suspected, the problem is with the passwordstore database. You're missing the import on of the public keys.

As I suspected, the problem is with the passwordstore database. You're missing the import on of the public keys.

A control should be added as a pre-task to avoid to get such error message later

I got another error now

TASK [openstack/vm : Create VM instance] *******************************************************************************************************************************************************************************
Thursday 15 June 2023  11:22:52 +0200 (0:00:00.041)       0:00:35.052 ********* 
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'openstack_keypairs'. 'dict object' has no attribute 'openstack_keypairs'

The error appears to be in '/Users/cmoullia/code/snowdrop/k8s-infra/ansible/roles/openstack/vm/tasks/vm_create.yml': line 95, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:
  - name: "Create VM instance"

@jacobdotcosta

That's where I stand ATM, fixing those errors due to the openstacksdk version.