saltyorg / sb

0 stars 9 forks source link

add inventory command #11

Closed saltydk closed 10 months ago

saltydk commented 10 months ago

Add some type of command that just opens the inventory file with nano for easy access.

bonny1992 commented 10 months ago

Might be cool to add a config variable (maybe in adv_settings.yml?) to customize the editor according to the user's preferences.

owine commented 10 months ago

Should just use $EDITOR

saltydk commented 10 months ago

Sourced from where? It isn't set in my session by default at least.

owine commented 10 months ago

Sourced from where? It isn't set in my session by default at least.

The shell task sets it as nano

saltydk commented 10 months ago

We cannot use anything user based as it needs to work before preinstall.

saltydk commented 10 months ago

I can do something like

edit-inventory () {
    ${EDITOR:-nano} "/srv/git/saltbox/inventories/host_vars/localhost.yml"
}

However, this script runs as root so it is not aware of the user ENV.