| --- |
| # postgresql tasks/Debian.yml |
| # |
| # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # Docs: https://www.postgresql.org/download/linux/ubuntu/ |
| - name: Add PostgreSQL apt repo key |
| apt_key: |
| data: "{{ lookup('file','ACCC4CF8.asc') }}" |
| state: "present" |
| |
| - name: Add Official PostgreSQL apt repo |
| apt_repository: |
| repo: "deb http://apt.postgresql.org/pub/repos/apt {{ ansible_lsb['codename'] }}-pgdg main" |
| mode: 0644 |
| update_cache: true |
| |
| - name: Install PostgreSQL server, client, and python interface packages |
| apt: |
| name: |
| - "postgresql-{{ pgsql_version }}" |
| - "postgresql-client-{{ pgsql_version }}" |
| - "python3-psycopg2" |
| state: "present" |
| update_cache: true |
| cache_valid_time: 3600 |
| |
| - name: Start and Enable PostgreSQL Service |
| service: |
| name: "{{ pgsql_service }}" |
| state: "started" |
| enabled: true |