diff --git a/Jenkinsfile b/Jenkinsfile index d9f6a00..9bac84d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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} """ diff --git a/backup_postgresql.yml b/backup_postgresql.yml index 8eaf780..56a0871 100644 --- a/backup_postgresql.yml +++ b/backup_postgresql.yml @@ -4,7 +4,7 @@ become: true vars: - backup_dir: "{{ backup_dir }}" + backup_dir: "{{ backup_dir }}" #work tasks: - name: Create backup directory