ptavares / ansible-ubuntu

Personal Ansible project to setup my :computer:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ansible-ubuntu

Build GitHub

This project contains my personal Ansible playbooks to setup my Ubunty 💻

Prerequisite

Ansible must be installed

Standard installation

From apt

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

From pip

sudo apt-get install -y make curl software-properties-common apt-utils python3-setuptools python3-apt python3-pip && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py &&\
    python3 get-pip.py  &&\
    pip install ansible &&\
    rm -rf get-pip.py

Makefile installation

git clone https://github.com/ptavares/ansible-ubuntu.git &&\
cd ansible-ubuntu &&\
make bootstrap

Test with Docker

Build the Docker image

git clone https://github.com/ptavares/ansible-ubuntu.git &&\
cd ansible-ubuntu &&\
make build-docker-image

Start the container with code inside:

docker run --rm -it ansible-ubuntu:test bash

Start the container with volume, so you can change the code directly:

docker run --rm -it -v "$PWD":/home/ubuntu/app/ ansible-ubuntu:test bash

Usage

All ansible playbooks calls are available from a Makefile target :

=============================================================
               _ _    _              _             _
  __ _ _ _  __(_) |__| |___ ___ _  _| |__ _  _ _ _| |_ _  _
 / _` | ' \(_-< | '_ \ / -_)___| || | '_ \ || | ' \  _| || |
 \__,_|_||_/__/_|_.__/_\___|    \_,_|_.__/\_,_|_||_\__|\_,_|
=============================================================
Usage :
        make [target] [arg1=val1] [arg2=val2]...

         ############## Setup ##############

bootstrap:                Installs dependencies needed to run ansible playbooks

install-roles:            Install ansible role dependencies
                          Usage            : make install-roles [requirements=requirement.yml] [F=1]
                          Available args   :
                            - requirements : specify custom requirements file, default set to $(DEFAULT_REQUIREMENTS)
                            - F            : set F=1 to force download if role already exist

         ############## Installation ##############

manage-system:            Call ansible manage-system playbook

vscode:                   Call ansible vscode playbook

kubectl:                  Call ansible kubectl playbook

docker:                   Call ansible docker playbook

fonts:                    Call ansible fonts playbook

gnome-shell-extension:    Call ansible gnome-shell-extension playbook

vim:                      Call ansible vim playbook

tmux:                     Call ansible tmux playbook

zsh:                      Call ansible zsh playbook

appimages:                Call ansible appimages playbook

         ############## Updates ##############

update-zsh-config:        Call ansible zsh playbook with tags="zsh-install-compose"

update-manage-system:     Call ansible manage-system playbook with tags="manage-system-update, manage-system-clean"

update-docker-compose:    Call ansible docker playbook with tags="docker-install-compose"

         ############## Test ##############

bootstrap-check:          Check that PATH and requirements are correct

build-docker-image:       Build Docker images to test ansible playbooks

         ############## Clean ##############

clean:                    Clean directory


         ############## Help ##############

precommit:                run precommit on all files

run-playbook:             Usage                : make run-playbook playbook=<playbook> tags=<tags> limits=<limits> args=<args>
                          Required args :
                            - playbook         : playbook to run
                          Available args:
                            - tags             : Specify a list of tags for your ansible run
                            - limits           : Limit the command to a subset of hosts with ansible's limit argument
                            - args             : Add ansible understandable arguments

list-playbooks:           List Playbooks

help                      Show this help


With default variables:
-----------------------
▶  DEFAULT_REQUIREMENTS = requirements/requirements_ansible.yml
▶  PLAYBOOK_DIR         = playbooks

Detailed Ansible roles

List playbooks

> make list-playbooks

playbooks/vim.yml
playbooks/fonts.yml
playbooks/manage-system.yml
playbooks/docker.yml
playbooks/install-all.yml
playbooks/zsh.yml
playbooks/kubectl.yml
playbooks/vscode.yml
playbooks/appimages.yml
playbooks/gnome-extension.yml
playbooks/tmux.yml

docker playbook

Will install docker and docker-compose.

fonts playbook

Will clone nerd-fonts into your ${HOME}/tools directory.

  • Dependencies

  • Local configuration file

    • none
  • Makefile target

    • After cloning nerd-fonts, run installation of this fonts :

      • JetBrainsMono
      • Mononoki
      • DroidSansMono
      • ProFont
      • UbuntuMono
      • SourceCodePro
      • RobotoMono
      make fonts

kubectl playbook

Will install kubectl CLI

tmux playbook

Will install tmux and tmuxinator with my custom tmux configuration files if wanted.

tmux configuration file is based on this one and needs extra plugins :

vim playbook

Will install vim with my custom vim configuration file if wanted.

  • Dependencies

  • Local configuration file

  • Makefile targets

    make vim
    # Makefle target will call this command line :
    # > vim +PlugInstall +qall

vim configuration will install molokai color theme and my custom plugins from vim bootstrap

vscode playbook

Will install vscode and some plugins (see configuration file for details)

zsh playbook

Will install zsh with oh-my-zsh and some useful plugins (see configuration file for details)

manage-system playbook

Will manage system updates and package/deb install/remove.

gnome-extension playbook

Will download and install some usefull gnome-shell-extension using gnome-shell-extension-installer.

AppImages playbook

Will download and install AppImages.

About

Personal Ansible project to setup my :computer:

License:MIT License


Languages

Language:Vim Script 51.9%Language:Makefile 32.7%Language:Shell 12.4%Language:Dockerfile 3.0%