I suggest you use the Ansible. It’s 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 an important difference, and the reason why you better use Ansible, is that this is idempotent: if you have an Ansible script that installs, for example, the git
on your server, and you run this script 8 times, the git
will only be installed the first time. The next 7 times Ansible checks that the git
is already installed, and it makes no sense to try to install it again. While if you ran a simple shell script to install the git
, it would give error and, depending on the case, could even compromise your server.
Ansible is a mature tool, widely used and with several options, so recommend you find a tutorial to your liking on, or else own documentation. Recommend this tutorial.
Below follows a small step-by-step to install only the git
on a server. I will not put the full form to install all your programs because that would be monstrous (for the answer and for me :)) and because several of these tools have small details that you should set up in the installation.
Very basic tutorial of Ansible
First important point: you don’t need install Ansible on your server (which you want to configure), only on some other machine (it may be your computer at home) 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 file /etc/ansible/hosts
to contain the IP(s) of the server(s) you want to configure (may 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 the sible. The playbook
is a file in format YAML, and must be saved with the extension .yml
. Example of a playbook
installing the program git
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 must run the module apt
, which must install the program git
, and the final result of the execution is expected to be the git
installed (state=installed
).
And to execute that playbook
, in the type terminal:
$ 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 be executed as sudo
;
-k
indicates that you want to pass the password to log via SSH on the server;
-u USUARIO
indicates that Ansible must log as USUARIO
on the server (if you do not pass this Ansible parameter you will use the same user as your local machine, which is not always the same as the server);
--ask-become-pass
indicates that you want to enter the password sudo
from the server, so that Ansible can execute, in this example, the command sudo apt-get git
;
ARQUIVO.yml
indicates your file playbook
.
You have a system that is developed that wants every new version to be published automatically in this environment, that’s it?
– Intruso
Who does the publishing is Jenkins, I wanted to install all this through a script or if you know some hosting that facilitates an efficient deployment of the application
– Rodrigo Rodrigues
Amazon, take a look here http://answall.com/questions/63042/como-automatizar-o-processo-de-deploy/63051#63051
– Isvaldo Fernandes