Add a script for the Fedora Username Change project
It will be replaced by self service on Noggin one day and will be removed by then.
This commit is contained in:
parent
3ea2e91e4f
commit
ae20e8c26c
1 changed files with 26 additions and 0 deletions
26
playbooks/manual/rename_user_stg.yml
Normal file
26
playbooks/manual/rename_user_stg.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# This playbook rename a user in staging for the Fedora Username Change project
|
||||
#
|
||||
|
||||
---
|
||||
- name: Rename user on stg
|
||||
hosts: ipa_stg[0]
|
||||
user: root
|
||||
tasks:
|
||||
|
||||
# this is just basic verification for usernale to avoid argument injection in the command
|
||||
# tested with:
|
||||
# ansible-playbook playbooks/rename_user_stg.yml -i localhost, -c local -e old_name=misc -e new_name=notmisc
|
||||
# ansible-playbook playbooks/rename_user_stg.yml -i localhost, -c local -e old_name=misc -e new_name=--notmisc
|
||||
# ansible-playbook playbooks/rename_user_stg.yml -i localhost, -c local -e old_name=misc -e "new_name='not|reboot'"
|
||||
# ansible-playbook playbooks/rename_user_stg.yml -i localhost, -c local -e old_name=misc -e "new_name='not misc'"
|
||||
- name: Check arguments
|
||||
ansible.builtin.fail:
|
||||
msg: "Incorrect argument: {{ item }}"
|
||||
when: "not (item | regex_search('^\\w+$'))"
|
||||
with_items:
|
||||
- "{{ old_name }}"
|
||||
- "{{ new_name }}"
|
||||
|
||||
- name: Rename the user
|
||||
ansible.builtin.command: ipa user-mod "{{ old_name }}" --rename "{{ new_name }}"
|
Loading…
Add table
Add a link
Reference in a new issue