hpe-container-platform-community / hpecp-python-library

Python library for working with HPE Container Platform (Prototype)
https://hpe-container-platform-community.github.io/hpecp-python-library/index.html
MIT License
15 stars 4 forks source link

Python client allows authentication via ENV's the CLI does not #268

Open frippe75 opened 2 years ago

frippe75 commented 2 years ago

Would be nice if the CLI would check for ENV just like the Python client seems to provide. Easy fix? Tried setting up the dev-env to have a go but could not pull the docker image (I guess not on Docker hub).

$ env | grep HPECP
HPECP_PASSWORD=******
HPECP_API_PORT=8080
HPECP_VERIFY_SSL=False
HPECP_USE_SSL=False
HPECP_WARN_SSL=False
HPECP_USERNAME=admin
HPECP_API_HOST=ezmeral-cluster.*****.***

$ unset HPECP_CONFIG_FILE

$ hpecp k8sworker list
Could not find configuration file '/home/ansible/.hpecp.conf'

Would like to run this via Ansible and was thinking I'd skip creating modules that uses the Python client and rather go for a more blunt usage via shell/command module.

frippe75 commented 2 years ago

This would simplify calling from Ansible using Vault for secrets like:

- name: Create K8S Worker
  shell: |
    hpecp k8sworker create-with-ssh-key --ip {{ ansible_host }} --ssh-key {{ ezmeral_admin_privkey }}
  environment: "{{ hpecp }}"
  delegate_to: localhost