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

Use os_user variable in development_environment role #545

Merged
merged 6 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/roles/development_environment/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ prelaunch_test_instance_script: pre_launch.bash
edpm_privatekey_path: ~/install_yamls/out/edpm/ansibleee-ssh-key-id_rsa
run_pre_adoption_validation: true
os_cloud_name: standalone
os_user: root
9 changes: 6 additions & 3 deletions tests/roles/development_environment/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
EDPM_PRIVATEKEY_PATH: "{{ edpm_privatekey_path }}"
OS_CLOUD_IP: "{{ standalone_ip | default(edpm_node_ip) }}"
OS_CLOUD_NAME: "{{ os_cloud_name }}"
OS_USER: "{{ os_user }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a "OS_USERNAME" variable which means "the user account in OpenStack that is used for API calls". To avoid confusion with that one, i think we should probably call this something like "EDPM_SSH_USER"? But let's first run through the test whether this can fix the RHEL job before we rename? Or i'd be even ok landing this and then renaming in a follow-up PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually yes let's land this and rename in a follow-up. Sorry i didn't realize this on the first pass of the review :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EDPM_SSH_USER seems to be an user used to ssh compute nodes. Here, we are doing ssh to the node from where we can access the openstack cloud configs to generate a token.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough, but personally i'd still at least include "SSH" later, to not be too close to the openstack client vars: https://docs.openstack.org/newton/user-guide/common/cli-set-environment-variables-using-openstack-rc.html

Not something that needs to change right now anyway :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OS_USER_SSH sounds good though

Copy link
Contributor

Choose a reason for hiding this comment

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

I echo with what Jiri commented, anything with OS_ prefix should be reserved only to OpenStack related environment variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about OSP_SSH_USER ?

ansible.builtin.shell:
cmd: |
{{ shell_header }}
alias openstack="ssh -i {{ edpm_privatekey_path }} root@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
alias openstack="ssh -i {{ edpm_privatekey_path }} -o StrictHostKeyChecking=no ${OS_USER}@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
{{ lookup('ansible.builtin.file', prelaunch_test_instance_script) }}

- name: creates Barbican secret
Expand All @@ -20,10 +21,11 @@
EDPM_PRIVATEKEY_PATH: "{{ edpm_privatekey_path }}"
OS_CLOUD_IP: "{{ standalone_ip | default(edpm_node_ip) }}"
OS_CLOUD_NAME: "{{ os_cloud_name }}"
OS_USER: "{{ os_user }}"
ansible.builtin.shell:
cmd: |
{{ shell_header }}
alias openstack="ssh -i {{ edpm_privatekey_path }} root@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
alias openstack="ssh -i {{ edpm_privatekey_path }} -o StrictHostKeyChecking=no ${OS_USER}@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
${BASH_ALIASES[openstack]} secret store --name testSecret --payload 'TestPayload'

- name: saves a fernet token
Expand All @@ -33,10 +35,11 @@
EDPM_PRIVATEKEY_PATH: "{{ edpm_privatekey_path }}"
OS_CLOUD_IP: "{{ standalone_ip | default(edpm_node_ip) }}"
OS_CLOUD_NAME: "{{ os_cloud_name }}"
OS_USER: "{{ os_user }}"
ansible.builtin.shell:
cmd: |
{{ shell_header }}
alias openstack="ssh -i {{ edpm_privatekey_path }} root@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
alias openstack="ssh -i {{ edpm_privatekey_path }} -o StrictHostKeyChecking=no ${OS_USER}@${OS_CLOUD_IP} OS_CLOUD=${OS_CLOUD_NAME} openstack"
${BASH_ALIASES[openstack]} token issue -f value -c id
register: before_adoption_token

Expand Down
Loading