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

[Rfc] standalone formula with provided script #105

Closed
wants to merge 2 commits into from

Conversation

MalloZup
Copy link
Contributor

@MalloZup MalloZup commented Sep 28, 2020

Workflow from user:

  1. User install rpm of formula zypper in formula-name

  2. User edit unique pillar file in /usr/share/salt-formulas/config/hana/pillar/hana/hana.sls

This file need to be edited with HELP of suse.documentation which explains formula API etc.
--> having a 1 pillar.example file is normal in saltstack formulas.. see upstream : https://github.com/saltstack-formulas/openldap-formula/blob/master/pillar.example

  1. User use run-saphanaboostrap-formula (run-$FORMULA_NAME)

Features of formula CLI:

  • colors (red error, green INFO)

  • logger and execution phases:

    • [PREFLIGHTS] checks, ( this can be useful in future , to check if the formula could run in the given host). It should however stay minimalist because doing to much "defensive" programming is a bad desing (anyways is out of scope)
    • [SETUP] copy grains etc ,
    • FORMULA run formula..
  • set log level -l for salt. Default error

  • concurrent and conflict safe. An user can install X formulas, they don't interfer each other. This is because
    /usr/share/salt-formulas/config/FORMULA_NAME will contain all self-isolated salt pillars/grains and other config.
    There is no shared conf

  • minimalism (auto-detection, no input allowed) -> this allow scriptable later on.

    • an admin, could setup 2 pillar files hana.sls copy them to host1 and host2
      then run ssh root@hana1 run-sapformula ; ssh root@hana2 run-sapformula

Technical details

For technical details check the RFC: https://confluence.suse.com/pages/viewpage.action?pageId=581566497

The 2 main mechanism are:

    1. RPM take care to copy the needed static config filesminion and dir necessary for grant to have 0 conflicts
    1. After pkg install, the cli check we have the folder we needs and execute salt-call with all needed parameters etc

-This is what the CLI for each formula support:

run-saphanabootstrap-formula -h
Install hana-formula, executing salt-call.

Supported Options:
  -l [LOG_LEVEL]   Set log level of saltstack. Default: error. 
  -h               Show this help.

Possible improvements:

  • The description of the CLI might need to be improved on the help message.
  • The RPM packaging could maybe improved, I didn't check the detail there.

Copy link
Collaborator

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

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

@MalloZup The idea of having an easy deployment script is good.
In any case, I think that this is a sensitive topic. SUSE has multiple salt formulas (most of them managed by the SUMA team). The first discussion should be with them. To see if they have a similar need and in that case how they are solving/how the would do it.

About the current implementation.

  • I would prefer to have the script working without fixed files. Create all the files during the runtime, and destroy afterwards. This should be easy to do with bash
  • I would use other approach to get the pillar file. Some flag, so you don't need to have the pillar file in an specific location. -p my_pillar or similar.
  • The same for the output log file.
  • What is the hana-top.sls used for? Your comments in the PR description are not clear for me. salt doesn't need 3 top.sls files. It needs 2, one for the pillar and the other for the salt execution

config/minion Outdated Show resolved Hide resolved
config/pillar/top.sls Show resolved Hide resolved
@MalloZup MalloZup changed the title WIP: [Rfc] standalone formula with provided script [Rfc] standalone formula with provided script Sep 30, 2020
@SUSE SUSE deleted a comment from arbulu89 Sep 30, 2020
@MalloZup
Copy link
Contributor Author

NOTE: I will present this on next sprint-review meeting so no hurry to merge.

Any feedback is welcome. I already tried it out the PKG and worked ok.

@MalloZup
Copy link
Contributor Author

image

this is how it looks like. Note I broke intentionally the install


# Script to install salt formulas

# these variables are formula specific:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this var change by formula..

This script will let the user automatically install formula after
editing the pillar.
It is usefull to abstract salt logic and provide a simple installer
script, minimalistic to the user which are not familiar with salt.
@stefanotorresi
Copy link
Contributor

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants