Commit 36489f2a authored by Maciej Delmanowski's avatar Maciej Delmanowski

[debops.users] Use more readable task labels

parent 2c47b9e4
......@@ -21,6 +21,8 @@
gid: '{{ item.gid | d(omit) }}'
state: 'present'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present")} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') != 'absent' and (item.private_group|d(True))|bool)
no_log: '{{ item.no_log | d(True if item.password|d() else False) }}'
......@@ -74,6 +76,9 @@
ssh_key_passphrase: '{{ item.ssh_key_passphrase | d(omit) }}'
ssh_key_type: '{{ item.ssh_key_type | d(omit) }}'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"),
"gecos": item.comment|d()} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'ignore' ] and (item.user|d(True))|bool)
no_log: '{{ item.no_log | d(True if item.password|d() else False) }}'
......@@ -86,6 +91,9 @@
group: '{{ item.home_group | d(omit) }}'
mode: '{{ item.home_mode | d(omit) }}'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"),
"home": (item.home | d("~" + item.name))} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and item.createhome|d(True) and
(item.home_owner|d() or item.home_group|d() or item.home_mode|d()) and (item.user|d(True))|bool)
......@@ -106,7 +114,7 @@
| selectattr("home_acl", "defined") | list
| subelements("home_acl") }}'
loop_control:
label: '{{ {"name": item.0.name, "home_acl": item.1} }}'
label: '{{ {"name": item.0.name, "state": item.0.state|d("present"), "home_acl": item.1} }}'
when: (users__enabled|bool and users__acl_enabled|bool and
item.0.name|d() and item.0.name != 'root' and
item.0.state|d('present') not in [ 'absent', 'ignore' ] and
......@@ -118,6 +126,8 @@
args:
creates: '/var/lib/systemd/linger/{{ item.name }}'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"), "linger": item.linger|d(False)} }}'
when: (users__enabled|bool and ansible_service_mgr == 'systemd' and
item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and
......@@ -129,6 +139,8 @@
args:
removes: '/var/lib/systemd/linger/{{ item.name }}'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"), "linger": item.linger|d(False)} }}'
when: (users__enabled|bool and ansible_service_mgr == 'systemd' and
item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and
......@@ -142,6 +154,8 @@
user: '{{ item.name }}'
exclusive: '{{ item.sshkeys_exclusive | d(omit) }}'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"), "sshkeys": item.sshkeys|d()} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and item.createhome|d(True) and
item.sshkeys|d() and item.sshkeys_state|d('present') != 'absent' and (item.user|d(True))|bool)
......@@ -152,6 +166,9 @@
path: '~{{ item.name }}/.ssh/authorized_keys'
state: 'absent'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"),
"sshkeys_state": item.sshkeys_state|d("present")} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and item.createhome|d(True) and
item.sshkeys_state|d('present') == 'absent' and (item.user|d(True))|bool)
......@@ -167,6 +184,9 @@
become_user: '{{ item.name }}'
become: True
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"),
"forward": item.forward|d()} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') not in [ 'absent', 'ignore' ] and
item.createhome|d(True) and item.forward|d() and (item.user|d(True))|bool)
......@@ -180,6 +200,12 @@
yadm pull
fi
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present"),
"dotfiles": (item.dotfiles | d(item.dotfiles_enabled | d(users__dotfiles_enabled))),
"dotfiles_repo": ((item.dotfiles_repo | d(users__dotfiles_repo))
if ((item.dotfiles|d(item.dotfiles_enabled|d(users__dotfiles_enabled)))|bool)
else "")} }}'
become: True
become_user: '{{ item.name }}'
check_mode: False
......@@ -262,6 +288,8 @@
name: '{{ item.group | d(item.name) }}'
state: 'absent'
loop: '{{ users__combined_accounts | parse_kv_items }}'
loop_control:
label: '{{ {"name": item.name, "state": item.state|d("present")} }}'
when: (users__enabled|bool and item.name|d() and item.name != 'root' and
item.state|d('present') == 'absent' and
(item.private_group|d(True))|bool)
......
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