Skip to content
Snippets Groups Projects
Commit e2835961 authored by Vincent Mazenod's avatar Vincent Mazenod
Browse files

reorder ansible

parent 184249cb
No related branches found
No related tags found
No related merge requests found
Pipeline #3503 passed
......@@ -649,6 +649,52 @@ post_tasks:
```
## tags
tags au niveau tâches
```yaml
- name: MySQL to listen on all interfaces, not just localhost
lineinfile:
dest: /etc/mysql/mariadb.conf.d/50-server.cnf
regexp: "^bind-address = 127.0.0.1"
line: "#bind-address = 127.0.0.1"
tags: [database]
```
`always` tag spécial exécuté à tous les coups
```yaml
pre_tasks:
- name: update sources
apt:
update_cache: yes
tags: [always]
```
## tags
```shell
$ ansible-playbook my-playbook.yml --list-tags
```
liste tous les tags disponibles dans le playbook
```shell
$ ansible-playbook my-playbook.yml --tags database
```
n'exécute que les tâches du playbook ayant un tag `database`
```shell
$ ansible-playbook my-playbook.yml --skip-tags database
```
exécute toutes les tâches du playbook sauf celles ayant un tag `database`
## dry run
```shell
......@@ -762,52 +808,6 @@ $ ansible-galaxy install -f -r requirements.yml
```
## tags
tags au niveau tâches
```yaml
- name: MySQL to listen on all interfaces, not just localhost
lineinfile:
dest: /etc/mysql/mariadb.conf.d/50-server.cnf
regexp: "^bind-address = 127.0.0.1"
line: "#bind-address = 127.0.0.1"
tags: [database]
```
tags au niveau roles à l'inclusion dans le playbook
```yaml
roles:
- role: debug
tags: debug
```
`always` tag spécial exécuté à tous les coups
## tags
```shell
$ ansible-playbook my-playbook.yml --list-tags
```
liste tous les tags disponibles dans le playbook
```shell
$ ansible-playbook my-playbook.yml --tags debug
```
n'exécute que les tâches du playbook ayant un tag `debug`
```shell
$ ansible-playbook my-playbook.yml --skip-tags debug
```
exécute toutes les tâches du playbook sauf celles ayant un tag `debug`
## [<i class="fa fa-book" aria-hidden="true"></i> callback](https://docs.ansible.com/ansible/latest/plugins/callback.html)
```shell
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment