1) not necessary to make 'find highest uid' conditional (and the
check was checking 0 instead of !0 anyway)
2) fix up choice of "calculated or default" using "| default()"
Signed-off-by: Dan Mick <dan.mick@redhat.com>
- name: Find highest used subuid
shell: "awk -F: '{print $2+$3}' /etc/subuid | sort -n | tail -1"
register: highest_subuid
- when: subuid_check.rc == 0 or subgid_check.rc == 0
changed_when: false
- name: Set next available UID range
set_fact:
- new_uid: "{{ (highest_subuid.stdout | int + 1) if highest_subuid is defined else 100000 }}"
+ new_uid: "{{ (highest_subuid.stdout | int + 1) | default(100000) }}"
- name: Add jenkins-build to /etc/subuid
lineinfile: