salt icon indicating copy to clipboard operation
salt copied to clipboard

Environments and git branches confusion, I've tried everything!

Open evenyougreg opened this issue 7 years ago • 1 comments

Description of Issue/Question

Seems like I've tried everything:(

I have 2 branches in GitHub called "master" and "testing", but I am only focusing on testing atm.

I have 2 masters that need to be fully sealed off from each other, each representing a different environment, Prod and Testing.

I want to be able to run a state.apply without having to specifying the environment.

I've got a simple executable state that installs on a Windows server and works every time, but only if I specifically call it out:

salt t-win2012r2 state.apply encase

Although this works, it is putting the files into base cache on the server, not testing like I would expect.

The main issues are showing up when I have the executable state in my top file and I run a highstate, the top file doesn't see it, even though everything appears to be connected from GitHub to my master.

I've tried every combination of saltenv this and saltenv that in my master config file, and nothing seems to work.

Setup

master config###

fileserver_backend:

  • gitfs
  • roots

file_roots: base: - /srv/salt testing: - /srv/salt

state_top_saltenv: testing

gitfs_provider: pygit2 gitfs_root: salt

gitfs_pubkey: '/root/.ssh/id_rsa.pub' gitfs_privkey: '/root/.ssh/id_rsa'

gitfs_remotes:

  • [email protected]:myrepo/top.git:

    • pubkey: /root/.ssh/id_rsa.pub
    • privkey: /root/.ssh/id_rsa
    • base: testing
  • [email protected]:myrepo/linux.git:

    • pubkey: /root/.ssh/id_rsa.pub
    • privkey: /root/.ssh/id_rsa
    • base: testing
  • [email protected]:myrepo/windows.git:

    • pubkey: /root/.ssh/id_rsa.pub
    • privkey: /root/.ssh/id_rsa
    • base: testing

files from fileserver.file_list

  • binaries/encasesetup.exe
  • encase/init.sls
  • encase/startservice.sls
  • testing-linux.sls
  • testing-windows.sls
  • top.sls

top file in GitHub called top.sls

(testing branch)

testing: 'os:Windows': - match: grain - encase

exectuable state file called encase/init.sls

(testing branch)

Install Encase

places file into System32 dir

C:\Windows\System32\encasesetup.exe: file.managed: - source: salt://binaries/encasesetup.exe

runs the encasesetup executable from inside System32 dir

run_encasesetup: cmd.run: - name: 'C:\Windows\System32\encasesetup.exe' - cwd: 'C:\Windows\System32' - shell: 'Windows' - require: - file: C:\Windows\System32\encasesetup.exe

Steps to Reproduce Issue

Error:

root@t-master:/etc/salt/master.d# salt t-web1* state.apply t-web1:

      ID: states
Function: no.None
  Result: False
 Comment: No Top file or master_tops data matches found.
 Changes:

Summary for t-web1

Succeeded: 0 Failed: 1

Total states run: 1 Total run time: 0.000 ms ERROR: Minions returned with non-zero exit code

Versions Report

Salt Version: Salt: 2018.3.3

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.6.1 docker-py: Not Installed gitdb: 2.0.3 gitpython: 2.1.8 ioflo: Not Installed Jinja2: 2.10 libgit2: 0.26.0 libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.7 msgpack-pure: Not Installed msgpack-python: 0.5.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.26.2 Python: 2.7.15rc1 (default, Nov 12 2018, 14:31:15) python-gnupg: 0.4.1 PyYAML: 3.12 PyZMQ: 16.0.2 RAET: Not Installed smmap: 2.0.3 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.5

System Versions: dist: Ubuntu 18.04 bionic locale: UTF-8 machine: x86_64 release: 4.15.0-43-generic system: Linux version: Ubuntu 18.04 bionic

evenyougreg avatar Jan 25 '19 17:01 evenyougreg

formatting is messed up, resubmitting

evenyougreg avatar Jan 25 '19 17:01 evenyougreg