salt-formulas / salt-formula-freeipa

Other
20 stars 35 forks source link

Attempting to use formula is leading to error #25

Open tekkifygamer opened 1 year ago

tekkifygamer commented 1 year ago

Hi there,

I've followed the saltstack formula documentation to the T but have had no success in using this formula. Each time I try to apply the state to minions I am receiving this error:


    Data failed to compile:
----------
    Pillar failed to render with the following messages:
----------
    Rendering Primary Top file failed, render error:
while parsing a block mapping
  in "<unicode string>", line 1, column 1
did not find expected key
  in "<unicode string>", line 3, column 5

The error itself seems misleading as the top.sls file is fine. Currently the pillar top.sls file looks like this:

base:
  '*':
    - freeipa.client

The state top.sls file looks like this:

base:
  '*':
    - freeipa

The current file structure is the basic saltstack defaults, this was done to rule out any gitfs issues:

Pillars are stored in /srv/pillar, with the client pillar in /srv/pillar/freeipa/client.sls

The formula is stored in /srv/salt under /srv/salt/freeipa/ . This is essentially a copy of the freeipa folder within the master repo.

Please let me know if more information required and I'd be more than happy to provide it. Thank you for looking into my issue.

jdshewey commented 1 year ago

You need to post your freeipa.client pilar data - and should probably run it through a YAML linter first. Tabs vs. spaces is a big issue in YAML.

tekkifygamer commented 1 year ago

Here's the pillar file I currently have made

freeipa:
  client:
    enabled: true
    server: freeipa.xnet.local
    domain: {{ salt['grains.get']('domain', '') }}
    realm: {{ salt['grains.get']('domain', '').upper() }}
    hostname: {{ salt['grains.get']('fqdn', '') }}
    install_principal:
      source: salt://freeipa/files/principal.keytab
      mode: "0600"
      principal_user: "xavier"
      file_user: "root"
      file_group: "root"

when I run the pillar.items command it appears that the minions are able to access the pillar data correctly.

test.xnet.local:
    ----------
    freeipa:
        ----------
        client:
            ----------
            domain:
                xnet.local
            enabled:
                True
            hostname:
                test.xnet.local
            install_principal:
                ----------
                file_group:
                    root
                file_user:
                    root
                mode:
                    0600
                principal_user:
                    xavier
                source:
                    salt://freeipa/files/principal.keytab
            realm:
                XNET.LOCAL
            server:
                freeipa.xnet.local

Thank you for taking time to look into my issue, I greatly appreciate it.