| Branch | Build Status | Coding Style |
|---|---|---|
| master | ||
| develop |
This is a collection of Ansible roles and tasks to setup a Linux development machine.
Read my Machine Setup Guide for instructions.
- Ubuntu or Debian Linux
- Git installed
- Bash shell
- Ansible 2.8 or newer
- Python 3.7 or newer as required by Ansible
See markosamuli/macos-machine for my macOS setup.
This setup has been tested on the following Linux releases:
Older releases are only tested using Travis CI builds and might not be fully supported:
I've used this playbook to install packages on Ubuntu running on Windows Subsystem for Linux on Windows 10.
I'm currently running Ubuntu 20.04 LTS on WSL2 and will not be testing any future configuration on WSL1.
Some packages are known not to work so I've added custom fact is_wsl
that can be used to check if we're running Linux on Windows and these
will be skipped during the set up.
I'm no longer using or testing the playbooks on Pengwin Linux since I've upgraded to WSL2 and Ubuntu 20.04 LTS and Debian buster on my Windows 10 environment.
Install Git and curl:
sudo apt update
sudo apt install curl gitYou can run the installer script that will clone the code from GitHub and run
the setup script.
curl -s https://raw.githubusercontent.com/markosamuli/linux-machine/master/install.sh | bash -Clone this project locally and run the ./setup script.
git clone https://github.com/markosamuli/linux-machine
cd linux-machine
./setupYou can pass custom variables to the Ansible playbook and roles by creating
a machine.yaml file to customise your configuration.
cp machine.yaml.example machine.yamlYou can also use my customizations:
ln -s machine.msk.yaml machine.yamlThe setup script will detect if this file exists and passes it to the
Ansible Playbook with --extra-vars.
The setup script will try to install Ansible
Ansible version 2.9 is installed by default.
You can define MACHINE_ANSIBLE_VERSION environment variable to change
the installed version.
Example to use Ansible 2.8 instead of Ansible 2.9:
export MACHINE_ANSIBLE_VERSION=2.8To remove existing Ansible versions and force installation of Ansible, you
can use the --reinstall-ansible argument, for example:
./setup --reinstall-ansibleThe setup script will install Ansible using APT from
Ansible PPAs if the ansible command is not found on your
system.
Ubuntu 20.04 LTS will not use Ansible PPAs as the builds for this release are missing.
| Version | PPA |
|---|---|
2.8 |
ansible/ansible-2.8 |
2.9 (default) |
ansible/ansible-2.9 |
If an acceptable Ansible APT package installation candidate can't be found the setup script will try to install Ansible with pip in a local virtuelenv.
If virtuelenv can't be found the setup script the setup will fail.
You can disable installation from PyPI with --disable-ansible-pypi argument,
for example:
./setup --disable-ansible-pypiIf the user has set up a local development environment with pyenv and this is
defined in a .python-version file in the repository root, the setup script
will install Ansible into this environment.
Same as with the local virtualenv, you can disable installation from PyPI
with --disable-ansible-pypi argument, for example:
./setup --disable-ansible-pypiZsh is installed by default. You can disable this in the configuration:
install_zsh: falseHomebrew can be installed on Linux by enabled the following option:
install_linuxbrew: trueTo enable and install:
make install-linuxbrewInstallation will be done using markosamuli.linuxbrew Ansible role.
Installed on all non-WSL environments:
Installed on all non-WSL environments:
- Meld, a visual diff and merge tool
To install Slack desktop application via Snap package:
install_slack: trueInstalled on non-WSL environments:
To enable and install:
make install-productivityTo disable:
install_productivity: falseAntivirus software can be installed:
To enable and install:
make install-antivirusTo enable manually:
install_antivirus: trueSecurity tools that can be installed:
- Lynis security tool
To enable and run the security playbook:
make install-securityTo enable manually:
install_security: trueInstall optional security hardening tools:
- passwdqc for password/passphrase strength checking and enforcement
- USBGuard for protecting system against rogue USB devices
- debsums tool for verification of installed package files against MD5 checksums
To enable and run the security hardening playbook:
make install-security-hardeningTo enable manually:
install_security_hardening: trueInstall optional system monitoring tools:
- GNU Accounting utilities for process and login accounting
- sysstat - Performance monitoring tools for Linux
To enable and run the monitoring playbook:
make install-monitoringTo enable manually:
install_monitoring: true- GNU Wget
- curl
- jq command-line JSON processor
- The Silver Searcher (
agcommand) code searching utility similar toack - htop process viewer for console
- pass — the standard unix password manager
- ShellCheck, a static analysis tool for shell scripts
Run the tools playbook:
make install-toolsVisual Studio Code will be installed on non-WSL environments via Snap package.
See Developing on WSL for instructions how to install and use Visual Studio Code Remote - WSL extension.
Latest version of Vim will be installed using the package manager.
To install Neovim enable it in machine.yaml:
install_neovim: trueYou can install asdf version manager by adding the following
option to your machine.yaml:
install_asdf: trueTo configure asdf plugins and package versions to install, add them
into your machine.yaml configuration.
asdf_plugins:
- name: kubectl
- name: concourseUse Ubuntu/Debian packages to install Python on the system:
- Python with
python3package — installed Python version will depend on the OS release version - pip with
python3-pippackage - [virtualenv] from PyPI
Use pyenv to install and manage Python versions for the current user:
- pyenv
- pyenv-virtualenv
- Python 3.7 and 3.8 installed with pyenv
Run Python playbook:
make install-pythonYou can disable installation by adding the following option to
your machine.yaml:
install_python: falseThe markosamuli.pyenv role will modify your .bashrc and .zshrc files
during the setup. If you want to disable this, edit machine.yaml file
and disable the following configuration option.
pyenv_init_shell: falseTo install Ruby for development, enable it in your machine.yaml configuration:
install_ruby: trueThis will install:
- rbenv using zzet.rbenv role
- Ruby version 2.6.3 with rbenv
Run Ruby playbook:
make install-rubyTo change the installed rubies and default version, add the following to your
machine.yaml file and customize it to your needs:
rbenv:
env: user
version: v1.1.2
default_ruby: 2.6.3
rubies:
- version: 2.6.3The role doesn't update your .bashrc or .zshrc files but adds a global
initialization script in /etc/profile.d/rbenv.sh. If this doesn't work on
your environment, add something like below to initialize rbenv in your shell:
if [ -z "${RBENV_ROOT}" ]; then
if [ -d "$HOME/.rbenv" ]; then
export PATH=$HOME/.rbenv/bin:$PATH;
export RBENV_ROOT=$HOME/.rbenv;
eval "$(rbenv init -)";
fi
fiInstall Rust programming language with markosamuli.rust role.
Enable with:
install_rust: trueTo avoid modifying path during install:
rust_modify_path: falseRun Rust playbook:
make install-rustTo uninstall Rust, run:
rustup self uninstall- Node Version Manager
- Node.js LTS installed with NMV
Run Node.js playbook:
make install-nodeYou can disable installation by adding the following option to
your machine.yaml:
install_nodejs: falseGo programming language installed using markosamuli.golang Ansible role.
Run Go playbook:
make install-golangYou can disable installation by adding the following option to
your machine.yaml:
install_golang: falseGo tools installed for development:
- golint is a linter for Go source code
- goimports is a tool for updating your Go import lines
- errcheck is a program for checking for unchecked errors in go programs
- go-callvis is a development tool to help visualize call graph of a Go program using interactive view
- gopkgs is a tool that provides list of available Go packages that can be imported
- Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface
- guru is a tool for answering questions about Go source code
- staticcheck is a linter for Go source code
You can install Lua programming language by adding the following option
to your machine.yaml file:
install_lua: trueRun Lua playbook:
make install-luaThis will also install LuaRocks package manager and luacheck rock using the custom luarocks module.
Latest version of Git will be installed.
Vagrant and VirtualBox are no longer installed by default, but you can enable them by adding:
install_vagrant: trueDocker will be installed by default.
Run Docker playbook:
make install-dockerTo disable installation, add:
install_docker: falseTo install Packer add:
install_packer: trueTerraform is installed using tfenv Terraform version manager.
Run Terraform playbook:
make install-terraformDisable Terraform installation with:
install_terraform: false- AWS CLI
- aws-shell - interactive shell for AWS CLI
- AWS Vault - a vault for securely storing and accessing AWS credentials in development environments
- cli53 - command line tool for Amazon Route 53
You can disable installation by adding the following option to
your machine.yaml:
install_aws: falseGoogle Cloud SDK installed from the archive file under user home directory.
Run Google Cloud SDK playbook:
make install-gcloudDefault install path is in ~/google-cloud-sdk, but you can
install it to another location, for example if you prefer
~/opt/google-cloud-sdk add the following option:
gcloud_install_path: ~/optTo prefer python3 over python2 during Google Cloud SDK install:
gcloud_prefer_python3: trueThe markosamuli.gcloud role will modify your .bashrc and .zshrc files.
To disable this and manage the configuration yourself, disable the following
configuration option in the machine.yaml file:
gcloud_setup_shell: falseYou can disable installation by adding the following option to
your machine.yaml:
install_gcloud: falseIf you prefer to install Google Cloud SDK using package manager, enable it in
the machine.yaml configuration file:
gcloud_install_from_package_manager: trueThe installer makes changes to your ~/.bashrc and ~/.zshrc files, so take
backup copies of them before running the script.
The following external Ansible roles are installed and used. See requirements.yml file for the installed versions.
To install roles:
make install-rolesTo update roles to the latest release versions:
make update-rolesTo remove any outdated roles:
make clean-rolesYou should have Python 3.7 or newer installed for the development tools and pre-commit hooks to work.
Install development environment, including Git pre-commit hooks:
make setup-devLint code and configuration:
make lintThis is based on my previous setup markosamuli/machine that was forked off from caarlos0/machine to suit my needs.