📗 Docs

Automating with Ansible

date
Mar 28, 2023
slug
ansible-basics
author
status
Public
tags
Open Source
Admin
Daily
Docs
summary
How to use Ansible, an open-source automation tool, to automate the installation of favourite applications on a new PC. By creating an Ansible playbook, users can easily install a list of preferred apps on a Windows PC with just a few commands. The post provides a sample playbook and emphasizes the time and effort-saving benefits of using Ansible to streamline workflows.
type
Post
thumbnail
https://res.cloudinary.com/practicaldev/image/fetch/s--BkF-uzLS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npb90i8qo6yknbw4mpxv.png
category
📗 Docs
updatedAt
Mar 28, 2023 11:30 PM

Automating Favourite Apps on a New PC using Ansible

Setting up a new PC can be a time-consuming process, especially when it comes to installing all of your favourite applications. However, with automation tools like Ansible, you can easily install all of your preferred apps with just a few commands. In this blog post, we will explore how to use Ansible to automate the installation of your favourite apps on a new PC.

What is Ansible?

Ansible is an open-source automation tool that is used to automate software provisioning, configuration management, and application deployment. It is a simple yet powerful tool that can automate tasks across multiple systems, making it ideal for setting up new PCs.

Using Ansible to Install Your Favourite Apps

To automate the installation of your favourite applications using Ansible, you will need to create an Ansible playbook that includes a list of all the applications you want to install. For me, these software programs are:

My List of Favourite Pieces of Software

Personal Additions

  • qBittorrent
  • Spotify
  • Discord
  • EarTrumpet
  • GitHub Desktop
  • JetBrains IDEs
  • PyCharm
  • WebStorm
  • Rider
  • IntelliJ
  • Android Studio
  • Windows Terminal
  • WSL2
  • Oracle VirtualBox
  • MobaXterm
  • Steam
  • Epic Games
  • GOG Galaxy

Basic Windows 11 Setup

  • VLC Player
  • ShareX
  • Bitwarden
  • 7zip
  • WinDirStat
  • Microsoft PowerToys
  • GIMP
  • Notepad++
  • TeraCopy
  • Firefox
  • Everything
  • f.lux
  • OBS
 

Here is an example of a playbook that installs some of the most popular applications on a Windows PC:
- hosts: windows
  gather_facts: no
  become: yes

  vars:
    apps:
      - vlc
      - sharex
      - bitwarden
      - 7zip
      - windirstat
      - powertoys
      - gimp
      - notepadplusplus
      - teracopy
      - firefox
      - everything
      - flux
      - obs-studio
      - qbittorrent
      - spotify
      - discord
      - eartrumpet
      - github-desktop
      - pycharm-community
      - webstorm
      - rider
      - intellij-idea-community
      - android-studio
      - obsidian
      - microsoft-windows-terminal
      - wsl2
      - oracle-virtualbox
      - mobaxterm
      - steam
      - epicgameslauncher
      - goggalaxy

  tasks:
    - name: Install Chocolatey
      win_chocolatey:
        name: chocolatey
        state: present

    - name: Install applications with Chocolatey
      win_chocolatey:
        name: "{{ item }}"
        state: present
      with_items: "{{ apps }}"
This playbook installs Chocolatey, a package manager for Windows, and then uses it to install all the applications listed in the apps variable.
To run this playbook, you will need to have Ansible installed on your PC and have access to a Windows PC that you want to install the applications on. Once you have these prerequisites, you can run the playbook with the following command:
ansible-playbook install-apps.yml -i inventory.ini
This command will execute the install-apps.yml playbook on the Windows PC listed in the inventory.ini file.

Conclusion

Automating the installation of your favourite applications on a new PC using Ansible can save you a lot of time and effort. With just a few commands, you can install all of your preferred applications and have your new PC set up and ready to use in no time. Ansible is a powerful automation tool that can help you automate many other tasks on your PC as well, so it is definitely worth learning if you are interested in streamlining your workflow.