LINUX.ORG.RU

История изменений

Исправление system-root, (текущая версия) :

# sometest_role
---
- set_fact:
    someusers:
      - sometest
      - pollinate
      - none
- name: some setup
  include_role:
    name: block_users
    tasks_from: main
  with_together: "{{ someusers }}"
# block_users
- name: Check that user exist
  shell: grep "^{{ grep_item }}:" /etc/passwd
  ignore_errors: yes
  register: user_evidential_existentiality
  with_items: "{{ someusers }}"
  loop_control:
    loop_var: grep_item

- name: debug
  debug:
    msg: "{{ user_item.grep_item }}"
  when: (user_item.rc != 1)
  with_flattened: "{{ user_evidential_existentiality.results }}"
  loop_control:
    loop_var: user_item
# site.yml
---
- name: Test
  hosts: allmyshittyhosts
  strategy: linear
  roles:
    - sometest_role

Исходная версия system-root, :

# sometest_role
---
- set_fact:
    someusers:
      - sometest
      - pollinate
      - none
- name: some setup
  include_role:
    name: block_users
    tasks_from: main
  with_together: "{{ someusers }}"
# block_users
- name: Check that user exist
  shell: grep "^{{ grep_item }}:" /etc/passwd
  ignore_errors: yes
  register: user_evidential_existentiality
  with_items: "{{ someusers }}"
  loop_control:
    loop_var: grep_item

- name: debug
  debug:
    # msg: "{{ user_evidential_existentiality.results }}"
    msg: "{{ user_item.grep_item }}"
  when: (user_item.rc != 1)
  with_flattened: "{{ user_evidential_existentiality.results }}"
  loop_control:
    loop_var: user_item
# site.yml
---
- name: Test
  hosts: allmyshittyhosts
  strategy: linear
  roles:
    - sometest_role