Skip to content

Instantly share code, notes, and snippets.

Avatar

Gustavo Muniz do Carmo gustavomcarmo

View GitHub Profile
@gustavomcarmo
gustavomcarmo / docker-compose.yml
Last active Nov 6, 2019
NGINX + WordPress + MySQL Docker Compose
View docker-compose.yml
version: '3'
services:
mysql:
image: mariadb:10.3.12
container_name: mysql
restart: always
volumes:
- mysql_data:/var/lib/mysql
environment:
@gustavomcarmo
gustavomcarmo / find-latest-ubuntu-bionic-ami.yml
Created Dec 11, 2018
Ansible playbook to find the latest Ubuntu 18.04 LTS (bionic) AMI in AWS.
View find-latest-ubuntu-bionic-ami.yml
---
- hosts: localhost
gather_facts: no
vars:
aws_region: "eu-west-2"
tasks:
- name: Find Ubuntu Server 18.04 LTS AMIs
ec2_ami_facts:
region: '{{ aws_region }}'
owners: 099720109477
@gustavomcarmo
gustavomcarmo / docker-volumes-backup.yml
Created Sep 13, 2018
Ansible playbook to backup all Docker volumes in a remote host and then upload the backup file to a raw Nexus repository.
View docker-volumes-backup.yml
---
- hosts: remote
gather_facts: no
tasks:
- name: Make the volumes backup
archive:
path: /var/lib/docker/volumes
dest: volumes.tar.gz
- name: Make the backup available (requires vault-password-file)
uri:
@gustavomcarmo
gustavomcarmo / test_ldap_entry.sh
Last active Sep 29, 2020
LDAP Ansible modules integration tests
View test_ldap_entry.sh
#!/bin/bash
docker run --name openldap -d -p 389:389 osixia/openldap:1.2.1
if [ $? -ne 0 ]; then
echo "Error on running the OpenLDAP Docker image."
exit 1
fi
until ldapsearch -x -b dc=example,dc=org -D cn=admin,dc=example,dc=org -w admin | grep "dn: dc=example,dc=org"
do
@gustavomcarmo
gustavomcarmo / Dockerfile
Created Jul 25, 2018
Example of Ansible playbook for building a custom Jenkins Docker image and running it in a remote host.
View Dockerfile
FROM jenkins/jenkins:lts
LABEL maintainer "Gustavo Muniz do Carmo <gustavo@esign.com.br>"
ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false"
COPY config-maven.groovy /usr/share/jenkins/ref/init.groovy.d/
COPY config-sonarqube.groovy /usr/share/jenkins/ref/init.groovy.d/
COPY harden-jenkins.groovy /usr/share/jenkins/ref/init.groovy.d/
COPY default-user.groovy /usr/share/jenkins/ref/init.groovy.d/
@gustavomcarmo
gustavomcarmo / configure-zabbix.yml
Created Jul 25, 2018
Example of Ansible playbook for installing and configuring the Zabbix agent in a host and then creating the host in a Zabbix server.
View configure-zabbix.yml
---
- name: Install the Zabbix agent
yum:
name: http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.8-1.el7.x86_64.rpm
- name: Configure the Zabbix agent
replace:
path: /etc/zabbix/zabbix_agentd.conf
regexp: '{{item.regexp}}'
replace: '{{item.replace}}'
with_items:
@gustavomcarmo
gustavomcarmo / configPhpMaxSize.sh
Created Jul 18, 2018
Shell script to define the post_max_size and the upload_max_filesize values in the php.ini file.
View configPhpMaxSize.sh
#!/bin/bash
if [ $# -ne 1 ]; then
echo "One parameter expected:"
echo "- the new size limit (in Mb)"
exit 1
fi
SIZE_IN_MB=$1
if [[ ! $SIZE_IN_MB =~ ^[0-9]+$ || $SIZE_IN_MB -eq 0 ]]; then
@gustavomcarmo
gustavomcarmo / playbook-docker-compose-moodle.yml
Created Jul 6, 2018
Just an example of Ansible playbook that runs docker-compose and then waits the MySQL container until it becomes ready. Tested on Ubuntu 18.04 LTS (Bionic Beaver).
View playbook-docker-compose-moodle.yml
---
- hosts: moodle
gather_facts: no
become: yes
tasks:
- name: Install required packages
apt:
name: "{{item}}"
update_cache: yes
View .travis.yml
language: java
sudo: required
install: true
services:
- docker
addons:
sonarcloud:
organization: "gustavomcarmo-github"
@gustavomcarmo
gustavomcarmo / SeleniumUtils.java
Created Jul 3, 2018
Simple Selenium utilitary Java class with a method for waiting a DOM element to be interactable and a method to click an element through Javascript.
View SeleniumUtils.java
package br.com.esign.selenium.utils;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
/**
* Selenium utilitary class