Skip to content

Instantly share code, notes, and snippets.

View mschirbel's full-sized avatar

Marcelo Schirbel Gomes mschirbel

View GitHub Profile
@mschirbel
mschirbel / Vagrantfile
Created January 23, 2019 13:21
vagrant file for ansible
Vagrant.configure("2") do |config|
servers=[
{
:hostname => "database",
:box => "centos/7",
:ip => "192.168.56.101",
:ssh_port => '2210'
},
{
:hostname => "webserver-1",
@mschirbel
mschirbel / hosts
Created January 23, 2019 13:25
hosts for ansible lab
[database]
192.168.56.101
[webservers]
192.168.56.102
192.168.56.103
[loadbalancer]
192.168.56.104
@mschirbel
mschirbel / ansible-mysql-download-mysql
Created January 26, 2019 03:43
ansible tasks for downloading mysql
---
- hosts: database
become: true
tasks:
- name: install tools
apt: name={{item}} state=present
with_items:
- python-mysqldb
tags: [ 'packages' ]
@mschirbel
mschirbel / ansible-mysql-db+user
Created January 26, 2019 03:46
ansible how to create user and db
- name: Create a new database with name 'laravel'
mysql_db:
name: laravel
state: present
- name: create laravel user
mysql_user:
name: laravel
password: laravel
priv: '*.*:ALL'
@mschirbel
mschirbel / ansible-apache-packages-aravel
Created January 26, 2019 03:50
ansible-apache-packages-aravel
- hosts: webservers
become: true
tasks:
- name: install packages for laravel
apt: name={{ item }} update_cache=yes state=latest
with_items:
- php7.2
- libapache2-mod-php7.2
- php7.2-mbstring
@mschirbel
mschirbel / composer-cloneapp
Created January 26, 2019 04:06
composer-cloneapp
- name: download composer and install on path
shell: curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
args:
warn: no
- name: clone the app
git:
repo: https://github.com/gothinkster/laravel-realworld-example-app.git
dest: /var/www/html/
clone: yes
update: yes
@mschirbel
mschirbel / laravel-.env-file
Created January 26, 2019 04:08
laravel-env
APP_NAME=Laravel
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=192.168.56.101
DB_PORT=3306
- name: config on env
copy:
src: .env
dest: /var/www/html/
owner: root
group: root
mode: 0755
- name: resolving permission issues on laravel directory
file:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/MyProject/public
ServerName www.example-schirbel.com
<Directory /var/www/html/MyProject/public>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>