diff --git a/apps/accounts/automations/push_account/host/aix/main.yml b/apps/accounts/automations/push_account/host/aix/main.yml index 7c43c5220..2dc10fdc2 100644 --- a/apps/accounts/automations/push_account/host/aix/main.yml +++ b/apps/accounts/automations/push_account/host/aix/main.yml @@ -8,7 +8,7 @@ ansible.builtin.user: name: "{{ account.username }}" shell: "{{ params.shell }}" - home: "{{ '/home/' + account.username }}" + home: "{{ params.home | default('/home/' + account.username, true) }}" groups: "{{ params.groups }}" expires: -1 state: present @@ -18,20 +18,6 @@ name: "{{ account.username }}" state: present - - name: Check home dir exists - ansible.builtin.stat: - path: "{{ '/home/' + account.username }}" - register: home_existed - - - name: Set home dir permission - ansible.builtin.file: - path: "{{ '/home/' + account.username }}" - owner: "{{ account.username }}" - group: "{{ account.username }}" - mode: "0700" - when: - - home_existed.stat.exists == true - - name: Add user groups ansible.builtin.user: name: "{{ account.username }}" diff --git a/apps/accounts/automations/push_account/host/aix/manifest.yml b/apps/accounts/automations/push_account/host/aix/manifest.yml index 78a44a4e9..5421d24d8 100644 --- a/apps/accounts/automations/push_account/host/aix/manifest.yml +++ b/apps/accounts/automations/push_account/host/aix/manifest.yml @@ -16,6 +16,12 @@ params: label: 'Shell' default: '/bin/bash' + - name: home + type: str + label: '家目录' + default: '' + help_text: '默认家目录 /home/系统用户名: /home/username' + - name: groups type: str label: '用户组' diff --git a/apps/accounts/automations/push_account/host/posix/main.yml b/apps/accounts/automations/push_account/host/posix/main.yml index 7c43c5220..2dc10fdc2 100644 --- a/apps/accounts/automations/push_account/host/posix/main.yml +++ b/apps/accounts/automations/push_account/host/posix/main.yml @@ -8,7 +8,7 @@ ansible.builtin.user: name: "{{ account.username }}" shell: "{{ params.shell }}" - home: "{{ '/home/' + account.username }}" + home: "{{ params.home | default('/home/' + account.username, true) }}" groups: "{{ params.groups }}" expires: -1 state: present @@ -18,20 +18,6 @@ name: "{{ account.username }}" state: present - - name: Check home dir exists - ansible.builtin.stat: - path: "{{ '/home/' + account.username }}" - register: home_existed - - - name: Set home dir permission - ansible.builtin.file: - path: "{{ '/home/' + account.username }}" - owner: "{{ account.username }}" - group: "{{ account.username }}" - mode: "0700" - when: - - home_existed.stat.exists == true - - name: Add user groups ansible.builtin.user: name: "{{ account.username }}" diff --git a/apps/accounts/automations/push_account/host/posix/manifest.yml b/apps/accounts/automations/push_account/host/posix/manifest.yml index efeb11b93..1da168a44 100644 --- a/apps/accounts/automations/push_account/host/posix/manifest.yml +++ b/apps/accounts/automations/push_account/host/posix/manifest.yml @@ -18,6 +18,12 @@ params: default: '/bin/bash' help_text: '' + - name: home + type: str + label: '家目录' + default: '' + help_text: '默认家目录 /home/系统用户名: /home/username' + - name: groups type: str label: '用户组'