diff options
| author | Guilhem Moulin <guilhem@fripost.org> | 2026-03-05 14:30:44 +0100 |
|---|---|---|
| committer | Guilhem Moulin <guilhem@fripost.org> | 2026-03-05 23:18:54 +0100 |
| commit | 4ad98953f1c5372bc21248c24b386b0fd915f019 (patch) | |
| tree | 62828dae11c00e4d85ad0e0963c6b421f510c4dc | |
| parent | b18a7063b1c9ad0dd895e46f344dcb20c59d195e (diff) | |
Use PostgreSQL schemas to partition layers.
Cf. 4bb4d381f193f14260fc9f56679588d8e455dc93 in tools.
| -rw-r--r-- | group_vars/all.yml | 12 | ||||
| -rw-r--r-- | tasks/webmap.yml | 29 | ||||
| m--------- | webmap-tools | 0 |
3 files changed, 28 insertions, 13 deletions
diff --git a/group_vars/all.yml b/group_vars/all.yml index 10dfd93..00b04c8 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -28,3 +28,15 @@ webmap_layer_groups_update_calendar: postgresql: version: 17 cluster: main + +postgis_schemas: + - { name: lm_topo250, comment: "Lantmäteriets Topografi 250 (vektor)" } + - { name: mrr, comment: "Mineralrättigheter och prospektering" } + - { name: lst, comment: "Länsstyrelserna" } + - { name: sks, comment: "Skogsstyrelsen" } + - { name: nvk, comment: "Naturvårdsverket" } + - { name: nvr, comment: "Naturvårdsregistret" } + - { name: svk, comment: "Svenska kraftnät" } + - { name: vbk, comment: "Vindbrukskollen" } + - { name: sametinget, comment: "Sametinget" } + - { name: misc, comment: "Övriga skikt" } diff --git a/tasks/webmap.yml b/tasks/webmap.yml index 6f32a27..1ff8ea3 100644 --- a/tasks/webmap.yml +++ b/tasks/webmap.yml @@ -253,21 +253,22 @@ create: false notify: Reload PostgreSQL -- name: Create 'postgis' PostgreSQL schema +- name: Create PostgreSQL schemas become: true become_user: postgres community.postgresql.postgresql_schema: - name: postgis login_db: webmap + name: "{{ item.name }}" owner: postgres + comment: "{{ item.comment }}" + with_items: "{{ postgis_schemas }}" -- name: Install 'postgis' PostgreSQL extension to the webmap database in the postgis schema +- name: Install 'postgis' PostgreSQL extension to the webmap database become: true become_user: postgres community.postgresql.postgresql_ext: name: postgis login_db: webmap - schema: postgis comment: Geographic objects support for PostgreSQL - name: GRANT CONNECT ON DATABASE webmap TO webmap_import, webmap_guest @@ -279,29 +280,29 @@ type: database role: webmap_import,webmap_guest -- name: GRANT USAGE ON SCHEMA postgis TO webmap_import, webmap_guest +- name: GRANT USAGE ON SCHEMA * TO webmap_import, webmap_guest become: true become_user: postgres community.postgresql.postgresql_privs: login_db: webmap privs: USAGE type: schema - obj: postgis + objs: "{{ (['public'] + (postgis_schemas | map(attribute='name'))) | join(',') }}" role: webmap_import,webmap_guest -# webmap-import should TRUNCATE existing output layers -- name: REVOKE CREATE ON SCHEMA postgis FROM webmap_import +# tooling should TRUNCATE existing output layers instead +- name: REVOKE CREATE ON SCHEMA * FROM webmap_import become: true become_user: postgres community.postgresql.postgresql_privs: login_db: webmap privs: CREATE type: schema - obj: postgis + objs: "{{ (['public'] + (postgis_schemas | map(attribute='name'))) | join(',') }}" role: webmap_import state: absent -- name: GRANT SELECT ON TABLES IN SCHEMA postgis TO webmap_guest +- name: GRANT SELECT ON TABLES IN SCHEMA * TO webmap_guest become: true become_user: postgres community.postgresql.postgresql_privs: @@ -309,10 +310,11 @@ privs: SELECT type: table obj: ALL_IN_SCHEMA - schema: postgis + schema: "{{ item }}" role: webmap_guest + with_items: "{{ ['public'] + (postgis_schemas | map(attribute='name')) }}" -- name: GRANT USAGE, SELECT ON SEQUENCES IN SCHEMA postgis TO webmap_guest +- name: GRANT USAGE, SELECT ON SEQUENCES IN SCHEMA * TO webmap_guest become: true become_user: postgres community.postgresql.postgresql_privs: @@ -320,8 +322,9 @@ privs: USAGE,SELECT type: sequence obj: ALL_IN_SCHEMA - schema: postgis + schema: "{{ item }}" role: webmap_guest + with_items: "{{ ['public'] + (postgis_schemas | map(attribute='name')) }}" - name: Copy /usr/local/share/webmap/import.py copy: src=webmap-tools/webmap-import diff --git a/webmap-tools b/webmap-tools -Subproject f7785f929a4402a98a2d0bd428ba00968be8cf0 +Subproject 809059c08eae1723b82a0acfe459a71956148d3 |
