make distinction between bash and csh shell config
This commit is contained in:
parent
95e4ee8c06
commit
c53f502220
|
@ -17,7 +17,7 @@ users:
|
||||||
keys:
|
keys:
|
||||||
- file: key1
|
- file: key1
|
||||||
state: present
|
state: present
|
||||||
shell_lines:
|
bash_lines:
|
||||||
- line: "testline"
|
- line: "testline"
|
||||||
state: present
|
state: present
|
||||||
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
||||||
|
@ -30,6 +30,6 @@ users:
|
||||||
keys:
|
keys:
|
||||||
- file: key2
|
- file: key2
|
||||||
state: absent
|
state: absent
|
||||||
shell_lines:
|
csh_lines:
|
||||||
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
- line: "alias ls ls -lah"
|
||||||
state: present
|
state: present
|
||||||
|
|
|
@ -11,14 +11,15 @@ Ansible roles to create/configure users on Linux/FreeBSD.
|
||||||
|
|
||||||
| users | | |
|
| users | | |
|
||||||
| ---: |---| ---|
|
| ---: |---| ---|
|
||||||
| _variable name_ | Description | Data type |
|
| _variable name_ | Description | Data type |
|
||||||
| name | username | string |
|
| name | username | string |
|
||||||
| state | whether the user should be created or removed | present/absent |
|
| state | whether the user should be created or removed | present/absent |
|
||||||
| password | string of an encrypted value(1) | string |
|
| password | string of an encrypted value(1) | string |
|
||||||
| groups | additional groups the user should belong to | list |
|
| groups | additional groups the user should belong to | list |
|
||||||
| uid | optionally specify a user id | int |
|
| uid | optionally specify a user id | int |
|
||||||
| keys | list of dictionaries | list |
|
| keys | list of dictionaries | list |
|
||||||
| shell_lines | list of dictionaries | list |
|
| bash_lines | configure lines in .bashrc | list |
|
||||||
|
| csh_lines | configure lines in .cshrc | list |
|
||||||
|
|
||||||
(1) https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module
|
(1) https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module
|
||||||
## Default variables
|
## Default variables
|
||||||
|
@ -47,7 +48,7 @@ users:
|
||||||
keys:
|
keys:
|
||||||
- file: key1
|
- file: key1
|
||||||
state: present
|
state: present
|
||||||
shell_lines:
|
bash_lines:
|
||||||
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
||||||
state: present
|
state: present
|
||||||
- line: "alias ls='ls lah'"
|
- line: "alias ls='ls lah'"
|
||||||
|
@ -56,8 +57,8 @@ users:
|
||||||
keys:
|
keys:
|
||||||
- file: key2
|
- file: key2
|
||||||
state: absent
|
state: absent
|
||||||
shell_lines:
|
csh_lines:
|
||||||
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
- line: "ls ls -lah"
|
||||||
state: absent
|
state: absent
|
||||||
```
|
```
|
||||||
## Using the Role
|
## Using the Role
|
||||||
|
|
|
@ -1,4 +1,40 @@
|
||||||
default_freebsd_shell: "/bin/csh"
|
default_freebsd_shell: "/bin/csh"
|
||||||
default_linux_shell: "/bin/bash"
|
default_linux_shell: "/bin/bash"
|
||||||
default_shell_lines:
|
|
||||||
- SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh
|
|
||||||
|
# Example variables
|
||||||
|
#---
|
||||||
|
#user_groups:
|
||||||
|
# - name: mygroup
|
||||||
|
# gid: 700
|
||||||
|
# - name: mysecondgroup
|
||||||
|
# gid: 702
|
||||||
|
# state: absent
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#users:
|
||||||
|
# - name: remember
|
||||||
|
# state: present
|
||||||
|
# password: "blabla"
|
||||||
|
# groups:
|
||||||
|
# - mygroup
|
||||||
|
# uid: 1100
|
||||||
|
# keys:
|
||||||
|
# - file: key1
|
||||||
|
# state: present
|
||||||
|
# bash_lines:
|
||||||
|
# - line: "testline"
|
||||||
|
# state: present
|
||||||
|
# - line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
|
||||||
|
# state: present
|
||||||
|
# - line: "alias ls='ls lah'"
|
||||||
|
# state: present
|
||||||
|
# ssh_config:
|
||||||
|
# - ServerAliveInterval: 10
|
||||||
|
# - name: test
|
||||||
|
# keys:
|
||||||
|
# - file: key2
|
||||||
|
# state: absent
|
||||||
|
# csh_lines:
|
||||||
|
# - line: "alias ls ls -lah"
|
||||||
|
# state: present
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
backup: yes
|
backup: yes
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- "{{ users }}"
|
- "{{ users }}"
|
||||||
- shell_lines
|
- bash_lines
|
||||||
- skip_missing: true
|
- skip_missing: true
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
state: "{{ item.1.state | default('present')}}"
|
state: "{{ item.1.state | default('present')}}"
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- "{{ users }}"
|
- "{{ users }}"
|
||||||
- shell_lines
|
- csh_lines
|
||||||
- skip_missing: true
|
- skip_missing: true
|
||||||
when: ansible_os_family == 'FreeBSD'
|
when: ansible_os_family == 'FreeBSD'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue