Search code examples
salt-project

Set password using Saltstack mysql-formula?


I'm using the SaltStack mysql-formula and the defaults work just fine except for the root password.

Rather than try the pillar I thought this should work:

sudo salt 'ip-172-31-20-106.ec2.internal' state.sls mysql pillar="{'mysql:server:root_password':'Password'}" >

But no joy. I hacked on debconfmod.py to display the password but no luck there.

Should this work and if so how?

Thanks.


Solution

  • Turns out I screwed-up the yml conversion into json.

    The pillar yml is

    mysql:
      server:
        root_password: 'somepass'
    

    So the pillar json should be

    pillar="{'mysql':{'server':{'root_password':'somepass'}}}"
    

    Now everything works as it should.