Skip to content

Instantly share code, notes, and snippets.

@shamoya
Last active March 7, 2021 15:03
Show Gist options
  • Save shamoya/472e8b3690288e0d94ed487dc105d37d to your computer and use it in GitHub Desktop.
Save shamoya/472e8b3690288e0d94ed487dc105d37d to your computer and use it in GitHub Desktop.
---
# ubuntu-personal-devel-ramp-up.yml
# Author: shamoya
#
# My way to ramp-up and eth2 validator on a fresh install of ubuntu 20.04
# Only prerequisites are: ansible (2.9) and python3-apt.
# It uses ansible to do all the magic on the localhost only (can be expended to remote easily though).
# I prefered simple all-in-one ansible playbook so I can manage it with gist.
# command to run: ansible-playbook -K ubuntu-personal-devel-ramp-up.yml
#
- hosts: localhost
become: yes
tasks:
- name: Install basic tools (git, pip, vim, virtualenv, etc..)
apt:
name: ['git', 'python3-pip', 'python3-venv', 'vim', 'snapd']
state: present
update_cache: yes
- name: Ensure group docker exists
group:
name: docker
state: present
- name: Install docker
snap:
name: docker
classic: yes
- name: add user to docker group
user:
name: '{{ ansible_user }}'
groups: docker
append: yes
- name: Install xrdp
apt:
name: xrdp
state: present
update_cache: yes
- name: Add xrdp user to ssl-certs
user:
name: xrdp
groups: ssl-cert
append: yes
- name: Restart xrdp service
service:
name: xrdp
state: restarted
# Git section
- hosts: localhost
vars_prompt:
- name: git_name
prompt: "What is your git Name?"
private: no
- name: git_mail
prompt: "What is your git Email"
private: no
tasks:
- name: Configure git name
git_config:
name: user.name
scope: global
value: '{{ git_name }}'
- name: Configure git email
git_config:
name: user.email
scope: global
value: '{{ git_mail}}'
- name: Configure git alias co
git_config:
name: alias.co
scope: global
value: checkout
- name: Configure git alias st
git_config:
name: alias.st
scope: global
value: status
- name: Configure git alias slog
git_config:
name: alias.slog
scope: global
value: log --oneline --decorate --color
- name: Vim as default editor
git_config:
name: core.editor
scope: global
value: vim
# Github secion
- hosts: localhost
vars_prompt:
- name: github_username
prompt: "What is your github username?"
private: no
- name: github_password
prompt: "What is your github password"
private: yes
tasks:
- name: Get user homedir
local_action: command echo ~
register: homedir
- name: Github credentials netrc file
copy:
dest: "{{ homedir.stdout }}/.netrc"
owner: "{{ ansible_user }}"
mode: '0600'
content: |
machine github.com
login {{ github_username }}
password {{ github_password }}
machine gist.github.com
login {{ github_username }}
password {{ github_password }}
# User section
- hosts: localhost
tasks:
- name: set tab == 4 spaces in vim
lineinfile:
path: ~/.vimrc
create: true
insertbefore: BOF
line: "set expandtab ts=4"
- name: chage ll without hidden files
lineinfile:
path: ~/.bashrc
regexp: '^ll='
line: alias ll='ls -lF'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment