<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wiki.squi.fr/index.php?action=history&amp;feed=atom&amp;title=Ansible_%3A_remplacement_r%C3%A9cursif_de_texte</id>
	<title>Ansible : remplacement récursif de texte - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.squi.fr/index.php?action=history&amp;feed=atom&amp;title=Ansible_%3A_remplacement_r%C3%A9cursif_de_texte"/>
	<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Ansible_:_remplacement_r%C3%A9cursif_de_texte&amp;action=history"/>
	<updated>2026-06-12T02:39:33Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.squi.fr/index.php?title=Ansible_:_remplacement_r%C3%A9cursif_de_texte&amp;diff=2061&amp;oldid=prev</id>
		<title>Justine le 22 juin 2022 à 10:05</title>
		<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Ansible_:_remplacement_r%C3%A9cursif_de_texte&amp;diff=2061&amp;oldid=prev"/>
		<updated>2022-06-22T10:05:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 22 juin 2022 à 10:05&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Ligne 1 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 1 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Ansible]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Exemple =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Exemple =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Justine</name></author>
	</entry>
	<entry>
		<id>https://wiki.squi.fr/index.php?title=Ansible_:_remplacement_r%C3%A9cursif_de_texte&amp;diff=1290&amp;oldid=prev</id>
		<title>Justine : Page créée avec « = Exemple =  Il faut récupérer les fichiers, puis utiliser leurs chemins pour faire du replace.  Exemple :   &lt;syntaxhighlight lang=&quot;yaml&quot;&gt;  --- - hosts: all   become: tr... »</title>
		<link rel="alternate" type="text/html" href="https://wiki.squi.fr/index.php?title=Ansible_:_remplacement_r%C3%A9cursif_de_texte&amp;diff=1290&amp;oldid=prev"/>
		<updated>2019-09-30T09:51:26Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « = Exemple =  Il faut récupérer les fichiers, puis utiliser leurs chemins pour faire du replace.  Exemple :   &amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;  --- - hosts: all   become: tr... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Exemple =&lt;br /&gt;
&lt;br /&gt;
Il faut récupérer les fichiers, puis utiliser leurs chemins pour faire du replace.&lt;br /&gt;
&lt;br /&gt;
Exemple : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;yaml&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
- hosts: all&lt;br /&gt;
  become: true&lt;br /&gt;
  tasks:&lt;br /&gt;
&lt;br /&gt;
    - name: Récupérer les fichiers&lt;br /&gt;
      find:&lt;br /&gt;
        patterns: &amp;quot;config&amp;quot;&lt;br /&gt;
        paths: /var/log&lt;br /&gt;
        recurse: yes&lt;br /&gt;
      register: fichiers&lt;br /&gt;
&lt;br /&gt;
    - name: debuggage&lt;br /&gt;
      debug:&lt;br /&gt;
        msg: &amp;quot;{{ item.path }}&amp;quot;&lt;br /&gt;
      with_items: &amp;quot;{{ fichiers.files }}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    - name: remplacement du texte&lt;br /&gt;
      replace:&lt;br /&gt;
        dest: &amp;quot;{{item.path}}&amp;quot;&lt;br /&gt;
        regexp: &amp;#039;{{anneeavant}}&amp;#039;&lt;br /&gt;
        replace: &amp;#039;{{anneeapres}}&amp;#039;&lt;br /&gt;
      with_items: &amp;quot;{{ fichiers.files }}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ici, je remplace anneavant par anneeapres. Le bloc de debug n&amp;#039;est là que pour faire de l&amp;#039;affichage.&lt;br /&gt;
&lt;br /&gt;
Le module find renvoie un dictionnaire, lequel contient un sous ensemble files, lequel contient entre autre le path de chaque fichier. C&amp;#039;est pour ça que je fais un with_items : fichiers.files et que j&amp;#039;agit ensuite sur item.path. Quelle galère !&lt;/div&gt;</summary>
		<author><name>Justine</name></author>
	</entry>
</feed>