Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
I
init_server
Gestion
Activité
Membres
Labels
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
Ansible Roles
init_server
Validations
c870aa69
Valider
c870aa69
rédigé
20 févr. 2024
par
Théo - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
change: better formating for collected versions
parent
399b8099
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
templates/collect_installed_packages_facts_Debian.sh.j2
+26
-22
26 ajouts, 22 suppressions
templates/collect_installed_packages_facts_Debian.sh.j2
avec
26 ajouts
et
22 suppressions
templates/collect_installed_packages_facts_Debian.sh.j2
+
26
−
22
Voir le fichier @
c870aa69
...
@@ -3,30 +3,34 @@
...
@@ -3,30 +3,34 @@
# Copyright © 2019 Le Filament (<http://www.le-filament.com>)
# Copyright © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
mkdir
-p
/home/
{{
host_user
}}
/versions
TODAY
=
`
date
+%F
`
VERSIONS_DIR
=
'/home/{{ host_user }}/versions'
file
=
"/home/{{ host_user }}/versions/{{ inventory_hostname|lower }}.
$TODAY
"
today
=
$(
date
'+%F'
)
latest_file
=
"/home/{{ host_user }}/versions/{{ inventory_hostname|lower }}.latest"
outfile_apt
=
"
${
VERSIONS_DIR
}
/apt_{{ inventory_hostname|lower }}.
${
today
}
"
printf
"DATE =
$TODAY
"
>
$file
outfile_apt_hr
=
"
${
VERSIONS_DIR
}
/apt-hr_{{ inventory_hostname|lower }}.
${
today
}
"
printf
"
\n\n
-- OS version --
\n
"
>>
$file
outfile_pip3
=
"
${
VERSIONS_DIR
}
/pip3_{{ inventory_hostname|lower }}.
${
today
}
"
lsb_release
-a
>>
$file
outfile_pip3_hr
=
"
${
VERSIONS_DIR
}
/pip3-hr_{{ inventory_hostname|lower }}.
${
today
}
"
printf
"
\n\n
-- Installed OS packages --
\n
"
>>
$file
apt list
--installed
>>
$file
mkdir
--parents
"
${
VERSIONS_DIR
}
"
if
[[
-f
"/usr/bin/pip"
]]
;
then
printf
"
\n\n
-- Installed Python packages --
\n
"
>>
$file
dpkg-query
--no-pager
--show
--showformat
'${Package}|${Version}|${Architecture}|${db:Status-Abbrev}\n'
|
paste
-s
-d
';'
>
$outfile_apt
pip list installed
>>
$file
apt-mark showmanual |
paste
-s
-d
';'
>>
$outfile_apt
fi
if
[[
-f
"/usr/bin/pip3"
]]
;
then
python3
-m
pip list
--pre
--format
json
>
$outfile_pip3
printf
"
\n\n
-- Installed Python 3 packages --
\n
"
>>
$file
python3
-m
pip list
--pre
--not-required
--format
json
>>
$outfile_pip3
pip3 list installed
>>
$file
fi
apt list
--installed
>
$outfile_apt_hr
cp
$file
$latest_file
chmod
644
$file
$latest_file
pip3 list installed
>
$outfile_pip3_hr
{
%
for
host
in
groups.backup_server %
}
{
%
for
host
in
groups.backup_server %
}
{
%
if
host
!=
inventory_hostname %
}
{
%
if
host
!=
inventory_hostname %
}
sftp
-P
{{
default_sshd_port
}}
-o
IdentityFile
=
/home/
{{
host_user
}}
/.ssh/id_ed25519
{{
backup_sftp_user
}}
@
{{
hostvars[host].ansible_host
}}
<<
COMMANDS
sftp
-b
-
-P
{{
default_sshd_port
}}
-o
IdentityFile
=
/home/
{{
host_user
}}
/.ssh/id_ed25519
{{
backup_sftp_user
}}
@
{{
hostvars[host].ansible_host
}}
<<
COMMANDS
put
$file
{{ inventory_hostname|lower }}/
-put
${
outfile_apt
}
{{ inventory_hostname|lower }}/
-put
${
outfile_pip3
}
{{ inventory_hostname|lower }}/
-put
${
outfile_apt_hr
}
{{ inventory_hostname|lower }}/
-put
${
outfile_pip3_hr
}
{{ inventory_hostname|lower }}/
quit
quit
COMMANDS
COMMANDS
{
% endif %
}
{
% endif %
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter