tech:ansible_-_exemples
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:ansible_-_exemples [2025/04/24 00:31] – Jean-Baptiste | tech:ansible_-_exemples [2025/12/04 11:13] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| {{tag> | {{tag> | ||
| - | = Ansible - exemples | + | # Ansible - exemples |
| - | < | + | ~~~yaml |
| - name: install truc | - name: install truc | ||
| import_tasks: | import_tasks: | ||
| Ligne 12: | Ligne 13: | ||
| - name: install plop | - name: install plop | ||
| import_tasks: | import_tasks: | ||
| - | </ | + | ~~~ |
| Équivalent try except finally | Équivalent try except finally | ||
| - | < | + | ~~~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" | ||
| - | </ | + | ~~~ |
| - | == Plugin lookup | + | ## Plugin lookup |
| - | < | + | ~~~yaml |
| - name: raw result of running date command" | - name: raw result of running date command" | ||
| debug: | debug: | ||
| Ligne 57: | Ligne 58: | ||
| password" | password" | ||
| priv: "{{ client }}_{{ tier }}_{{ role }}.*: | priv: "{{ client }}_{{ tier }}_{{ role }}.*: | ||
| - | </ | ||
| + | ~~~ | ||
| - | == Exemple config projet | ||
| - | <code yaml .ansible-lint> | + | ## Exemple config projet |
| + | |||
| + | '' | ||
| + | |||
| + | ~~~yaml | ||
| --- | --- | ||
| skip_list: | skip_list: | ||
| - ' | - ' | ||
| - ignore-errors | - ignore-errors | ||
| - | </ | + | ~~~ |
| - | <code yaml .yamllint.yml> | + | '' |
| + | ~~~yaml | ||
| # SPDX-License-Identifier: | # SPDX-License-Identifier: | ||
| --- | --- | ||
| 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 yaml .yamllint_defaults.yml> | + | '' |
| + | ~~~yaml | ||
| # SPDX-License-Identifier: | # SPDX-License-Identifier: | ||
| --- | --- | ||
| Ligne 107: | Ligne 113: | ||
| document-start: | document-start: | ||
| colons: disable | colons: disable | ||
| - | </ | + | ~~~ |
| - | <code ini ansible.cfg> | + | |
| + | .yamllint | ||
| + | |||
| + | |||
| + | ~~~yaml | ||
| + | extends: default | ||
| + | |||
| + | rules: | ||
| + | colons: | ||
| + | max-spaces-before: | ||
| + | max-spaces-after: | ||
| + | line-length: | ||
| + | ~~~ | ||
| + | |||
| + | --- | ||
| + | |||
| + | '' | ||
| + | ~~~ini | ||
| [defaults] | [defaults] | ||
| roles_path = ../ | roles_path = ../ | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| # To generate an example config file (a " | # To generate an example config file (a " | ||
| 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 | ||
| - | </ | + | |
| + | # Voir la configuration : | ||
| + | ansible-config dump --only-changed -t all | ||
| + | ~~~ | ||
| Voir '' | Voir '' | ||
| - | <code - .gitignore> | + | '' |
| + | ~~~ | ||
| *.retry | *.retry | ||
| /.vagrant | /.vagrant | ||
| *.swp | *.swp | ||
| - | </ | + | ~~~ |
tech/ansible_-_exemples.1745447488.txt.gz · Dernière modification : de Jean-Baptiste
