Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

role/deploy_flask_app - change required parameter key pair with path to ssh key file #109

Merged
merged 51 commits into from
Feb 9, 2024

Conversation

abikouo
Copy link
Contributor

@abikouo abikouo commented Dec 19, 2023

Fixes #103

  • The integration test test_deploy_flask_app (along with the following playbooks webapp/migrate_webapp, webapp/webapp, webapp/webapp_ha_aurora) are failing because the role deploy_flask_app was expecting a key pair name to ssh-connect to the bastion while it should expected the private key file.
    This fix replaces the corresponding parameter deploy_flask_app_sshkey_pair_name defining the key pair name by the new one deploy_flask_app_bastion_ssh_private_key defining the path to the private key file

  • The integration test is also facing some time out, to reduce the execution time the bastion host will be created with user_data provided in order to boot the virtual machine directly with the required packages. This change has been done in the following file playbooks/webapp/tasks/create.yaml impacting the playbooks webapp, webapp_ha_aurora

  • The deletion operation of the playbook playbook/webapp/webapp was missing some resources to be deleted in order to be successful, this has been corrected

  • The playbook to deploy has been simplified to faster the execution. We do not need anymore to create a local registry server from the bastion host to pull images on worker. The webapp image is directly pulled from public docker registry docker.io

@abikouo abikouo force-pushed the fix_int_target_test_deploy_flask_app branch from 3bee293 to 0e09fe5 Compare December 20, 2023 15:53
Jaxs88

This comment was marked as abuse.

@abikouo abikouo force-pushed the fix_int_target_test_deploy_flask_app branch from 0b901fb to 4ad3c54 Compare January 9, 2024 10:30
@GomathiselviS
Copy link
Contributor

For ansible-playbook webapp_ha_aurora.yaml -e "@credentials.yaml" -e "operation=delete command, we might face the following error.
"argument_errors": [ "missing required arguments: create_rds_global_cluster_instance_class, create_rds_global_cluster_master_user_password, create_rds_global_cluster_master_username" ],
These variables are unnecessary for the delete operation of cloud.aws_ops.create_rds_global_cluster. Therefore, I suggest marking them as optional in the argument spec and README of cloud.aws_ops.create_rds_global_cluster role.

@abikouo
Copy link
Contributor Author

abikouo commented Feb 6, 2024

For ansible-playbook webapp_ha_aurora.yaml -e "@credentials.yaml" -e "operation=delete command, we might face the following error. "argument_errors": [ "missing required arguments: create_rds_global_cluster_instance_class, create_rds_global_cluster_master_user_password, create_rds_global_cluster_master_username" ], These variables are unnecessary for the delete operation of cloud.aws_ops.create_rds_global_cluster. Therefore, I suggest marking them as optional in the argument spec and README of cloud.aws_ops.create_rds_global_cluster role.

@GomathiselviS the playbook webapp_ha_aurora is not fixed, I have added some updates to fasten the execution.
Could you please give another try and review/approve the PR?

- name: Webapp HA
hosts: aurora
gather_facts: false
strategy: free
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this prevents tasks from prematurely aborting on encountering a failure on one of the hosts. However, this may not be convenient when debugging the failure.

@GomathiselviS
Copy link
Contributor

I am unable to run webapp_ha_aurora.yaml. It fails with

TASK [cloud.aws_ops.deploy_flask_app : Save key pair content into file on bastion host] ****************
task path: /home/gosriniv/github/collections/ansible_collections/cloud/aws_ops/roles/deploy_flask_app/tasks/setup_infra.yaml:34
<34.220.44.228> ESTABLISH SSH CONNECTION FOR USER: fedora
<34.220.44.228> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="fedora"' -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i '~/.ansible-testus-west-2_id_rsa' -o 'ControlPath="/home/gosriniv/.ansible/cp/36cc6ef6c1"' 34.220.44.228 '/bin/sh -c '"'"'echo ~fedora && sleep 0'"'"''
<34.220.44.228> (255, b'', b"Warning: Identity file /home/gosriniv/.ansible-testus-west-2_id_rsa not accessible: No such file or directory.\nWarning: Permanently added '34.220.44.228' (ED25519) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-with-mic).\r\n")
fatal: [localhost -> ec2-34-220-44-228-bastion]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Identity file /home/gosriniv/.ansible-testus-west-2_id_rsa not accessible: No such file or directory.\nWarning: Permanently added '34.220.44.228' (ED25519) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-with-mic).",
    "unreachable": true
}

@abikouo
Copy link
Contributor Author

abikouo commented Feb 7, 2024

I am unable to run webapp_ha_aurora.yaml. It fails with

TASK [cloud.aws_ops.deploy_flask_app : Save key pair content into file on bastion host] ****************
task path: /home/gosriniv/github/collections/ansible_collections/cloud/aws_ops/roles/deploy_flask_app/tasks/setup_infra.yaml:34
<34.220.44.228> ESTABLISH SSH CONNECTION FOR USER: fedora
<34.220.44.228> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="fedora"' -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i '~/.ansible-testus-west-2_id_rsa' -o 'ControlPath="/home/gosriniv/.ansible/cp/36cc6ef6c1"' 34.220.44.228 '/bin/sh -c '"'"'echo ~fedora && sleep 0'"'"''
<34.220.44.228> (255, b'', b"Warning: Identity file /home/gosriniv/.ansible-testus-west-2_id_rsa not accessible: No such file or directory.\nWarning: Permanently added '34.220.44.228' (ED25519) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-with-mic).\r\n")
fatal: [localhost -> ec2-34-220-44-228-bastion]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Warning: Identity file /home/gosriniv/.ansible-testus-west-2_id_rsa not accessible: No such file or directory.\nWarning: Permanently added '34.220.44.228' (ED25519) to the list of known hosts.\r\[email protected]: Permission denied (publickey,gssapi-with-mic).",
    "unreachable": true
}

@GomathiselviS It is failing because you did not execute from scratch, try to clean everything and run again.
The playbook is working well, the following suggests that the key pair you are trying to use to connect to the bastion host already existed, this means that it may have been created by another process and you did not save the private key on your local file system.

Copy link
Contributor

@GomathiselviS GomathiselviS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything functions properly except for the addition of two variables in the vars file.

@abikouo abikouo merged commit 7a63084 into redhat-cop:main Feb 9, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable broken test_deploy_flask_app integration tests
4 participants