Compare commits
1 Commits
transcaffe
...
main
Author | SHA1 | Date | |
---|---|---|---|
bd418a6199 |
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
nginx_version: "1.27.2"
|
nginx_version: "1.27.3"
|
||||||
nginx_flavour: alpine
|
nginx_flavour: alpine
|
||||||
nginx_base_path: /opt/nginx
|
nginx_base_path: /opt/nginx
|
||||||
nginx_config_file: "{{ nginx_base_path }}/nginx.conf"
|
nginx_config_file: "{{ nginx_base_path }}/nginx.conf"
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
# `finallycoffee.base.user` ansible role
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
```yaml
|
|
||||||
- hosts: all
|
|
||||||
roles:
|
|
||||||
- role: finallycoffee.base.user
|
|
||||||
vars:
|
|
||||||
users:
|
|
||||||
- name: root
|
|
||||||
- name: alice
|
|
||||||
- name: bob
|
|
||||||
state: present
|
|
||||||
- name: eve
|
|
||||||
state: absent
|
|
||||||
```
|
|
@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
users: []
|
|
@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure user '{{ user.name }}' is {{ user.state }}
|
|
||||||
ansible.builtin.user:
|
|
||||||
name: "{{ user.name }}"
|
|
||||||
state: "{{ user.state }}"
|
|
||||||
system: "{{ user.system | default(false, true) }}"
|
|
||||||
home: "{{ user.home | default(omit, true) }}"
|
|
||||||
create_home: "{{ user.create_home | default(true, true) }}"
|
|
||||||
comment: "{{ user.comment | default(user.gecos | default(omit, true), true) }}"
|
|
||||||
|
|
||||||
- name: Ensure SSH authorized keys for '{{ user.name }}' are {{ user.state }}
|
|
||||||
when:
|
|
||||||
- user.state == 'present'
|
|
||||||
- user.authorized_keys | default([]) | length > 0
|
|
||||||
block:
|
|
||||||
- name: Ensure .ssh directory for user '{{ user.name }}' exists
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ user.home | default('/home/' + user.name) + '/.ssh' }}"
|
|
||||||
state: "directory"
|
|
||||||
owner: "{{ user.name }}"
|
|
||||||
group: "{{ user.name }}"
|
|
||||||
mode: "0700"
|
|
||||||
- name: Ensure key is up to date
|
|
||||||
ansible.posix.authorized_key:
|
|
||||||
user: "{{ user.name }}"
|
|
||||||
state: "{{ key.state | default('present', true) }}"
|
|
||||||
key: "{{ key.key }}"
|
|
||||||
comment: "{{ user.name }}-{{ key.comment }}"
|
|
||||||
loop: "{{ user.authorized_keys }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: key
|
|
||||||
label: "{{ user.name }}-{{ key.comment }}"
|
|
@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure users are configured
|
|
||||||
ansible.builtin.include_tasks:
|
|
||||||
file: "configure-user.yml"
|
|
||||||
loop: "{{ users }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: user
|
|
||||||
label: "{{ user.name }}"
|
|
Loading…
x
Reference in New Issue
Block a user