Zack Williams | 42a96fb | 2020-06-15 21:36:14 -0700 | [diff] [blame] | 1 | --- |
| 2 | # postgresql tasks/Debian.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | # Docs: https://www.postgresql.org/download/linux/ubuntu/ |
| 8 | - name: Add PostgreSQL apt repo key |
| 9 | apt_key: |
| 10 | data: "{{ lookup('file','ACCC4CF8.asc') }}" |
| 11 | state: "present" |
| 12 | |
| 13 | - name: Add Official PostgreSQL apt repo |
| 14 | apt_repository: |
| 15 | repo: "deb http://apt.postgresql.org/pub/repos/apt {{ ansible_lsb['codename'] }}-pgdg main" |
| 16 | mode: 0644 |
| 17 | update_cache: true |
| 18 | |
| 19 | - name: Install PostgreSQL server, client, and python interface packages |
| 20 | apt: |
| 21 | name: |
| 22 | - "postgresql-{{ pgsql_version }}" |
| 23 | - "postgresql-client-{{ pgsql_version }}" |
| 24 | - "python3-psycopg2" |
| 25 | state: "present" |
| 26 | update_cache: true |
| 27 | cache_valid_time: 3600 |
| 28 | |
| 29 | - name: Start and Enable PostgreSQL Service |
| 30 | service: |
| 31 | name: "{{ pgsql_service }}" |
| 32 | state: "started" |
| 33 | enabled: true |