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