names of tasks in the playbook translated

This commit is contained in:
dima 2024-10-20 13:21:50 +03:00
parent c14b775aa4
commit 013994211f

View File

@ -1,5 +1,5 @@
---
- name: Установка и настройка PostgreSQL
- name: Install PostgreSQL on openSUSE Leap
hosts: postgres_servers
become: yes
vars:
@ -8,68 +8,68 @@
postgres_db: mydatabase
tasks:
- name: Обновление zypper
- name: Update zypper
command: zypper refresh
register: zypper_refresh
changed_when: "'Refreshing' in zypper_refresh.stdout"
- name: Обновление системы до последних версий пакетов
- name: Update System
zypper:
name: '*'
state: latest
when: zypper_refresh.changed
- name: Установка пакетов PostgreSQL
- name: Update PostgreSQL package
zypper:
name:
- postgresql-server
- postgresql-contrib
state: present
- name: Инициализация базы данных PostgreSQL
- name: PostgreSQL initdb
command: sudo -u postgres initdb -D /var/lib/pgsql/data
args:
creates: /var/lib/pgsql/data/PG_VERSION
- name: Обеспечение запуска и автозапуска службы PostgreSQL
- name: Systemctl start and enable PostgreSQL
service:
name: postgresql
state: started
enabled: yes
- name: Установка python
- name: python3-psycopg2 install
zypper:
name: python3-psycopg2
state: present
- name: Настройка listen_addresses в postgresql.conf
- name: Change listen_addresses in postgresql.conf
lineinfile:
path: /var/lib/pgsql/data/postgresql.conf
regexp: '^#?listen_addresses\s*='
line: "listen_addresses = '*'"
notify: Перезапуск PostgreSQL
notify: Restart PostgreSQL
- name: Настройка pg_hba.conf
- name: Change pg_hba.conf
lineinfile:
path: /var/lib/pgsql/data/pg_hba.conf
regexp: '^host\s+all\s+all\s+0\.0\.0\.0/0\s+md5'
line: "host all all 0.0.0.0/0 md5"
notify: Перезапуск PostgreSQL
notify: Restart PostgreSQL
- name: Создание пользователя PostgreSQL
- name: Create User PostgreSQL
community.postgresql.postgresql_user:
name: "{{ postgres_user }}"
password: "{{ postgres_password }}"
state: present
- name: Создание базы данных PostgreSQL
- name: Create Base PostgreSQL
community.postgresql.postgresql_db:
name: "{{ postgres_db }}"
owner: "{{ postgres_user }}"
encoding: UTF8
state: present
- name: Создание таблицы
- name: Create table "contacts"
community.postgresql.postgresql_query:
db: "{{ postgres_db }}"
query: |
@ -81,7 +81,7 @@
login_password: "{{ postgres_password }}"
handlers:
- name: Перезапуск PostgreSQL
- name: Restart PostgreSQL
service:
name: postgresql
state: restarted