# /etc/environment

- name: Remove /etc/environment
  file:
    path: /etc/environment
    state: absent
  become: true

- name: Check MAGIC_ETC_ENV without
  shell: echo $MAGIC_ETC_ENV
  register: echo

- assert:
    that: echo.stdout == ""
    fail_msg: |
      echo={{ echo }}

- name: Create /etc/environment
  copy:
    dest: /etc/environment
    content: |
      MAGIC_ETC_ENV=555
  become: true

- meta: reset_connection

#- mitogen_shutdown_all:
  #when: not is_mitogen

- name: Check MAGIC_ETC_ENV with
  shell: echo $MAGIC_ETC_ENV
  register: echo

- assert:
    that: echo.stdout == "555"
    fail_msg: |
      echo={{ echo }}

- name: Cleanup /etc/environment
  file:
    path: /etc/environment
    state: absent
  become: true

- meta: reset_connection

- mitogen_shutdown_all:
  when: not is_mitogen

- name: Check MAGIC_ETC_ENV without+shutdown
  shell: echo $MAGIC_ETC_ENV
  register: echo

- assert:
    that: echo.stdout == ""
    fail_msg: |
      echo={{ echo }}
