Reconfigure vagrant
This commit is contained in:
parent
0d316aac6c
commit
ec822f1441
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
/ansible/galaxy.roles/
|
||||||
/output_*
|
/output_*
|
||||||
/vendor/
|
/vendor/
|
||||||
|
68
Vagrantfile
vendored
68
Vagrantfile
vendored
@ -1,66 +1,22 @@
|
|||||||
# -*- mode: ruby -*-
|
# -*- mode: ruby -*-
|
||||||
# vi: set ft=ruby :
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
ENV["LC_ALL"] = "en_US.UTF-8"
|
||||||
# configures the configuration version (we support older styles for
|
|
||||||
# backwards compatibility). Please don't change it unless you know what
|
# For installing ansible_local from pip on guest
|
||||||
# you're doing.
|
Vagrant.require_version ">= 1.8.3"
|
||||||
Vagrant.configure("2") do |config|
|
|
||||||
# The most common configuration options are documented and commented below.
|
Vagrant.configure("2") do |config|
|
||||||
# For a complete reference, please see the online documentation at
|
|
||||||
# https://docs.vagrantup.com.
|
|
||||||
|
|
||||||
# Every Vagrant development environment requires a box. You can search for
|
|
||||||
# boxes at https://atlas.hashicorp.com/search.
|
|
||||||
config.vm.box = "ubuntu/trusty64"
|
config.vm.box = "ubuntu/trusty64"
|
||||||
|
|
||||||
# Disable automatic box update checking. If you disable this, then
|
|
||||||
# boxes will only be checked for updates when the user runs
|
|
||||||
# `vagrant box outdated`. This is not recommended.
|
|
||||||
# config.vm.box_check_update = false
|
|
||||||
|
|
||||||
# Create a forwarded port mapping which allows access to a specific port
|
|
||||||
# within the machine from a port on the host machine. In the example below,
|
|
||||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
|
||||||
config.vm.network "forwarded_port", guest: 80, host: 8080
|
config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||||
|
|
||||||
# Create a private network, which allows host-only access to the machine
|
config.vm.provision "ansible_local" do |ansible|
|
||||||
# using a specific IP.
|
ansible.playbook = "ansible/provision.yml"
|
||||||
config.vm.network "private_network", ip: "192.168.33.20"
|
ansible.galaxy_role_file = "ansible/requirements.yml"
|
||||||
|
ansible.galaxy_roles_path = "ansible/galaxy.roles"
|
||||||
|
ansible.sudo = true
|
||||||
|
end
|
||||||
|
|
||||||
# Share an additional folder to the guest VM. The first argument is
|
|
||||||
# the path on the host to the actual folder. The second argument is
|
|
||||||
# the path on the guest to mount the folder. And the optional third
|
|
||||||
# argument is a set of non-required options.
|
|
||||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
|
||||||
|
|
||||||
# Provider-specific configuration so you can fine-tune various
|
|
||||||
# backing providers for Vagrant. These expose provider-specific options.
|
|
||||||
# Example for VirtualBox:
|
|
||||||
#
|
|
||||||
# config.vm.provider "virtualbox" do |vb|
|
|
||||||
# # Display the VirtualBox GUI when booting the machine
|
|
||||||
# vb.gui = true
|
|
||||||
#
|
|
||||||
# # Customize the amount of memory on the VM:
|
|
||||||
# vb.memory = "1024"
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# View the documentation for the provider you are using for more
|
|
||||||
# information on available options.
|
|
||||||
|
|
||||||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
|
|
||||||
# such as FTP and Heroku are also available. See the documentation at
|
|
||||||
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
|
|
||||||
# config.push.define "atlas" do |push|
|
|
||||||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Enable provisioning with a shell script. Additional provisioners such as
|
|
||||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
|
||||||
# documentation for more information about their specific syntax and use.
|
|
||||||
# config.vm.provision "shell", inline: <<-SHELL
|
|
||||||
# apt-get update
|
|
||||||
# apt-get install -y apache2
|
|
||||||
# SHELL
|
|
||||||
end
|
end
|
||||||
|
16
ansible/provision.yml
Normal file
16
ansible/provision.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- vars/all.yml
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Ensure that PHP Ondrej PPA is added
|
||||||
|
apt_repository: repo=ppa:ondrej/php state=present
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- yatesr.timezone
|
||||||
|
- server
|
||||||
|
- geerlingguy.nginx
|
||||||
|
- nginx
|
||||||
|
- geerlingguy.php
|
13
ansible/requirements.yml
Normal file
13
ansible/requirements.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
- src: yatesr.timezone
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
|
- src: geerlingguy.nginx
|
||||||
|
version: 1.9.6
|
||||||
|
|
||||||
|
- src: geerlingguy.php
|
||||||
|
version: 3.4.2
|
||||||
|
|
||||||
|
- src: geerlingguy.composer
|
||||||
|
version: 1.5.0
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
- name: restart nginx
|
|
||||||
service: name=nginx enabled=yes state=restarted
|
|
@ -1,33 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Install Nginx
|
- name: Create nginx config
|
||||||
become: yes
|
|
||||||
apt: pkg=nginx state=latest
|
|
||||||
|
|
||||||
- name: Create nginx congig
|
|
||||||
become: yes
|
|
||||||
template:
|
template:
|
||||||
src: homepage.j2
|
src: site.conf.j2
|
||||||
dest: /etc/nginx/sites-available/{{ site.domain }}
|
dest: /etc/nginx/sites-enabled/{{ nginx_conf_name }}
|
||||||
notify: restart nginx
|
|
||||||
|
|
||||||
- name: Create symlink to site
|
|
||||||
become: yes
|
|
||||||
file:
|
|
||||||
src: /etc/nginx/sites-available/{{ site.domain }}
|
|
||||||
dest: /etc/nginx/sites-enabled/{{ site.domain }}
|
|
||||||
state: link
|
|
||||||
notify: restart nginx
|
|
||||||
|
|
||||||
- name: Delete default site
|
|
||||||
become: yes
|
|
||||||
file:
|
|
||||||
path: /etc/nginx/sites-available/default
|
|
||||||
state: absent
|
|
||||||
notify: restart nginx
|
|
||||||
|
|
||||||
- name: Delete default site symlink
|
|
||||||
become: yes
|
|
||||||
file:
|
|
||||||
path: /etc/nginx/sites-enabled/default
|
|
||||||
state: absent
|
|
||||||
notify: restart nginx
|
notify: restart nginx
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name {{ site.domain }} www.{{ site.domain }};
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /var/www/{{ site.www_dir }}/current/web;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri /index.html;
|
|
||||||
}
|
|
||||||
}
|
|
12
ansible/roles/nginx/templates/site.conf.j2
Executable file
12
ansible/roles/nginx/templates/site.conf.j2
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name {{ nginx_conf_domain }} www.{{ nginx_conf_domain }};
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root {{ nginx_conf_root }};
|
||||||
|
index index.html;
|
||||||
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendfile off;
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Update apt
|
- name: Update apt cache
|
||||||
sudo: yes
|
sudo: yes
|
||||||
apt: update_cache=yes
|
apt: update_cache=yes
|
||||||
|
|
||||||
- name: Install System Packages
|
- name: Install system packages
|
||||||
sudo: yes
|
sudo: yes
|
||||||
apt: pkg={{ item }} state=latest
|
apt: pkg={{ item }} state=latest
|
||||||
with_items:
|
with_items:
|
||||||
@ -11,15 +11,3 @@
|
|||||||
- wget
|
- wget
|
||||||
- python-software-properties
|
- python-software-properties
|
||||||
- git
|
- git
|
||||||
|
|
||||||
- name: Configure the timezone
|
|
||||||
sudo: yes
|
|
||||||
template: src=timezone.j2 dest=/etc/timezone
|
|
||||||
|
|
||||||
- name: Configure the timezone
|
|
||||||
sudo: yes
|
|
||||||
file: src=/usr/share/zoneinfo/{{ server.timezone }} dest=/etc/localtime state=link force=yes backup=yes
|
|
||||||
|
|
||||||
- name: Set default system language pack
|
|
||||||
shell: locale-gen {{ server.locale }}
|
|
||||||
sudo: yes
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{{ server.timezone }}
|
|
@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: all
|
|
||||||
|
|
||||||
become: true
|
|
||||||
become_method: sudo
|
|
||||||
|
|
||||||
vars_files:
|
|
||||||
- vars/all.yml
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- server
|
|
||||||
- nginx
|
|
@ -1,17 +1,30 @@
|
|||||||
---
|
---
|
||||||
server:
|
application_root: /vagrant
|
||||||
timezone: UTC
|
|
||||||
locale: en_US.UTF-8
|
|
||||||
|
|
||||||
site:
|
site:
|
||||||
www_dir: anwinged
|
www_dir: anwinged
|
||||||
domain: anwinged.ru
|
domain: anwinged.ru
|
||||||
|
conf_name: anwinged.conf
|
||||||
|
|
||||||
|
timezone: UTC
|
||||||
|
|
||||||
|
nginx_conf_name: 'anwinged.conf'
|
||||||
|
nginx_conf_root: '{{ application_root }}/output_dev'
|
||||||
|
nginx_conf_domain: 'anwinged'
|
||||||
|
|
||||||
|
nginx_remove_default_vhost: true
|
||||||
|
|
||||||
|
php_enable_webserver: false
|
||||||
|
php_packages:
|
||||||
|
- php7.1
|
||||||
|
- php7.1-mbstring
|
||||||
|
- php7.1-intl
|
||||||
|
- php7.1-curl
|
||||||
|
- php7.1-xml
|
||||||
|
|
||||||
# Vars for ansistrano
|
# Vars for ansistrano
|
||||||
|
|
||||||
ansistrano_deploy_from: "{{ playbook_dir }}/../web"
|
ansistrano_deploy_from: "{{ playbook_dir }}/../output_prod"
|
||||||
ansistrano_deploy_to: "/var/www/{{ site.www_dir }}"
|
ansistrano_deploy_to: "/var/www/{{ site.www_dir }}"
|
||||||
ansistrano_keep_releases: 3
|
ansistrano_keep_releases: 3
|
||||||
ansistrano_deploy_via: copy
|
ansistrano_deploy_via: copy
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user