瀏覽代碼

move user

master
父節點
當前提交
a7066a8115
共有 3 個檔案被更改,包括 18 行新增0 行删除
  1. +3
    -0
      tasks/main.yml
  2. +13
    -0
      tasks/move.yaml
  3. +2
    -0
      tasks/users.yml

+ 3
- 0
tasks/main.yml 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存