62 lines
1.7 KiB
Markdown
62 lines
1.7 KiB
Markdown
|
|
# IaC_BUT3
|
||
|
|
|
||
|
|
## Activer les API suivantes
|
||
|
|
|
||
|
|
activer api : Identity and Access Management (IAM) API
|
||
|
|
activer api : Cloud Resource Manager API
|
||
|
|
|
||
|
|
## Créer la VM
|
||
|
|
|
||
|
|
**Créer une VM small comme les tp précédents**
|
||
|
|
|
||
|
|
## Installation sur la VM
|
||
|
|
|
||
|
|
sudo apt install git
|
||
|
|
git clone https://github.com/MaximePIERRONT/IaC_BUT3.git
|
||
|
|
|
||
|
|
### Génération de la clé privée
|
||
|
|
`ssh-keygen -t rsa -f ~/.ssh/id_ed25519 -C <john_doe_gmail_com>`
|
||
|
|
|
||
|
|
**replace "." & "@" with "_"**
|
||
|
|
```bash
|
||
|
|
eval `ssh-agent`
|
||
|
|
ssh-add ~/.ssh/id_ed25519
|
||
|
|
```
|
||
|
|
|
||
|
|
### Installation terraform
|
||
|
|
|
||
|
|
Source :
|
||
|
|
[https://www.hashicorp.com/official-packaging-guide?product_intent=terraform](https://www.hashicorp.com/official-packaging-guide?product_intent=terraform)
|
||
|
|
|
||
|
|
Ajouter terraform dans votre list de package disponible
|
||
|
|
```bash
|
||
|
|
sudo apt update && sudo apt install gpg
|
||
|
|
|
||
|
|
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
|
||
|
|
|
||
|
|
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
|
||
|
|
|
||
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
|
||
|
|
|
||
|
|
```
|
||
|
|
Installer terraform et ansible
|
||
|
|
```bash
|
||
|
|
sudo apt update
|
||
|
|
sudo apt install terraform`
|
||
|
|
|
||
|
|
sudo apt install ansible
|
||
|
|
ansible-galaxy collection install community.mysql
|
||
|
|
sudo apt install -y python3-google-auth python3-requests python3-google-auth-httplib2 python3-googleapi
|
||
|
|
```
|
||
|
|
|
||
|
|
### Connection avec google
|
||
|
|
|
||
|
|
Faire les étapes suivantes pour la connexion à Google sur votre VM
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|