From 0e6b727e532deb09bdcff59ac559b2417cd243a2 Mon Sep 17 00:00:00 2001
From: Kenichi Omichi <ken1ohmichi@gmail.com>
Date: Thu, 19 May 2022 23:39:12 -0700
Subject: [PATCH] Update docs for using venv (#8842)

Due many patterns of Linux distributions, it is difficult to install
ansible dependencies as system-wide stably.
Apart of Kubespray doc[1] recommends to use venv to avoid such issue,
and this applies venv usage to the other parts of the doc.

[1]: https://github.com/kubernetes-sigs/kubespray/blob/master/docs/setting-up-your-first-cluster.md#set-up-kubespray
---
 README.md                         | 11 ++++++-----
 contrib/azurerm/README.md         |  5 ++++-
 contrib/terraform/metal/README.md |  2 +-
 docs/equinix-metal.md             |  5 ++++-
 docs/upgrades.md                  |  2 +-
 5 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 6018ff4df..0cba6d01e 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@ To deploy the cluster you can use :
 
 #### Usage
 
-```ShellSession
-# Install dependencies from ``requirements.txt``
-sudo pip3 install -r requirements.txt
+Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
+then run the following steps:
 
+```ShellSession
 # Copy ``inventory/sample`` as ``inventory/mycluster``
 cp -rfp inventory/sample inventory/mycluster
 
@@ -75,10 +75,11 @@ python -V && pip -V
 ```
 
 If this returns the version of the software, you're good to go. If not, download and install Python from here <https://www.python.org/downloads/source/>
-Install the necessary requirements
+
+Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
+then run the following step:
 
 ```ShellSession
-sudo pip install -r requirements.txt
 vagrant up
 ```
 
diff --git a/contrib/azurerm/README.md b/contrib/azurerm/README.md
index ee74af06a..f24a5ec23 100644
--- a/contrib/azurerm/README.md
+++ b/contrib/azurerm/README.md
@@ -47,6 +47,10 @@ If you need to delete all resources from a resource group, simply call:
 
 **WARNING** this really deletes everything from your resource group, including everything that was later created by you!
 
+## Installing Ansible and the dependencies
+
+Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
+
 ## Generating an inventory for kubespray
 
 After you have applied the templates, you can generate an inventory with this call:
@@ -59,6 +63,5 @@ It will create the file ./inventory which can then be used with kubespray, e.g.:
 
 ```shell
 cd kubespray-root-dir
-sudo pip3 install -r requirements.txt
 ansible-playbook -i contrib/azurerm/inventory -u devops --become -e "@inventory/sample/group_vars/all/all.yml" cluster.yml
 ```
diff --git a/contrib/terraform/metal/README.md b/contrib/terraform/metal/README.md
index a21aed461..e49e6c97b 100644
--- a/contrib/terraform/metal/README.md
+++ b/contrib/terraform/metal/README.md
@@ -35,7 +35,7 @@ now six total etcd replicas.
 ## Requirements
 
 - [Install Terraform](https://www.terraform.io/intro/getting-started/install.html)
-- Install dependencies: `sudo pip install -r requirements.txt`
+- [Install Ansible dependencies](/docs/ansible.md#installing-ansible)
 - Account with Equinix Metal
 - An SSH key pair
 
diff --git a/docs/equinix-metal.md b/docs/equinix-metal.md
index 91f31ca12..61260f061 100644
--- a/docs/equinix-metal.md
+++ b/docs/equinix-metal.md
@@ -50,9 +50,12 @@ Pull over Kubespray and setup any required libraries.
 ```bash
 git clone https://github.com/kubernetes-sigs/kubespray
 cd kubespray
-sudo pip install -r requirements.txt
 ```
 
+## Install Ansible
+
+Install Ansible according to [Ansible installation guide](/docs/ansible.md#installing-ansible)
+
 ## Cluster Definition
 
 In this example, a new cluster called "alpha" will be created.
diff --git a/docs/upgrades.md b/docs/upgrades.md
index f494112b4..22d81d591 100644
--- a/docs/upgrades.md
+++ b/docs/upgrades.md
@@ -130,7 +130,7 @@ $ git checkout v2.7.0
 Previous HEAD position was 8b3ce6e4 bump upgrade tests to v2.5.0 commit (#3087)
 HEAD is now at 05dabb7e Fix Bionic networking restart error #3430 (#3431)
 
-# NOTE: May need to sudo pip3 install -r requirements.txt when upgrading.
+# NOTE: May need to `pip3 install -r requirements.txt` when upgrading.
 
 ansible-playbook -i inventory/mycluster/hosts.ini -b upgrade-cluster.yml
 
-- 
GitLab