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

saltify driver issues with grain and updating minion #54519

Open
amalaguti opened this issue Sep 18, 2019 · 2 comments
Open

saltify driver issues with grain and updating minion #54519

amalaguti opened this issue Sep 18, 2019 · 2 comments
Labels
Feature new functionality including changes to functionality and code refactors, etc. Grains Salt-Cloud Windows
Projects
Milestone

Comments

@amalaguti
Copy link

amalaguti commented Sep 18, 2019

Description of Issue

After deploying a Linux (CentOS) and a Windows minion using Saltify driver, I've observed the presence of a grain salt-cloud in Linux minion (set automatically by Saltify driver) that is not present in Windows minion.

Also I found odd behavior trying to use Saltify to update minions (which would be desirable feature), comparing when it's used to update minions that were installed manually vs minions that were installed using saltify

# salt centlin02 grains.item salt-cloud
centlin02:
    ----------
    salt-cloud:
        ----------
        driver:
            saltify
        profile:
            saltify-centos
        provider:
            my-saltify-config:saltify

# salt windows01 grains.item salt-cloud
windows01:
    ----------
    salt-cloud:

The presence of this grain is used by the driver to prevent the deployment of Salt Minion on an already saltified system.

I have modified the code a bit to ignore this grain to allow re-deployment. I could have deleted the grain on the minion if needed too.

**vi /usr/lib/python2.7/site-packages/salt/cloud/__init__.py**
1426         for name in names:
1427             if name in vms:
1428                 prov = vms[name]['provider']
1429                 driv = vms[name]['driver']
1430
1431                 # MOD TO ALLOW RE-DEPLOY OF SALTIFY
1432                 # added if line
1433                 if driv != 'saltify':
1434                     msg = u'{0} already exists under {1}:{2}'.format(
1435                         name, prov, driv
1436                     )
1437                     log.error(msg)
1438                     ret[name] = {'Error': msg}
1439                     continue

I would suggest the following changes:

  1. This grain should be set in all platforms
  2. An option to allow re-deployment should be available
    3. Extend the driver to permit not only fresh install, but also update of Salt Minion version (in all platforms).

In my tests, I was able to upgrade minion from 2018.3.4 to 2019.2.0:
ONLY IF existing minion was installed using Saltify.
IF minion was installed manually, Saltify was not able to update the Minion.

It would be really nice and convenient to use Saltify to install on fresh minions and update existing minions.

### Setup
# cat /etc/salt/cloud.profiles.d/saltify.conf
saltify-centos:
  ssh_host: 172.31.39.173
  sudo: True
  ssh_username: centos
  minion:
    master: 172.31.23.52
  key_filename: /etc/salt/pki/master/aws_minions.pem
#  script_args: stable 2018.3.4
  script_args: -P -x python3 stable 2019.2.0
  provider: my-saltify-config
  force_minion_config: true  # -F switch in bootstrap script

saltify-win:
  ssh_host: 172.31.24.22
  provider: my-saltify-config
  minion:
    master: 172.31.23.52
  win_username: Administrator
  win_password: saltstack!2019
  #win_installer: /srv/salt/Salt-Minion-2018.3.4-Py2-x86-Setup.exe
  win_installer: /srv/salt/Salt-Minion-2019.2.0-Py3-AMD64-Setup.exe
  force_minion_config: true

Steps to Reproduce Issue

on clean minions (make sure no trace of previous minion, salt repo, salt config is present)
Use saltify to deploy windows to new systems (linux and windows) (try with 2018.3.4)
Once system saltified, use Saltify again to update the minion (try with 2019.2.0)
Should work OK.

Now on clean minions (make sure no trace of previous minion, salt repo, salt config is present)
Install salt-minion manually (Windows and Linux, 2018.3.4)
Try to use Saltify to update to 2019.2.0.
I got an error

Versions Report

2019.2.0
minions 2018.3.4 and 2019.2.0, python2 and python3

@Akm0d Akm0d added this to Backlog in Neon Dec 3, 2019
@Akm0d Akm0d added this to the Approved milestone Dec 3, 2019
@Akm0d Akm0d added Feature new functionality including changes to functionality and code refactors, etc. Grains Salt-Cloud and removed needs-triage labels Dec 5, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 7, 2020
@sagetherage sagetherage added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Jan 9, 2020
@stale
Copy link

stale bot commented Jan 9, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 9, 2020
@sagetherage sagetherage removed this from Backlog in Neon Jan 24, 2020
@sagetherage sagetherage added Windows and removed Confirmed Salt engineer has confirmed bug/feature - often including a MCVE labels Apr 22, 2021
@sagetherage sagetherage added this to To do in Windows via automation Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature new functionality including changes to functionality and code refactors, etc. Grains Salt-Cloud Windows
Projects
Windows
  
To do
Development

No branches or pull requests

4 participants