Thursday 4 August 2016

salt-cloud install a specific version of salt-minion


This is a guide to install a specific version of salt-minion package on new minions being bootstrapped using salt-cloud.
This is not specific for any OS or destro but I was using Ubuntu 14.04.
salt-cloud uses salt-bootstrap.sh script (https://github.com/saltstack/salt-bootstrap) which installs every dependencies and salt-minion on the newly created instance. This file is usually located at /usr/lib/python2.7/dist-packages/salt/cloud/deploy/bootstrap-salt.sh.
Version and/or Source can be specified in the cloud.profile configuration as below.
In /etc/salt/cloud.profiles.d/someprofile.conf

staging:
  provider: aws
  image: ami-xxxxxx
  size: m1.small
  securitygroup:
    - SG1
    - SG2
  tag:
      circle: staging
      type: app
  script_args: git v2015.5.2


The last property script_args value will be passed to the bootstrap script. The above values tells to install salt-minion version v2015.5.2 from github(not the Ubuntu repo).
The values can be any of the following.
Installation types:

- stable (default, It installs from OS Repository e.g Deb/RPM)
- stable [version] (ubuntu specific)
- daily  (ubuntu specific)
- testing (redhat specific)
- git (Installs from github repository)


Examples:

- stable
- stable 2015.5
- daily
- testing
- git
- git develop
- git v2015.5.3
- git 8c3fadf15ec183e5ce8c63739850d543617e4357


Custom/Edited script can also be used instead of the default bootstrap-salt.sh
Just copy the /usr/lib/python2.7/dist-packages/salt/cloud/deploy/bootstrap-salt.sh or download https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh and put it under/etc/salt/cloud.deploy.d/. If the file is named bootstrap-salt.sh then no change required in the profile configuration. If the file name is something different like custom-bootstrap.sh then added the following in the configuration file.
In /etc/salt/cloud.profiles.d/someprofile.conf

staging:
  provider: aws
  image: ami-xxxxxx
  size: m1.small
  securitygroup:
    - SG1
    - SG2
  tag:
      circle: staging
      type: app
  script: custom-bootstrap.sh # This can also be an absolute path.
  script_args: git v2015.5.2


Hope it helps.
Any questions or suggestions are welcome.

Ideaapplied Technologies provides comprehensive QA services. Visit us at ideaapplied.com to know more about our services

No comments:

Post a Comment