Installation sous macOS#

Utilisez le Terminal macOS pour toutes les commandes. WSL ne concerne pas ce parcours.

1. Identifier le processeur#

uname -m

arm64 désigne un Mac Apple Silicon. x86_64 désigne un Mac Intel.

2. Installer les outils Apple et Homebrew#

xcode-select --install

Installez ensuite Homebrew avec la commande affichée sur son site officiel.

Sur Apple Silicon, chargez Homebrew dans le terminal courant :

eval "$(/opt/homebrew/bin/brew shellenv)"

3. Installer VirtualBox, Vagrant, Git et Python#

Installez VirtualBox :

brew install --cask virtualbox

Installez Vagrant depuis le dépôt officiel HashiCorp :

brew tap hashicorp/tap
brew install hashicorp/tap/hashicorp-vagrant

Installez Git :

brew install git

Installez Python :

brew install python@3.12

macOS peut demander d’autoriser le logiciel système Oracle dans Réglages Système > Confidentialité et sécurité. Autorisez-le, puis redémarrez si macOS le demande.

Ouvrez VirtualBox une première fois, vérifiez que sa fenêtre s’affiche, puis fermez-la.

4. Vérifier les outils locaux#

VBoxManage --version
vagrant version
git --version
python3.12 --version

Sur Apple Silicon, si vagrant up échoue au démarrage du BIOS, exécutez la correction indiquée par le tutoriel Vagrant :

VBoxManage setextradata global "VBoxInternal/Devices/pcbios/0/Config/DebugLevel"

5. Forker et cloner le TP#

Créez votre fork de https://gitlab.com/cloud_com-devops/tp-ansible-voting-app dans GitLab.

cd ~/Documents

Remplacez VOTRE_IDENTIFIANT :

git clone https://gitlab.com/VOTRE_IDENTIFIANT/tp-ansible-voting-app.git
cd tp-ansible-voting-app
git remote -v

6. Installer Ansible#

python3.12 -m venv ~/.venvs/cloud-com-devops
source ~/.venvs/cloud-com-devops/bin/activate
python -m pip install --upgrade pip
python -m pip install "ansible-core>=2.17,<2.18"
cd ~/Documents/tp-ansible-voting-app/ansible
export ANSIBLE_CONFIG="$PWD/ansible.cfg"
ansible-galaxy collection install -r requirements.yml
ansible --version

7. Installer Terraform#

brew install hashicorp/tap/terraform
terraform version

8. Installer AWS CLI v2#

cd /tmp
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o AWSCLIV2.pkg
sudo installer -pkg AWSCLIV2.pkg -target /
rm AWSCLIV2.pkg
which aws
aws --version

9. Contrôle final macOS#

VBoxManage --version
vagrant version
git --version
source ~/.venvs/cloud-com-devops/bin/activate
cd ~/Documents/tp-ansible-voting-app/ansible
export ANSIBLE_CONFIG="$PWD/ansible.cfg"
ansible --version
terraform version
which aws
aws --version

Ne commencez pas le déploiement tant qu’une commande de ce contrôle échoue.