我尝试使用SaltStack配置我的Vagrant驱动的VM。我想安装和配置PostgreSQL。这是我的州:
postgresql-installation:
# adding repo, installing package, starting service here
postgresql-database-setup:
- postgres_user.present:
- name: {{ pillar['pg_db_user'] }}
- password: {{ pillar['pg_db_password'] }}
- require:
- service: postgresql
- postgres_database.present:
- name: {{ pillar['pg_db_name'] }}
- encoding: {{ pillar['pg_db_encoding'] }}
- lc_ctype: {{ pillar['pg_db_ctype'] }}
- lc_collate: {{ pillar['pg_db_collate'] }}
- template: {{ pillar['pg_db_template'] }}
- owner: {{ pillar['pg_db_user'] }}
- require:
- postgres_user: postgresql-database-setup
postgres-installation
完美无瑕,但postgres-database-setup
让我头疼。运行配置时,Salt会抛出此错误:
Data failed to compile:
----------
ID postgresql-database-setup in SLS postgresql is not a dictionary
YAMLlint.com说它有效(当然除了Jinja标签之外)并且我不知道Salt不喜欢它。 你们有个主意吗?
答案 0 :(得分:3)
postgres_user.present
和postgres_database.present
前面的破折号导致解析错误。没有他们一切都很好。