Commit fc441429 authored by Chris Croome's avatar Chris Croome

add support for two different update users strategies

parent 283d065e
Pipeline #8483 passed with stage
in 23 seconds
---
# If users_update_strategy is set to "all" then all users will be configured
# everytime the tasks in this rol are run, it it is set to "changed" than only
# user accounts that have changes will be updated.
users_update_strategy: changed
# Define users_apache to true for this role to manage the Apache VirtualHosts
users_apache: false
# Define users_chroot to true for members of the chroot group to be chrooted
......
......@@ -22,12 +22,38 @@
dest: "{{ users_state_dir }}/proposed.yml"
check_mode: false
- name: Check users changed
include_tasks: users_changed.yml
- name: Set an empty users_update array
set_fact:
users_update: []
- name: Print the users to update
debug:
msg: "User to update: {{ users_update }}"
- name: Set users to update to all
block:
- name: Add all the users to the users_update array
set_fact:
updates_users: "{{ update_users }} + [ '{{ user.key }}' ]"
loop: "{{ users | dict2items }}"
loop_control:
loop_var: user
label: "{{ user.key }}"
- name: Print all the users to update
debug:
msg: "User to update: {{ users_update }}"
when: ( users_update_strategy is not defined ) or ( users_update_strategy == "all" )
- name: Check which users accounts are changed
block:
- name: Check users changed
include_tasks: users_changed.yml
- name: Print the changed users to update
debug:
msg: "User to update: {{ users_update }}"
when: ( users_update_strategy is defined ) and ( users_update_strategy == "changed" )
- name: Check variables for users to update
include_tasks: user_check.yml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment