update Jenkinsfile & backup playbook

This commit is contained in:
dima 2024-10-20 13:42:05 +03:00
parent e5f1ffb21d
commit bd630368ab
2 changed files with 6 additions and 4 deletions

8
Jenkinsfile vendored
View File

@ -1,14 +1,16 @@
pipeline {
agent any
environment {
SSH_ROOT_PASSWORD = credentials('ssh_root_password') /
PSQL_PASSWORD = credentials('PSQL_pass')
SSH_ROOT_PASSWORD = credentials('ssh_root_password')
PSQL_PASSWORD = credentials('PSQL_pass')
ANSIBLE_HOST_KEY_CHECKING = 'False'
}
parameters {
string(name: 'DB_SERVER_IP', defaultValue: '192.168.0.71', description: 'IP-адрес сервера')
string(name: 'SSH_USER', defaultValue: 'root', description: 'Имя пользователя для SSH подключения')
string(name: 'DB_USER', defaultValue: 'postgres', description: 'Имя пользователя базы данных')
string(name: 'DB_NAME', defaultValue: 'mydb', description: 'Имя базы данных')
string(name: 'BACKUP_DIR', defaultValue: '/var/backups/postgresql', description: 'Директория для бэкапа')
}
stages {
stage('Clone repository') {
@ -71,7 +73,7 @@ pipeline {
-e postgres_user=${params.DB_USER} \
-e postgres_password=${PSQL_PASSWORD} \
-e postgres_db=${params.DB_NAME} \
-e backup_dir=/path/to/backup
-e backup_dir=${params.BACKUP_DIR}
"""

View File

@ -4,7 +4,7 @@
become: true
vars:
backup_dir: "{{ backup_dir }}"
backup_dir: "{{ backup_dir }}" #work
tasks:
- name: Create backup directory