Skip to content
This repository has been archived by the owner on Sep 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #90 from freedomofpress/simplify-group-membership-…
Browse files Browse the repository at this point in the history
…tasks

Simplifies group membership update task
  • Loading branch information
redshiftzero authored Nov 30, 2016
2 parents 7538b1b + dad2278 commit 4f96bc0
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions roles/crawler/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,12 @@
name: "{{ fpsd_crawler_system_account }}"
system: yes

# Necessary because the user module is not idempotent.
- name: List what groups each user is in.
command: "groups {{ item }}"
with_items: "{{ fpsd_crawler_system_account }}"
register: groups_result
always_run: true
changed_when: false

- name: Add users to system group for running crawler.
user:
append: yes
groups: "{{ fpsd_crawler_system_account }}"
name: "{{ item.1 }}"
when: "fpsd_crawler_system_account not in item.0.stdout"
with_together:
- "{{ groups_result.results }}"
- "{{ fpsd_database_usernames }}"
failed_when: true
name: "{{ item }}"
with_items: "{{ fpsd_database_usernames }}"

- name: Create project directory.
file:
Expand Down

0 comments on commit 4f96bc0

Please sign in to comment.