Browse Source

move user

master
parent
commit
a7066a8115
3 changed files with 18 additions and 0 deletions
  1. +3
    -0
      tasks/main.yml
  2. +13
    -0
      tasks/move.yaml
  3. +2
    -0
      tasks/users.yml

+ 3
- 0
tasks/main.yml View File

@@ -5,6 +5,9 @@
- import_tasks: user_groups.yml
when: user_groups is defined

- import_tasks: move.yml
when: users is defined

- import_tasks: users.yml
when: users is defined



+ 13
- 0
tasks/move.yaml View File

@@ -0,0 +1,13 @@
---

- name: move group
command: "groupmod --login {{ item }} {{ users[item].old_name }}"
loop: "{{ users.keys() | list }}"
when: users[item].old_name is defined
failed_when: false

- name: move account
command: "usermod --login {{ item }} {{ users[item].old_name }}"
loop: "{{ users.keys() | list }}"
when: users[item].old_name is defined
failed_when: false

+ 2
- 0
tasks/users.yml View File

@@ -15,6 +15,8 @@
uid: "{{ users[item].uid }}"
home: "{{ users[item].home | default('/home/'+item) }}"
shell: "{{ users[item].shell | default('/usr/bin/fish') }}"
create_home: true
move_home: true
loop: "{{ users.keys() | list }}"
notify: restart systemd-logind.service



Loading…
Cancel
Save