Creation of deploy environment with linux Ubuntu

1

I'm testing a Digital Ocean machine, it comes with Ubuntu Linux (I chose), I need to create the following environment

Firewall    
Java
Tomcat7
Jenkins
git
MySQL
MySqlAdmin
Groovy
Gradle

Well, as you can see, I need a complete environment to deploy, I ask, do you have a "package" that already installs all this?

I would like to create a "script" that I run and it will configure the system to suit this environment, I already did a lot of installation but wanted to know if I have a script that I run in linux for myself not having to need it in the future, getting everything installed manual.

In short, I want to automate the environment setup process to deploy in Ubuntu Linux.

I was testing Openshift, in it I do not need to configure anything, but I'm having difficulty making the gradle compile the groovy, it's giving permissions errors, their firewall is blocking, it's complicated.

If there were also some solution already ready to host in a simple way that had all this would be legal

    
asked by anonymous 02.03.2015 / 16:37

1 answer

0

I suggest you use Ansible . This is exactly what you need, a configuration tool that allows you to configure your servers.

In a simplistic view, Ansible is practically a shell script with its installation and configuration commands, but one important difference, and the reason you should use Ansible, is that it is idempotent : If you have an Ansible script that installs, for example, git on your server, and you run this script 8 times, git will only be installed the first time. In the next 7 times Ansible verifies that git is already installed, and that it does not make sense to try to install it again. While if you ran a simple shell script to install git , it would give error and, depending on the case, could even compromise your server.

Ansible is a mature, widely used tool with several options, so I recommend you find a tutorial to your liking on, or else the documentation . I recommend this tutorial .

Below is a short walkthrough to install only git on a server. I will not put the complete way to install all your programs because this would be monstrous (for the answer and for me :)) and because several of these tools have small details that you should configure in the installation.

Very basic Ansible tutorial

First important point: you do not need to install Ansible on your server (which you want to configure), only on some other machine (it can be your home computer) that has access via SSH , to the server to be configured.

Install Ansible on your machine (I'm assuming it's Ubuntu):

sudo apt-add-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible

Edit the /etc/ansible/hosts file to contain the IP of the server (s) you want to configure (it can be more than one):

[web]
192.168.22.10
192.168.22.11

Create a playbook , which is the collection of commands to be executed by ansible. playbook is a file in YAML format, and should be saved with the .yml extension. Example of a playbook that installs the git program on Ubuntu servers:

- hosts: all
  tasks:
    - name: Instalando git
      apt: pkg=git state=installed update_cache=true

apt: pkg=git state=installed update_cache=true indicates that Ansible should execute the apt module, which should install the git program, and the final execution result is expected to be git installed ( state=installed ). / p>

And to execute this playbook , on the terminal type:

$ ansible-playbook -s -k -u USUARIO --ask-become-pass ARQUIVO.yml
  • ansible-playbook is the Ansible command to execute the commands of a plabook ;

  • -s indicates that you want the commands to be executed on the server to run as sudo ;

  • % indicates that you want to pass the password to log in via SSH on the server;

  • % indicates that Ansible should log in as -k on the server (if you do not pass this parameter Ansible will use the same user as your local machine, which is not always the same as the server) / p>
  • -u USUARIO indicates that you want to enter the USUARIO server password, so that Ansible can execute, in this example, the --ask-become-pass command
  • sudo indicates your sudo apt-get git file.

26.02.2016 / 19:31