saltstack-formulas / salter

Salter orchestrates software profiles onto Linux/MacOS/FreeBSD/Windows without fuss.
Apache License 2.0
6 stars 5 forks source link

feat(profile): salter edit/show profile feature #49

Closed noelmcloughlin closed 5 years ago

noelmcloughlin commented 5 years ago

Use Case: I want to create new profile

vagrant@ubuntu1804:~$ sudo salter edit mystuff

# This is a profile template which you must customize
# The format is a YAML list; indention is important
# See https://github.com/saltstack-formulas for valid entries

Now edit the template

base:
  '*':
    - item1    #<-- changeme
    - item2    #<-- changeme
    - .etc.    #<-- changeme

Now show the new profile

vagrant@ubuntu1804:~$ sudo salter show mystuff

base:
  '*':
    - git
    - golang
    - kubernetes

Now run the new profile

vagrant@ubuntu1804:~$ sudo salter add mystuff
noelmcloughlin commented 5 years ago
vagrant@ubuntu1804:~$ sudo salter show mystuff
profile mystuff not found
vagrant@ubuntu1804:~$ sudo salter edit mystuff

Now run: sudo salter add mystuff

vagrant@ubuntu1804:~$ sudo salter show mystuff
# This is a profile template which you must customize
# The format is a YAML list; indention is important
# See https://github.com/saltstack-formulas for valid entries

base:
  '*':
    - git
    - golang
    - kubernetes
noelmcloughlin commented 5 years ago

Result:

vagrant@ubuntu1804:~$ sudo salter add mystuff
==> This script will add: salter
press return to continue or control-c to abort
cloning git-formula from saltstack-formulas ...

cloning golang-formula from saltstack-formulas ...
... using fork: noelmcloughlin, branch: fixes
Branch 'fixes' set up to track remote branch 'fixes' from 'origin'.
Switched to a new branch 'fixes'

cloning kubernetes-formula from saltstack-formulas ...

run salt: this takes a while, please be patient ...
-------------
Succeeded: 29 (changed=19)
Failed:     0
-------------
See full log in [ /tmp/saltstack-formulas-salter/log.201908280835 ]

/////////////////////////////////////////////////////////////////
        mystuff for salter has completed
////////////////////////////////////////////////////////////////
noelmcloughlin commented 5 years ago
vagrant@ubuntu1804:~$ which go
/usr/bin/go
vagrant@ubuntu1804:~$ which kubectl
/usr/bin/kubectl
vagrant@ubuntu1804:~$ which git
/usr/bin/git
noelmcloughlin commented 5 years ago

Ideally a remove profile is auto-generated when an add profile is created. That would require better standardization in saltstack-formulas to ensure every init has associated clean - if we could guarantee that then this WILL work well.

noelmcloughlin commented 5 years ago

Looks good