forked from evolix/ansible-roles
tomcat-instance: fail if uid already exists
This commit is contained in:
parent
5b2d3b09d0
commit
0b528f15da
|
@ -30,6 +30,7 @@ The **patch** part changes incrementally at each release.
|
|||
* apt: disable APT Periodic
|
||||
* evoacme: upstream release 20.12
|
||||
* evocheck: upstream release 20.12
|
||||
* tomcat-instance: fail if uid already exists
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
|
@ -1,4 +1,24 @@
|
|||
---
|
||||
|
||||
- fail:
|
||||
msg: "You must provide a value for the 'tomcat_instance_port' variable."
|
||||
when: tomcat_instance_port is not defined or tomcat_instance_port == ''
|
||||
|
||||
|
||||
- name: "Test if uid '{{ tomcat_instance_port }}' exists"
|
||||
command: 'id -un -- "{{ tomcat_instance_port }}"'
|
||||
register: get_login_from_id
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
|
||||
- name: "Fail if uid already exists for another user"
|
||||
fail:
|
||||
msg: "Uid '{{ tomcat_instance_port }}' is already used by '{{ get_login_from_id.stdout }}'. You must change uid for '{{ tomcat_instance_name }}'"
|
||||
when:
|
||||
- get_login_from_id.rc == 0
|
||||
- get_login_from_id.stdout != tomcat_instance_name
|
||||
|
||||
- name: Create group instance
|
||||
group:
|
||||
name: "{{ tomcat_instance_name }}"
|
||||
|
|
Loading…
Reference in a new issue