40 lines
No EOL
1.2 KiB
YAML
40 lines
No EOL
1.2 KiB
YAML
---
|
|
- name: Check and Install PostGIS
|
|
hosts: lab02
|
|
become: true
|
|
vars:
|
|
ct_id: 300
|
|
|
|
tasks:
|
|
- name: Check PostgreSQL version
|
|
command: |
|
|
pct exec {{ ct_id }} -- sudo -u postgres psql -c "SELECT version();"
|
|
register: pg_version
|
|
|
|
- name: Update apt cache in container
|
|
command: pct exec {{ ct_id }} -- bash -c "apt-get update"
|
|
|
|
- name: Search for PostGIS packages
|
|
command: pct exec {{ ct_id }} -- bash -c "apt-cache search postgis | grep postgresql"
|
|
register: postgis_packages
|
|
|
|
- name: Display available packages
|
|
debug:
|
|
msg: |
|
|
PostgreSQL Version:
|
|
{{ pg_version.stdout }}
|
|
|
|
Available PostGIS packages:
|
|
{{ postgis_packages.stdout }}
|
|
|
|
- name: Install PostGIS (flexible version)
|
|
command: pct exec {{ ct_id }} -- bash -c "apt-get install -y postgis"
|
|
register: install_result
|
|
|
|
- name: Enable PostGIS in APRS database
|
|
command: |
|
|
pct exec {{ ct_id }} -- sudo -u postgres psql -d aprs -c "CREATE EXTENSION IF NOT EXISTS postgis;"
|
|
|
|
- name: Display installation result
|
|
debug:
|
|
msg: "PostGIS installation completed!" |