Playbook для утановки posgresql и смены пароля.
- hosts: postgres-test tasks: - name: add key apt_key: url=https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc state=present - name: Add Postgresql repo apt_repository: repo='deb https://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' state=present - name: Update apt cache apt: update_cache=yes - name: Install Poestgresl apt: pkg={{ item }} state=present with_items: - postgresql-9.5 - postgresql-9.5-postgis-2.2 - postgresql-9.5-postgis-scripts - zerofree - pgdg-keyring - postgresql-9.5-repmgr - rsync - ntp - ntpdate - xinetd - git - iptables-persistent - xtrabackup - percona-toolkit - python-psycopg2 - libpq-dev - name: Create postgresql conf files - postgesql/con template: src=/etc/ansible/files/postgres/postgresql.conf dest=/etc/postgresql/9.5/main/postgresql.conf notify: - name: Create postgresql conf files - pg_hba template: src=/etc/ansible/files/postgres/pg_hba.conf dest=/etc/postgresql/9.5/main/pg_hba.conf notify: - service: name=xinetd state=stopped - service: name=xinetd state=started - service: name=postgresql state=restarted - hosts: percona-test sudo: yes sudo_user: postgres tasks: - postgresql_user: db=postgres user=postgres password=Cbrt32456
Спасибо огромное!