You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm trying to configure newly provisioned azure VM's with custom grains. It works fine on Linux VM's. But for windows VM's the grains are in the server but it doesn't show when we run the command salt 'wintest-001' grains.items.
How do you define custom grains for Windows minions?
Update: There seems to two location for Grains and Minion config on Windows VM's. The Salt process is looking for configs from C:\Program Data\salt-project\. But the grains defined in profile are written in c:\salt\grains and c:\salt\minion. If I move the grains file to C:\Program Data\salt-project\grains then it works as expected.
How can I configure the profile to write grains data under C:\Program Data\salt-project\ instead of c:\salt?
Adding /custom-config='c:\\salt\\conf\\minion' args to the /usr/lib/python3/dist-packages/salt/utils/cloud.py seems to resolve the issue. Can someone create a PR for this?
Note: I had to create a dummy file before the installation starts. The dummy file will be backed up during the installation and new config file will be created.
This also fixes the issue #63016 because installer uses the pub file from c:\salt\ instead of from c:\programdata\salt project\salt.
# Create a dummy file so the installer can use.
if minion_conf:
minion_conf_temp = "Temp file"
salt.utils.smb.put_str(
salt_config_to_yaml(minion_conf_temp, line_break="\r\n"),
"salt\\conf\\minion",
conn=smb_conn,
)
if use_winrm:
winrm_cmd(
winrm_session,
"c:\\salttemp\\{}".format(installer),
["/S /custom-config='c:\\salt\\conf\\minion'", "/master={}".format(master), "/minion-name={}".format(name)],
)
else:
cmd = "c:\\salttemp\\{}".format(installer)
args = "/S /custom-config='c:\\salt\\conf\\minion' /master={} /minion-name={}".format(master, name)
stdout, stderr, ret_code = run_psexec_command(
cmd, args, host, username, password
)
if ret_code != 0:
raise Exception("Fail installer {}".format(ret_code))
Description
I'm trying to configure newly provisioned azure VM's with custom grains. It works fine on Linux VM's. But for windows VM's the grains are in the server but it doesn't show when we run the command
salt 'wintest-001' grains.items
.How do you define custom grains for Windows minions?
Update: There seems to two location for Grains and Minion config on Windows VM's. The Salt process is looking for configs from
C:\Program Data\salt-project\
. But the grains defined in profile are written inc:\salt\grains
andc:\salt\minion
. If I move the grains file toC:\Program Data\salt-project\grains
then it works as expected.How can I configure the profile to write grains data under
C:\Program Data\salt-project\
instead ofc:\salt
?Steps to Reproduce the behavior
Create a windows azure profile as shown below.
Deploy a new VM using the following command.
salt-cloud -p azure-win2019 wintest-001
After the provision is complete, check the grains and the
environment
grain is missing.root@salt:/etc/salt/cloud.profiles.d# salt 'wintest-001' grains.items | grep production
No matches
If you RDP to the new VM, you can see that grains file exists in the VM.
Here is the content of the minion config:
I tried restarting salt services as well. But still its not showing up.
Expected behavior
Custom grains should show up just like it does for Linux
Versions Report
salt --versions-report
root@salt:~# salt --versions-report
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.9
gitpython: 3.1.24
Jinja2: 3.0.3
libgit2: 1.1.0
M2Crypto: 0.38.0
Mako: Not Installed
msgpack: 1.0.3
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.11.0
pygit2: 1.6.1
Python: 3.10.6 (main, Nov 2 2022, 18:53:38) [GCC 11.3.0]
python-gnupg: 0.4.8
PyYAML: 5.4.1
PyZMQ: 22.3.0
smmap: 5.0.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: ubuntu 22.04 Jammy Jellyfish
locale: utf-8
machine: x86_64
release: 5.15.0-1022-aws
system: Linux
version: Ubuntu 22.04 Jammy Jellyfish
The text was updated successfully, but these errors were encountered: