This repository has several ansible roles and playbooks that can be used to configure Ubuntu as a Workstation.
Read the pre-commit hooks document for more info.
Read the git-chglog document for more info.
If you just want to run the playbooks on this repo you just need to install ansible and configure it to use
on the remote hosts you want to.
Check this link for more info on how
to install ansible.
List of playbooks available:
| playbook | description |
|---|---|
| base_utils.yml | Install base utilities and pip packages |
| cloud_tools.yml | Install Azure, AWS and GCP(*) CLI tools |
| collab_tools.yml | Collaboration tools |
| dev_tools.yml | Development tools |
| i3wm.yml | Install i3 Window Manager |
| kube_tools.yml | Kubernetes administration tools |
| terraform_tools.yml | Terraform tools for linting and compliance |
(*) not yet implemented
NOTE: Before running the playbooks ensure that your inventory is configured.
run the playbooks:
ansible-playbook <playbook.yml>to run the i3wm.yml playbook on localhost execute:
ansible-playbook -i localhost, i3wm.ymlThis repository should be used from a Python Virtual Environment.
Make sure versions are up-to-date and install git and ssh server:
sudo apt update
sudo apt -y upgradeCheck Python version:
python3 -VInstall essential tools for the development environment:
sudo apt install -y python3-pip build-essential libssl-dev libffi-dev python3-dev python3-venv git sshCreate the Virtual Environment:
git clone https://github.com/bcochofel/ansible-ubuntuwst-roles.git
cd ansible-ubuntuwst-roles
python3 -m venv .venvActivate the environment:
source .venv/bin/activateInstall requirements.txt:
pip install --upgrade setuptools wheel pip
pip install -r requirements.txtInstall community.general collection for Ansible:
ansible-galaxy collection install community.generalYou now have python virtual environment with all the dependencies installed and can start deploying the ansible roles.
You should have ssh installed and running.
Create SSH key:
ssh-keygen -t rsaand add the public key to ~/.ssh/authorized_keys:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keysEnsure sudo passwordless for the ansible user by creating a file
/etc/sudoers.d/bcochofel with the following contents:
bcochofel ALL=(ALL) NOPASSWD: ALLand that the file permissions are 0440.
If you don't want to use the requirements.txt file you can install both ansible and molecule using the following commands:
python3 -m pip install wheel pytest testinfra flake8 pytest-testinfra pytest-flake8 cookiecutter
python3 -m pip install "molecule[ansible,lint,docker]"
# for snap module
ansible-galaxy collection install community.generalgenerate requirements.txt file using the following command:
pip freeze > requirements.txtYou can use custom cookiecutter templates with some pre-defined tasks or variables.
You can use this repo for reference.
Go to the roles folder and execute the following commands:
cd roles/
cookiecutter gh:bcochofel/molecule-cookiecutteranswer the on-screen questions.
To use the default template execute the following commands:
cd roles/
molecule init role -d docker <role-name>- -d: docker driver
Change to the role folder.
molecule createmolecule listmolecule convergemolecule loginmolecule verifymolecule lintmolecule destroymolecule test