salt icon indicating copy to clipboard operation
salt copied to clipboard

bootstrap-salt with gpg?

Open hernanc opened this issue 11 years ago • 6 comments

Hi there, I'm using gpg to store secrets (pillar keys and passwords) in the git repo and I have a newly created minion I've created with salt-cloud. When I want to do a highstate on the minion (Ubuntu 14.04), I get this error:

minion-1.my_domain.com
----------
          ID: states
    Function: no.None
      Result: False
     Comment: Unable to render top file: GPG unavailable
     Started:
    Duration:
     Changes:

Summary
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1

So I SSH to the minion and I install pip and python-gnupg and this solves it

apt-get install -y pip
pip install python-gnupg

Now, my question is, is there a way to make the salt bootstrap script load these? Or do I need to use a custom bootstrap script for these minions? If I need to create my own bootstrap script, where should I put it? It's not clear on the docs

Thanks a lot! H

My master's versions

$ salt --versions-report
                  Salt: 2015.5.2
                Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
                Jinja2: 2.7.2
              M2Crypto: 0.21.1
        msgpack-python: 0.3.0
          msgpack-pure: Not Installed
              pycrypto: 2.6.1
               libnacl: Not Installed
                PyYAML: 3.10
                 ioflo: Not Installed
                 PyZMQ: 14.0.1
                  RAET: Not Installed
                   ZMQ: 4.0.4
                  Mako: 0.9.1
 Debian source package: 2015.5.2+ds-1trusty1

hernanc avatar Jul 10 '15 23:07 hernanc

There's no way with the current bootstrap script, I don't think. You could use startup states to install on minion startup: http://docs.saltstack.com/en/latest/ref/states/startup.html

If you want to use a custom bootstrap script, put it in /etc/salt/cloud.deploy.d/bootstrap-salt.sh

basepi avatar Jul 13 '15 19:07 basepi

Keep me posted if you have further questions.

basepi avatar Jul 13 '15 19:07 basepi

You can actually pass -p python-gnupg to the bootstrap script and it will install the package when bootstrapping. This however, is only available for PIP installable packages.

s0undt3ch avatar Jul 14 '15 07:07 s0undt3ch

Great. Adding these lines to the cloud provider did it. Thanks to you all.

script: bootstrap-salt
script_args: -p python-gnupg

hernanc avatar Jul 14 '15 15:07 hernanc

Awesome!

s0undt3ch avatar Jul 14 '15 16:07 s0undt3ch

Ooh, that's a useful flag. /me makes mental note

/me promptly forgets mental note

basepi avatar Jul 14 '15 22:07 basepi