PDA

View Full Version : SM3: Custom Salt States with source entry



matze502
15-Aug-2017, 12:18
Hi all,

I've set up the new Suse Manager 3.1 and hope that anybody could help me with Salt. I'm wondering how to implement a custom salt state with a source entry in it when creating one under Salt --> State Catalog?
For example:
I wanted to apply the following state:

/etc/ssh/sshd_config:
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://sshd/files/config/sshd_config
- user: root
- group: root
- file_mode: 644

In that case, where do I have to put the config file? Or can I only create a state under /srv/salt and have to apply the state manually via command line?
Is there a way to get the states created unter /srv/salt into the state catalog? I haven't found anything in the documentation. Only how to create a simple state with pkg.installed ....

Thanks in advance for your help!!

Matze

pfoerfr
17-Aug-2017, 14:12
Hi all,

I've set up the new Suse Manager 3.1 and hope that anybody could help me with Salt. I'm wondering how to implement a custom salt state with a source entry in it when creating one under Salt --> State Catalog?
For example:
I wanted to apply the following state:

/etc/ssh/sshd_config:
file.managed:
- name: /etc/ssh/sshd_config
- source: salt://sshd/files/config/sshd_config
- user: root
- group: root
- file_mode: 644

In that case, where do I have to put the config file? Or can I only create a state under /srv/salt and have to apply the state manually via command line?
Is there a way to get the states created unter /srv/salt into the state catalog? I haven't found anything in the documentation. Only how to create a simple state with pkg.installed ....

Thanks in advance for your help!!

Matze

Hello Matze,

the salt-states are stored at /srv/susemanager/salt/manager_org_1/

In youre situation maybe /srv/susemanager/salt/manager_org_1/sshd.sls (when you call youre state sshd)

and the files are stored at:
/srv/salt/

this location are all described at

https://www.suse.com/documentation/suse-manager-3/book_suma_getting-started_31/data/salt_gs_guide_salt_file_locations.html



and configured at: /etc/salt/master.d/susemanager.conf

regards
Franz

matze502
21-Aug-2017, 12:45
Hi Franz,

thanks for the infos. Ok, I thought that there will be another option to maintain the used files also from the GUI just like I did with the state itself.
I've now put the files to /srv/salt and it works like a charm.

Thanks!!

Matze