Article original Publié le : 10 décembre 2022 Mise à jour le : – |
Installation ou réinstallation d’une machine en Xubuntu 22.04,
j’ai fait ce playbook pour gagner du temps à la réinstallation de tous les paquets courants, tout en évitant les bundles snap,
Pré-requis
Installer le paquet Ansible par apt ou via pip3
Structure
Au plus simple, sans passer par un rôle, je voulais vraiment tout dans un fichier unique
1 2 3 4 5 6 7 8 |
. ├── files │ └── custom_config_terminator ├── inventories │ └── hosts ├── playbooks │ └── playbook.yml └── README.md |
L’inventaire
C’est en local, à adapter au besoin
1 2 |
[local] admin ansible_connection=local |
Le playbook
Du deb, de l’apt, des repo ..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
--- - hosts: local become: yes tasks: ## Mise à jour du système - name: Update/upgrade des paquets apt: upgrade: yes update_cache: yes cache_valid_time: 86400 autoclean: true tags: update ## Installation avec apt - name: Installation des paquets apt: update_cache: yes name: "{{ packages }}" vars: packages: - vim - terminator - default-jre - keepass2 - apt-transport-https - gnupg - curl - wget - git - tree - mlocate - zip - 7zip - docker - docker.io - gedit - kazam - shutter - bash-completion - gparted - net-tools - filezilla - vlc - whois - openvpn - network-manager-openvpn-gnome - liferea ## lecteur rss - keepassxc - redshift - redshift-gtk - pwgen - cifs-utils - ncdu - fwupd - ifupdown - smartmontools - vagrant - virtualbox - youtube-dl - ufw tags: apt ## Custom configuration pour terminator - name: Vérification si le répertoire terminator existe become: no stat: path: ~/.config/terminator/ register: rep_terminator tags: terminator - name: Si le répertoire existe become: no debug: msg: "le répertoire existe" when: rep_terminator.stat.exists tags: terminator - name: Création si le répertoire n'existe pas become: no file: path: ~/.config/terminator/ state: directory mode: 0700 when: rep_terminator.stat.exists == false tags: terminator - name: Copie fichier de conf terminator become: no copy: src: "../files/custom_config_terminator" dest: "~/.config/terminator/config" mode: '0664' tags: terminator ## Installation du navigateur Brave - name: Récupération de la clé pgp shell: curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg tags: brave - name: Ajout du repo apt pour brave apt_repository: repo: "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main" state: present filename: brave-browser-release update_cache: true tags: brave - name: Installer brave apt: name: brave-browser state: present tags: brave ## Installation de Visual studio code - name: Vérification si le répertoire existe stat: path: '/etc/apt/keyrings' register: rep_vscode tags: vscode - name: Si le répertoire existe debug: msg: "le répertoire existe" when: rep_vscode.stat.exists tags: vscode - name: Création si le répertoire n'existe pas file: path: '/etc/apt/keyrings' state: directory mode: 'u=rwx,go=rx' when: rep_vscode.stat.exists == false tags: vscode - name: Récupération de la cle pgp get_url: url: 'https://packages.microsoft.com/keys/microsoft.asc' dest: '/etc/apt/keyrings/' mode: 'u=rw,go=r' force: yes tags: vscode - name: Ajout du repo apt pour vs code apt_repository: repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/microsoft.asc] https://packages.microsoft.com/repos/code stable main" filename: vscode state: present tags: vscode - name: Install code apt: name: code state: present tags: vscode ## Installation de chrome (me sert pour les tests de certificat) - name: Ajout de la clé pour chrome apt_key: url: "https://dl.google.com/linux/linux_signing_key.pub" state: present tags: chrome - name: Ajout du repo apt pour chrome apt_repository: repo: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main state: present filename: google-chrome tags: chrome - name: Install de google chrome apt: name: "google-chrome-stable" state: latest update_cache: true tags: chrome ## Installation depuis un .deb - name: Installation Keystore-explorer apt: deb: https://github.com/kaikramer/keystore-explorer/releases/download/v5.5.1/kse_5.5.1_all.deb tags: deb - name: Installation xnview apt: deb: https://download.xnview.com/XnViewMP-linux-x64.deb tags: deb |
Readme
RTFM comme on dit 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# Installation en one-shot d'application sous (X)ubuntu 22.04 ----------------- Pour installer rapidement l'ensemble des applications ## Exécution ----------------- $ ansible-playbook -i inventories playbooks/playbook.yml ## Exécution avec un tag ----------------- $ ansible-playbook -i inventories playbooks/playbook.yml --tags "deb" ### Source https://it.izero.fr/ansible-installation-en-one-shot-dapplication-sous-xubuntu-22-04/ |
Source
https://github.com/Toaster2luX/application_ubuntu_22.04
Cet article a été écrit avec du Millie Jackson, du M.A.S.S et de l’AC/DC 😈 !!