Coder Social home page Coder Social logo

ansible-setup's Introduction

A simple ansible playbook for setting up a new server/VPS/raspberrypi

Feel free to look around. Maybe you'll find something useful :)

What this playbook does:

  1. Configures the system (see the system_conf role)

    • adds a new user whose name you can set in group_vars/all.yml
    • Gives the user sudo privileges (this assumes that /etc/sudoers exists on the target machine)
    • Adds an authorized public SSH key for the new user (path configurable in group_vars/all.yml)
    • Makes SSHD listen on a custom port (configurable in group_vars/all.yml)
    • Turns off SSH password authentication and disables root login for security reasons
  2. Sets up my personal work environment (see the personal_setup role)

Usage

  1. Store the password for your new user (defined in group_vars/all/vars.yml) in
    an ansible vault at group_vars/all/vault.
  • Open a new ansible vault and encrypt it with some password
ansible-vault create group_vars/all/vault
  • Add a variable called vault_password and set it to your desired password for the new user
vault_password = putyourpasswordhere
  1. Run the playbook
  • If you're using password authentication for the SSH connection and you don't have the password for the existing sudo user stored in a vault:
ansible-playbook -i your_hosts_file --ask-pass run.yml 
  • If you do have the existing sudo user password in an ansible-vault, add it in the hosts file as ansible_password and run:
ansible-playbook -i your_hosts_file run.yml 
  • If you're using pubkey authentication, specify the path of the key in your hosts file and run:
ansible-playbook -i your_hosts_file run.yml 

ansible-setup's People

Contributors

sz-hankus avatar

Watchers

 avatar

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.