ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.06k stars 3.42k forks source link

RFE: store config for awx cli #5940

Open luckylittle opened 4 years ago

luckylittle commented 4 years ago
ISSUE TYPE
SUMMARY

The previous version of tower-cli stored credentials and other configuration in ~/.tower-cli.cfg by default. From my understanding, the replacement tool awx does not have anything like it (e.g. you need to export TOKEN and ingest this TOKEN to all of the subsequent commands).

ENVIRONMENT
rpm -qi ansible-tower-cli
Name        : ansible-tower-cli
Version     : 3.6.2
Release     : 1.el8at
Architecture: x86_64
Install Date: Fri 14 Feb 2020 10:40:10 AM AEST
Group       : Development/Libraries
Size        : 611620
License     : Commercial, see https://www.redhat.com/en/about/red-hat-end-user-license-agreements and https://www.redhat.com/en/about/licenses
Signature   : RSA/SHA256, Sat 14 Dec 2019 05:06:36 AM AEST, Key ID 199e2f91fd431d51
Source RPM  : ansible-tower-3.6.2-1.el8at.src.rpm
Build Date  : Sat 14 Dec 2019 03:46:22 AM AEST
Build Host  : x86-vm-01.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://ansible.github.com
Summary     : Package for the Ansible Tower CLI
Description :
Package for the Ansible Tower CLI
STEPS TO REPRODUCE
  1. awx login -k --conf.host https://<IP_ADDRESS> --conf.username <ADMIN> --conf.password <PASSWORD> -v
  2. awx config
EXPECTED RESULTS

Previous command 1. stores the credentials and verify_ssl false to the local config file somewhere. Command 2. will then display this previously stored information.

ACTUAL RESULTS

"Empty" config is returned:

{
     "base_url": "https://127.0.0.1:443",
     "token": "",
     "use_sessions": false,
     "credentials": {
          "default": {
               "username": "admin",
               "password": "password"
          }
     }
}
ADDITIONAL INFORMATION

Customer is asking why this functionality was removed.

MichaelEllnebrand commented 1 year ago

Found this issue when I was looking for the same functionality. The solution is found in config.py. If you set AWXKIT_CREDENTIAL_FILE to point to a file containing your username and password it is read when you execute the awx cli utility.

export AWXKIT_CREDENTIAL_FILE=/home/awx/credentials.yaml

Once that is set you can use awx like this: awx --conf.host https://fqdn login

Example credentials.yaml file:

default:
  username: admin
  password: p@ssw0rd
sumkincpp commented 6 months ago

Interesting to see not a lot of requests/activity in this RFE. I still want to draw attention that it would actually be really helpfull to have.

With sunsetting of tower-cli/awx-cli this simple and powerful option of having a configuration file was lost. Previously configuration was stored in ~/.tower-cli.cfg/~/.awx-cli.cfg