How to Install PowerShell 7 using Ansible



RECOMMENDED: Click here to fix Windows errors and optimize system performance

PowerShell 7.0 is an open source, cross-platform (Windows, MacOS and Linux) edition of PowerShell designed to handle heterogeneous environments and hybrid clouds.

In addition, PowerShell 7.0 supports the ARM32 and ARM64 variants of Debian, Ubuntu, and Alpine Linux ARM64.

Getting PowerShell 7 to Work

PowerShell 7 is installed in a new directory and runs in parallel with Windows PowerShell 5.1. For PowerShell Core 6.x, PowerShell 7 is a direct update that removes PowerShell Core 6.x.

PowerShell 7 is installed to %programfiles%\PowerShell\7
The %programfiles%\PowerShell\7 folder is added to $env:PAT

The PowerShell 7 installation packages update previous versions of PowerShell Core 6.x :

  • PowerShell Core 6.x on Windows: %programfiles%\PowerShell\6 is replaced by %programfiles%\PowerShell\7
  • Linux: /opt/microsoft/powershell/6 is replaced by /opt/microsoft/powershell/7
  • macOS: /usr/local/microsoft/powershell/6 is replaced by /usr/local/microsoft/powershell/7

Ansible is increasingly becoming the application delivery and software deployment platform for developers because of its ease of use and flexibility. It is also easy to implement and does not require the installation of an agent on remote nodes. Instead, Ansible uses password-free SSH authentication to manage remote Unix/Linux hosts. However, in this topic we will see how to manage Windows hosts with Ansible.



May 2020 Update:

We now recommend using this tool for your error. Additionally, this tool fixes common computer errors, protects you against file loss, malware, hardware failures and optimizes your PC for maximum performance. You can fix your PC problems quickly and prevent others from happening with this software:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

download



Installing Ansible on Windows and Linux

Installing Ansible on a Linux system is very simple. Most packaging systems for Linux distributions already have it. Here are some of the common ways to install Ansible :

  • sudo apt install ansible
  • sudo yum install ansible
  • sudo dnf install ansible

However, Windows is a unique case because Ansible is not available as a Windows package. The easiest way to install Ansible for use on Windows is to use the Windows for Linux (WSL) subsystem. This is a virtualized instance of Linux that runs parallel to Windows. Once it is installed, you can use the same installation commands in the WSL to install Ansible.

Set Up Ansible

There are a few key elements we need to install PowerShell 7 We need a Hosts file to define our target locations. There are many ways to set this up, but generally a folder structure like the one below works well.

  • Directories
  • Play books
  • vars

In the inventory directory, we would create a hosts file containing all the systems we want to target with our playbook. A simple hosts file that creates a group of hosts under the production label is described below. The comments are useful to let you know what the real hostname of the systems is.

[Production]
#test-system-01
100.100.10.10
#test-system-02
100.100.10.11
#Test system 03
100.100.10.12
#Test system 04
100.100.10.13

You can create multiple host groups, and the same host can exist in multiple groups. This makes it easier to group and “flag” these hosts for later handling more complex roles.

https://github.com/deekayen/ansible-role-chocolatey



RECOMMENDED: Click here to troubleshoot Windows errors and optimize system performance