From 48ae6e1625e3c9f41ebaf94e20324a574436d0cd Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Sat, 9 Sep 2017 15:41:18 +0300 Subject: [PATCH] Fix vars for testing --- .editorconfig | 3 ++ Vagrantfile | 3 +- ansible/configuration.yml | 39 ++++++++++--------- ansible/roles/symfony-app/defaults/main.yml | 4 +- .../roles/symfony-app/templates/app.conf.j2 | 2 +- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.editorconfig b/.editorconfig index 56a5255..ed23d76 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,5 +9,8 @@ indent_size = 4 [*.yml] indent_size = 2 +[Vagrantfile] +indent_size = 2 + [Makefile] indent_style = tab diff --git a/Vagrantfile b/Vagrantfile index 22eb0fa..0621141 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -18,8 +18,9 @@ Vagrant.configure("2") do |config| ansible.galaxy_roles_path = "ansible/galaxy.roles" ansible.sudo = true ansible.extra_vars = { - from_vagrant: true, deploy_user: "deployer_test", + notes_domain: 'notes.loc', + notes_cert_type: 'self-signed', } end diff --git a/ansible/configuration.yml b/ansible/configuration.yml index de7d081..8092a9c 100644 --- a/ansible/configuration.yml +++ b/ansible/configuration.yml @@ -3,16 +3,14 @@ become: true vars: - - from_vagrant: no deploy_user: deployer - apps: - notes: - name: notes - dbname: notes_db - dbuser: notes_user - dbpassword: Sf6tp6LKeCyrjVZ2YGKYUd + # Configuration for "Notes" application + notes_domain: 'notes.anwinged.ru' + notes_cert_type: 'letsencrypt' + notes_dbname: notes_db + notes_dbuser: notes_db + notes_dbpassword: Sf6tp6LKeCyrjVZ2YGKYUd timezone: UTC @@ -40,18 +38,18 @@ # mysql settings mysql_databases: - - name: '{{ apps.notes.dbname }}' + - name: '{{ notes_dbname }}' mysql_users: - - name: '{{ apps.notes.dbuser }}' + - name: '{{ notes_dbuser }}' host: '127.0.0.1' - password: '{{ apps.notes.dbpassword }}' - priv: '{{ apps.notes.dbname }}.*:ALL' + password: '{{ notes_dbpassword }}' + priv: '{{ notes_dbname }}.*:ALL' pre_tasks: - name: Ensure that PHP PPA is added. apt_repository: repo=ppa:ondrej/php state=present - name: Update apt cache - apt: update_cache=yes + apt: update_cache=yes cache_valid_time=86400 - name: Install system packages apt: pkg={{ item }} state=latest with_items: @@ -85,19 +83,24 @@ app_name: notes app_user: notes_owner app_user_ssh_keys: ['{{ lookup("file", "av_id_rsa.pub") }}'] - app_domains: ['notes.anwinged.ru'] + app_domains: ['{{ notes_domain }}'] app_cert: yes - app_cert_type: 'letsencrypt' + app_cert_type: '{{ notes_cert_type }}' app_cert_email: anwinged@ya.ru + app_php_connection: '127.0.0.1:9010' app_envs: NOTES_SECRET_TOKEN: qJqFNP5B9RP2EfqgpTPyZe NOTES_DATABASE_HOST: 127.0.0.1 NOTES_DATABASE_PORT: 3306 - NOTES_DATABASE_NAME: '{{ apps.notes.dbname }}' - NOTES_DATABASE_USER: '{{ apps.notes.dbuser }}' - NOTES_DATABASE_PASSWORD: '{{ apps.notes.dbpassword }}' + NOTES_DATABASE_NAME: '{{ notes_dbname }}' + NOTES_DATABASE_USER: '{{ notes_dbuser }}' + NOTES_DATABASE_PASSWORD: '{{ notes_dbpassword }}' NOTES_MAILER_HOST: smtp.timeweb.ru NOTES_MAILER_PORT: 25 NOTES_MAILER_USER: noreply@anwinged.ru NOTES_MAILER_PASSWORD: C5DkD5gs SYMFONY_ENV: prod + + tasks: + - name: Fix php-mysql-package + apt: pkg=php7.1-mysql state=latest diff --git a/ansible/roles/symfony-app/defaults/main.yml b/ansible/roles/symfony-app/defaults/main.yml index feeeb69..1d977d2 100644 --- a/ansible/roles/symfony-app/defaults/main.yml +++ b/ansible/roles/symfony-app/defaults/main.yml @@ -22,7 +22,7 @@ app_envs: {} app_directory: '/var/www/{{ app_name }}' app_domains: ['{{ app_name }}.loc'] app_web_root: '/var/www/{{ app_name }}/current/web' -app_web_listen: 'unix:/var/run/php-fpm-{{ app_name }}.sock' +app_php_connection: '127.0.0.1:9001' # СЕРТИФИКАТ @@ -36,5 +36,5 @@ app_cert_email: 'name@example.com' app_php_version: '{{ php_version | default("7.0") }}' app_fpool_name: '{{ app_name }}' -app_fpool_listen: '/var/run/php-fpm-{{ app_name }}.sock' +app_fpool_listen: '{{ app_php_connection }}' app_fpool_slowlog: '/var/www/{{ app_name }}/shared/logs/' diff --git a/ansible/roles/symfony-app/templates/app.conf.j2 b/ansible/roles/symfony-app/templates/app.conf.j2 index d8c79fa..b00d25f 100644 --- a/ansible/roles/symfony-app/templates/app.conf.j2 +++ b/ansible/roles/symfony-app/templates/app.conf.j2 @@ -19,7 +19,7 @@ server { } location ~ ^/app\.php(/|$) { - fastcgi_pass {{ app_web_listen }}; + fastcgi_pass {{ app_php_connection }}; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params;