2

I have a server with a "standalone" minion installed and configured. I've been able to make lots of changes to my server with salt but I can't figure out how to configure my ssh server.

Here's what I currently have:

$ cat sshd.sls 
include:
  - openssh

sshd_config:
  Port: 1234

I have also downloaded the openssh formula into my /srv/formulas directory and updated my file_roots in my /etc/salt/minion dir:

file_roots:
  base:
    - /srv/salt
    - /srv/formulas/openssh-formula

And finally I have the following in my top.sls file:

base:
  '*':
    - users
    - sshd

Then I get this when I apply my state:

$ sudo salt-call state.apply --local
local:
    Data failed to compile:
----------
    State 'sshd_config' in SLS 'sshd' is not formed as a list

I've looked at the documentation for the openssh formula but I don't see how I'm misusing the API. What am I missing?

2
  • 4
    I'm guessing it wants the - in - Port: 1234
    – DerfK
    Jan 4, 2017 at 22:51
  • The error indicates that this bit of YAML in sshd_config is being interpreted as a Salt state, not as a Salt pillar. You need to add that setting to a file in one of the pillar_roots directories, not in the file_roots directories. Apr 9, 2017 at 19:44

1 Answer 1

1

The openssh formula support additional configuration and customization through Pillar.

In you configured your Pillar to use /srv/pillar, you can create a simple /srv/pillar/top.sls file with the following contents:

base:
  '*':
    - sshd

This top file associates the sshd.sls file to all minions. Now the /srv/pillar/sshd.sls file needs to be populated:

sshd_config:
  Port: 1234

Examples of all available options can be found in a file named pillar.example in the root directory of openssh formula repository.

There is no need for creating a custom sshd state if you use the openssh formula. Your /srv/salt/top.sls should look similar to this:

base:
  '*':
    - users
    - openssh

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.