mirror of
https://github.com/newtype256/esgi-devops.git
synced 2025-06-06 19:16:26 +02:00
cours: n°3
This commit is contained in:
parent
37f6ee7eef
commit
2756d9ebf4
8 changed files with 160 additions and 2 deletions
1
illustrations/2_deployer/.envrc
Normal file
1
illustrations/2_deployer/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use nix
|
21
illustrations/2_deployer/default.nix
Normal file
21
illustrations/2_deployer/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
let nixpkgs = <nixpkgs>;
|
||||
in
|
||||
{
|
||||
pkgs ? import nixpkgs {}
|
||||
, pythonPackageName ? "python3"
|
||||
, python ? pkgs.${pythonPackageName}}:
|
||||
|
||||
rec {
|
||||
pythonDependencies = (python.withPackages
|
||||
(ps: [
|
||||
ps.Fabric
|
||||
]));
|
||||
|
||||
shell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
pythonDependencies
|
||||
terraform
|
||||
];
|
||||
};
|
||||
}
|
||||
|
11
illustrations/2_deployer/exemple.py
Normal file
11
illustrations/2_deployer/exemple.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from fabric import Connection
|
||||
|
||||
nom_hote = "2a01:e0a:5f9:9681:5ca8:ecff:fe4e:82c6" # À remplacer avec votre nom d'hôte à vous.
|
||||
utilisateur = "raito" # À remplacer avec root ou votre nom d'utilisateur.
|
||||
|
||||
c = Connection(nom_hote, user=utilisateur)
|
||||
|
||||
print('[+] Regardons le nom d\'hôte')
|
||||
c.run('hostname')
|
||||
print('[+] Regardons les informations du noyau et de la machine')
|
||||
c.run('uname -a')
|
1
illustrations/2_deployer/shell.nix
Normal file
1
illustrations/2_deployer/shell.nix
Normal file
|
@ -0,0 +1 @@
|
|||
(import ./default.nix {}).shell
|
Loading…
Add table
Add a link
Reference in a new issue