|
@@ -0,0 +1,56 @@
|
|
|
|
|
+# Setup initial Debian 12 avec Ansible
|
|
|
|
|
+
|
|
|
|
|
+> Contexte :
|
|
|
|
|
+>
|
|
|
|
|
+> * On vient d'installer une debian 12.5 sans rien.
|
|
|
|
|
+> * On veut automatiser la création de comptes utilisateurs
|
|
|
|
|
+
|
|
|
|
|
+Mes deux hosts sur le LAN sont :
|
|
|
|
|
+
|
|
|
|
|
+- debian-111 : 192.168.1.18
|
|
|
|
|
+- debian-112 : 192.168.1.85
|
|
|
|
|
+- debian-113 : 192.168.1.109
|
|
|
|
|
+
|
|
|
|
|
+## NOTE sur utilisation macOS comme _control node_
|
|
|
|
|
+
|
|
|
|
|
+Voir `ansible-macos-control-node/README.md`.
|
|
|
|
|
+
|
|
|
|
|
+On va utiliser une VM debian comme control node.
|
|
|
|
|
+
|
|
|
|
|
+## Setup control node Debian 12.5
|
|
|
|
|
+
|
|
|
|
|
+Mon control node est `192.168.1.181`.
|
|
|
|
|
+
|
|
|
|
|
+- `su -` (pas encore installé `sudo`)
|
|
|
|
|
+- `apt install gnupg curl`
|
|
|
|
|
+- les commandes données dans la [doc officielle pour l'install sur Debian](https://docs.ansible.com/ansible/latest/installation_guide/installation_distros.html#installing-ansible-on-debian) ne **marchent pas**
|
|
|
|
|
+- `curl -o ansible.gpg "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367"`
|
|
|
|
|
+- `gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg ansible.gpg` (toujours comme `root`)
|
|
|
|
|
+- `echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ansible.list`
|
|
|
|
|
+- `apt update`
|
|
|
|
|
+- `apt install -y ansible`
|
|
|
|
|
+
|
|
|
|
|
+MIEUX de tout faire en `sudo` je suppose. On va aussi installer `etckeeper`.
|
|
|
|
|
+
|
|
|
|
|
+## D'abord commandes ad-hoc pour tester
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+### Ping
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+ansible -i ./inventory.ini all -m ping -u debian
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+ansible all -m ansible.builtin.setup
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+## Etapes
|
|
|
|
|
+
|
|
|
|
|
+- Création `inventory.ini` avec les deux hosts.
|
|
|
|
|
+- Création playbook qui va
|
|
|
|
|
+
|
|
|
|
|
+ - créer des utilisateurs avec droits sudo
|