Giter Site home page Giter Site logo

magnetizer-fabric's Introduction

Magnetizer

http://magnet-cl.github.io/magnetizer/

Description

At Magnet we use Magnetizer to quickly setup the terminal in local and remote Linux machines. The tasks included are listed in the available commands section.

Magnetizer uses python's Fabric tools to run tasks on remote (and local) machines. Since Fabric works over SSH, Magnetizer is configured to load the settings present in the ssh config file, for instance, hostname aliases.

Installation

Run ./install.sh.

Usage

You have a list of commands you can execute in your local machine or a remote one. To print the list of available tasks type:

fab -l.

Each task must be ran as follows:

fab <task>

You can get the description of a task with the -d parameter:

fab -d <task>

You need to specify the target machine, so it will ask you for the host in which you wish to run the task and assume your user is your current terminal user.

You can override this behaviour using the H parameter:

fab -H <user>@<host> <task>

You can also concatenate commands:

fab -H <user>@<host> <task1> <task2>

Examples

To get zsh installed and set as the default shell on your local machine, you should run:

fab -H <user>@localhost zsh.install

A concatenation example could be that you want that your current public key is accepted in your own computer (to speed up Magnetizer calls) and install vim configuration:

fab -H <user>@localhost ssh.add_authorized_key vim.install

Server initial configuration

In order to configure a new server (usually a VPS), you must run the following sequence of commands:

  1. Add <user> with sudo as extra group: fab admin.add_user:<user>,sudo -H root@host
  2. Allow sudoers without password: fab admin.sudo_without_password -H root@host
  3. Disable password authentication: fab ssh.disable_password_authentication -H root@host
  4. Disable root login: fab ssh.disable_root_login -H root@host
  5. Add your public ssh key to the authorized keys: fab ssh.add_authorized_key -H <user>@host (Please notice that this command must be run giving the user previously created).
  6. Reloads SSH configuration: fab ssh.reload_configuration root@host

Afterwards, we strongly recommend you to install zsh and vim through the tasks provided.

Available commands

* admin.add_user: Adds user, its group can also be specified.
* admin.add_swap: Adds a swap partition to the system.
* docker.install: Installs Docker.
* nginx.install_passenger: Installs nginx with passenger support.
* node.install: Installs Node.js.
* node.nvm_install: Installs Node.js with NVM.
* postgresql.install: Installs PostgreSQL and its development packages.
* ruby.install: Installs Ruby.
* ruby.install_rails: Installs Ruby on Rails.
* ruby.install_wirble: Improves irb console.
* ssh.add_authorized_key: Adds your local public key to the authorized
  keys.
* ssh.disable_password_authentication: Disables password authentication.
* ssh.disable_root_login: Disables root login authentication.
* ssh.generate_key: Generates public and private ssh keys.
* tmux.configure: Uploads the tmux configuration file.
* tmux.install: Installs and configure tmux.
* vim.install: Installs vim, fully configured fo maximum programmer
  efficiency.
* vim.restore_backup: Restores vim to a pre-magnetizer configuration if
  available.
* vim.update: Updates vim with the latest Magnetizer configuration.
* zsh.configure: Deploys the configuration file asking some preferences.
* zsh.install: Installs zsh, fully configured.
* zsh.update: Updates zsh with the latest Magnetizer configuration.

magnetizer-fabric's People

Contributors

ateston avatar bdfantini avatar crsepulveda avatar danielrc14 avatar gdieguez avatar imunizaga avatar jslopez avatar taandrighetti avatar wooo- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magnetizer-fabric's Issues

[error] when using postgresql.install

Installing PostgreSQL and its development packages.
[localhost] sudo: DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes postgresql-9.3
[localhost] out: sudo password:Leyendo lista de paquetes...
[localhost] out: Creando árbol de dependencias...
[localhost] out: Leyendo la información de estado...
[localhost] out: E: No se ha podido localizar el paquete postgresql-9.3
[localhost] out: E: No se pudo encontrar ningún paquete con la expresión regular «postgresql-9.3»
[localhost] out:

Fatal error: sudo() received nonzero return code 100 while executing!

Requested: DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes postgresql-9.3
Executed: sudo -S -p 'sudo password:' /bin/bash -l -c "DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes postgresql-9.3"

Sorry for spanish C:, using Ubuntu 12.04.4

Fatal error: run() received nonzero return code 100 while executing!

[localhost] run: DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes zsh-lovers
[localhost] out: stdin: is not a tty
[localhost] out: Reading package lists...
[localhost] out: Building dependency tree...
[localhost] out: Reading state information...
[localhost] out: E: Unable to locate package zsh-lovers
[localhost] out:


Fatal error: run() received nonzero return code 100 while executing!

Requested: DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes zsh-lovers
Executed: /bin/bash -l -c "DEBIAN_FRONTEND=noninteractive apt-get install --quiet --assume-yes zsh-lovers"

Aborting.
Disconnecting from localhost... done.

install.sh error in Debian Wheezy

run ./install.sh error:

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/vagrant/magnetizer/build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-ulEZUS-record/install-record.txt failed with error code 1 in /home/vagrant/magnetizer/build/pycrypto
Storing complete log in /root/.pip/pip.log
Traceback (most recent call last):
  File "/usr/local/bin/fab", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2707, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pycrypto>=2.1,!=2.4

solution:

sudo apt-get install python-dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.