|
1 | 1 | {%- from "postgres/map.jinja" import postgres with context -%} |
2 | | -{%- from "postgres/macros.jinja" import format_state with context -%} |
3 | 2 |
|
4 | 3 | {%- set pkgs = [] %} |
5 | 4 | {%- for pkg in (postgres.pkg_client, postgres.pkg_libpq_dev) %} |
6 | 5 | {%- if pkg %} |
7 | 6 | {%- do pkgs.append(pkg) %} |
8 | 7 | {%- endif %} |
9 | | -{%- endfor -%} |
| 8 | +{%- endfor %} |
10 | 9 |
|
11 | | -{%- if postgres.use_upstream_repo -%} |
| 10 | +{%- if postgres.use_upstream_repo %} |
12 | 11 |
|
13 | 12 | include: |
14 | 13 | - postgres.upstream |
@@ -46,78 +45,3 @@ postgresql-client-libs: |
46 | 45 | {%- endfor %} |
47 | 46 |
|
48 | 47 | {%- endif %} |
49 | | -
|
50 | | -# Ensure that Salt is able to use postgres modules |
51 | | -# after installing client binaries |
52 | | -
|
53 | | -postgres-reload-modules: |
54 | | - test.nop: |
55 | | - - reload_modules: True |
56 | | -
|
57 | | -# User states |
58 | | -
|
59 | | -{%- for name, user in postgres.users|dictsort() %} |
60 | | -
|
61 | | -{{ format_state(name, 'postgres_user', user) }} |
62 | | - - require: |
63 | | - - pkg: postgresql-client-libs |
64 | | -
|
65 | | -{%- endfor %} |
66 | | -
|
67 | | -# Tablespace states |
68 | | -
|
69 | | -{%- for name, tblspace in postgres.tablespaces|dictsort() %} |
70 | | -
|
71 | | -{{ format_state(name, 'postgres_tablespace', tblspace) }} |
72 | | - - require: |
73 | | - - pkg: postgresql-client-libs |
74 | | - {%- if 'owner' in tblspace %} |
75 | | - - postgres_user: postgres_user-{{ tblspace.owner }} |
76 | | - {%- endif %} |
77 | | -
|
78 | | -{%- endfor %} |
79 | | -
|
80 | | -# Database states |
81 | | -
|
82 | | -{%- for name, db in postgres.databases|dictsort() %} |
83 | | -
|
84 | | -{{ format_state(name, 'postgres_database', db) }} |
85 | | - - require: |
86 | | - - pkg: postgresql-client-libs |
87 | | - {%- if 'owner' in db %} |
88 | | - - postgres_user: postgres_user-{{ db.owner }} |
89 | | - {%- endif %} |
90 | | - {%- if 'tablespace' in db %} |
91 | | - - postgres_tablespace: postgres_tablespace-{{ db.tablespace }} |
92 | | - {%- endif %} |
93 | | -
|
94 | | -{%- endfor %} |
95 | | -
|
96 | | -# Schema states |
97 | | -
|
98 | | -{%- for name, schema in postgres.schemas|dictsort() %} |
99 | | -
|
100 | | -{{ format_state(name, 'postgres_schema', schema) }} |
101 | | - - require: |
102 | | - - pkg: postgresql-client-libs |
103 | | - {%- if 'owner' in schema %} |
104 | | - - postgres_user: postgres_user-{{ schema.owner }} |
105 | | - {%- endif %} |
106 | | -
|
107 | | -{%- endfor %} |
108 | | -
|
109 | | -# Extension states |
110 | | -
|
111 | | -{%- for name, extension in postgres.extensions|dictsort() %} |
112 | | -
|
113 | | -{{ format_state(name, 'postgres_extension', extension) }} |
114 | | - - require: |
115 | | - - pkg: postgresql-client-libs |
116 | | - {%- if 'maintenance_db' in extension %} |
117 | | - - postgres_database: postgres_database-{{ extension.maintenance_db }} |
118 | | - {%- endif %} |
119 | | - {%- if 'schema' in extension %} |
120 | | - - postgres_schema: postgres_schema-{{ extension.schema }} |
121 | | - {%- endif %} |
122 | | -
|
123 | | -{%- endfor %} |
0 commit comments