Skip to content

elhub/devxp-ansible-collection-wsl

Repository files navigation

devxp-ansible-collection-wsl

[](<https://github.com/elhub/devxp-ansible-collection-wsl) [](https://teamcity.elhub.cloud/buildConfiguration/)

Table of Contents

Breaking changes for Ubuntu 24.04 and devxp-wsl

Warning

This collection has gotten some breaking changes due to the move from Ubuntu 22.04 to Ubuntu 24.04 and devxp-linux/plat-intune-wsl to devxp-wsl. If you are on Ubuntu 22.04, use the ubuntu22 branch.

About

This ansible collection comprises resources that facilitate an opinionated setup of the Linux/WSL components for a a Windows developer workstation at Elhub.

The ansible collection contains:

  • The base role. This bootstraps core packages, creates base directories, and sets up ssh-agent
  • Roles for setting up common tools such as git, docker, molecule
  • Roles for setting up development environments for different programming languages/purposes such as ansible, java, and kotlin, and node/javascript, and python.
  • Roles for setting up scripts and apps used by the development team such as git utils, and adr.

Getting Started

Prerequisites

Requires:

  • WSL2 with the Ubuntu linux distribution.
  • Ansible installed in the linux installation

Installation

To install the collection from git, use the following in your requirements.yml

---
collections:
   - name: [email protected]:elhub/devxp-ansible-collection-wsl.git
     type: git
     version: main

You can also install manually by using the following ansible-galaxy command

ansible-galaxy collection install git+https://github.com/elhub/devxp-ansible-collection-wsl

Usage

From ansible playbooks

The roles in this playbook are shared by the ansible playbooks used to set up the developer PC's; see e.g., devxp-linux.

The base role is used to bootstrap the environment for the other roles.

  • base role: See the documentation here

For details and examples for the other individual roles:

  • adr role: See the documentation here
  • ansible role: See the documentation here
  • docker role: See the documentation here
  • git role: See the documentation here
  • git_utils role: See the documentation here
  • java role: See the documentation here
  • kotlin role: See the documentation here
  • molecule role: See the documentation here
  • node role: See the documentation here
  • python role: See the documentation here
  • mise role: See documentation here

From command line

Install the collection using the instructions above. You can run the roles from the command line using the following command. Replace elhub.wsl.restish with the role you want to run.

ansible -m import_role -e "{ 'ansible_env' : { 'HOME' : '$HOME' }}" -a name=elhub.wsl.restish localhost

If the role requires sudo/root, add --ask-become-pass to the command.

Testing

Molecule

The roles can be tested using molecule. Ensure you have python, ansible, docker, and molecule installed (the roles in this collection should ensure that your environment is set up correctly) and a docker backend running. Then change to the role you wish to validate and run:

molecule test

Testing with Docker

While molecule is great for "unit testing", it can be desirable to test new things in a 'test environment', before adding these roles to a playbook that sets up your main workstation. For this we build a minimal Docker image which can then used to create container and validate things work as expected.

To build the image run: docker build -f test/Dockerfile -t wsl-test:latest .

You might want to install only certain roles from this collection, or maybe set some specific vars for any given role. In this case modify the test.yml accordingly before building the image.

Then you can ssh into the container with docker run -it wsl-test:latest and test things out before you install them on your main system.

Contributing

Contributing, issues and feature requests are welcome. See the Contributing file.

Owners

This project is developed by Elhub. For the specific development group responsible for this code, see the Codeowners file.

License

This project is MIT licensed.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published