Невозможный результат. failed_when, result.changed v.s. changed_when и т. д.

Когда вы сможете выполнить CTRL ALT F1 , после того, как вы сможете попытаться убить оскорбительное программное обеспечение. (через pgrep , pkill ...). Не всегда, но часто бывает достаточно, чтобы вернуть контроль над графической средой и нормально выйти из системы после CTRL ALT F7

Если вы не можете сделать это обычно с помощью ] CTRL ALT BACKSPACE вы можете перезапустить графический сервер.

В Ubuntu вы должны дать команду как sudo service lightdm restart после CTRL ALT F1 , я думаю, вы легко найдете аналог для Mint.

перезагрузка является последним ресурсом, и он будет закрыт, как и все процессы, которые все еще работают и отвечают.

4
28.02.2018, 10:32
1 ответ

Esto se ve mal

Su ejemplo agrega otra ruta a su libro de jugadas. Si systemd no está instalado, la salida será diferente que si estuviera instalado. Y después de la primera ejecución, se instalará. Esto va en contra del principio ansible que dice:

Idempotency

An operation is idempotent if the result of performing it once is exactly the same as the result of performing it repeatedly without any intervening actions.

Si todavía lo haces, hazlo lo más explícito posible

Le sugiero que ejecute un comando which systemctly registre la salida. Verifique la salida para instalar systemd y falle con una tarea fallida.

Esta sigue siendo una pregunta muy interesante

Supongo que no hay documentación real y tenemos que investigar.

Espero haber captado todos los casos :)pero no puedo llenar el cuadro en este momento.

libro de jugadas.yml:

---

- name: test some stuff
  hosts: all
  tasks:
    - include_tasks: tasks.yml
      with_items:
        - { data: ping, changed: true }
        - { data: ping, changed: false }
        - { data: crash, changed: true }
        - { data: crash, changed: false }

tareas.yml

---

- name: Check for command_result is defined and command_result
  ping:
    data: "{{ item.data }}"
  register: command_result
  changed_when: item.changed
  failed_when: command_result is defined and command_result
  ignore_errors: true

- name: Check for command_result is defined and command_result
  file:
    path:./file
  register: command_result
  changed_when: item.changed
  failed_when: command_result is defined and command_result
  ignore_errors: true

- name: Check for command_result
  ping:
    data: "{{ item.data }}"
  register: command_result
  changed_when: item.changed
  failed_when: command_result
  ignore_errors: true

- name: Check for command_result
  file:
    path:./file
  register: command_result
  changed_when: item.changed
  failed_when: command_result
  ignore_errors: true

- name: Check for command_result.changed is defined and command_result.changed
  ping:
    data: "{{ item.data }}"
  register: command_result
  changed_when: item.changed
  failed_when: command_result.changed is defined and command_result.changed

- name: Check for command_result.changed is defined and command_result.changed
  ping:
    data: "{{ item.data }}"
  register: command_result
  changed_when: item.changed
  failed_when: command_result.changed is defined and command_result.changed
  ignore_errors: true

- name: Check for command_result.changed
  ping:
    data: "{{ item.data }}"
  register: command_result
  changed_when: item.changed
  failed_when: command_result.changed
  ignore_errors: true

- name: Check for command_result.changed
  file:
    path:./file
  register: command_result
  changed_when: item.changed
  failed_when: command_result.changed
  ignore_errors: true
3
27.01.2020, 20:57

Теги

Похожие вопросы