如何在Ansible中创建没有.bashrc的用户?

时间:2018-04-26 05:27:12

标签: linux ansible

我想创建一个带有干净主目录的用户,但在使用用户模块时,我默认获得文件.bashrc.bash_logout.profile(这些是默认值为/etc/skel/

如何在没有它们的情况下创建用户?

剧本的相关部分:

- name: Create user
  become: true
  user:
    name: johndoe
    state: present
    shell: /bin/bash
    system: no
    createhome: yes
    home: /data/johndoe

1 个答案:

答案 0 :(得分:2)

您必须将skeleton设置为false(或no),如下所示:

- name: Create user
  become: true
  user:
    name: johndoe
    state: present
    shell: /bin/bash
    system: no
    createhome: yes
    home: /data/johndoe
    skeleton: false      # <- add this line