Outils pour utilisateurs

Outils du site


tech:ansible_-_exemples

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:ansible_-_exemples [2025/04/24 00:31] Jean-Baptistetech:ansible_-_exemples [2025/12/04 11:13] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 {{tag>Brouillon CA}} {{tag>Brouillon CA}}
  
-Ansible - exemples+Ansible - exemples
  
-<code yaml>+~~~yaml
 - name: install truc - name: install truc
   import_tasks: "1-install-truc.yml"   import_tasks: "1-install-truc.yml"
Ligne 12: Ligne 13:
 - name: install plop - name: install plop
   import_tasks: "3-install-plop.yml"   import_tasks: "3-install-plop.yml"
-</code>+~~~
  
 Équivalent try except finally Équivalent try except finally
-<code yaml>+~~~yaml
 - name: Attempt and graceful roll back demo - name: Attempt and graceful roll back demo
   block:   block:
Ligne 43: Ligne 44:
       ansible.builtin.debug:       ansible.builtin.debug:
         msg: "This always executes"         msg: "This always executes"
-</code>+~~~
  
-== Plugin lookup+## Plugin lookup
  
-<code yaml>+~~~yaml
 - name: raw result of running date command" - name: raw result of running date command"
   debug:   debug:
Ligne 57: Ligne 58:
     password" "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,hexdigits,punctuation') }}"     password" "{{ lookup('password', '/tmp/passwordfile chars=ascii_letters,digits,hexdigits,punctuation') }}"
     priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"     priv: "{{ client }}_{{ tier }}_{{ role }}.*:ALL"
-</code>  
  
 +~~~
  
  
  
-== Exemple config projet 
  
-<code yaml .ansible-lint>+## Exemple config projet 
 + 
 +''.ansible-lint'' 
 + 
 +~~~yaml
 --- ---
 skip_list: skip_list:
 - '303'  # Using command rather than module for yum/dnf - '303'  # Using command rather than module for yum/dnf
 - ignore-errors - ignore-errors
-</code>+~~~
  
-<code yaml .yamllint.yml>+''.yamllint.yml'' 
 +~~~yaml
 # SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
 --- ---
Ligne 87: Ligne 92:
 # NOTE: the above does not apply to `rules` - you do not # NOTE: the above does not apply to `rules` - you do not
 # have to copy all of the rules from the base config # have to copy all of the rules from the base config
-</code>+~~~
  
-<code yaml .yamllint_defaults.yml>+''.yamllint_defaults.yml'' 
 +~~~yaml
 # SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
 --- ---
Ligne 107: Ligne 113:
   document-start: disable   document-start: disable
   colons: disable   colons: disable
-</code>+~~~
  
-<code ini ansible.cfg>+ 
 +.yamllint 
 + 
 + 
 +~~~yaml 
 +extends: default 
 + 
 +rules: 
 +  colons: 
 +    max-spaces-before:
 +    max-spaces-after: 20 
 +  line-length: disable 
 +~~~ 
 + 
 +--- 
 + 
 +''ansible.cfg'' 
 +~~~ini
 [defaults] [defaults]
 roles_path = ../ roles_path = ../
  
-</code>+~~~
  
-<code bash>+~~~bash
 # To generate an example config file (a "disabled" one with all default settings, commented out): # To generate an example config file (a "disabled" one with all default settings, commented out):
 ansible-config init --disabled > ansible.cfg ansible-config init --disabled > ansible.cfg
Ligne 121: Ligne 144:
 # Also you can now have a more complete file by including existing plugins: # Also you can now have a more complete file by including existing plugins:
 ansible-config init --disabled -t all > ansible.cfg ansible-config init --disabled -t all > ansible.cfg
-</code>+ 
 +# Voir la configuration : 
 +ansible-config dump --only-changed -t all 
 +~~~
 Voir ''ansible-navigator config'' Voir ''ansible-navigator config''
  
-<code - .gitignore>+''.gitignore'' 
 +~~~
 *.retry *.retry
 /.vagrant /.vagrant
 *.swp *.swp
-</code>+~~~ 
  
  
  
  
tech/ansible_-_exemples.1745447488.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki