Compare commits
No commits in common. "master" and "feature/debian-bullseye" have entirely different histories.
master
...
feature/de
6 changed files with 10 additions and 71 deletions
|
@ -30,8 +30,6 @@ ensure_ansible_version: 2.10.3
|
||||||
enable_sudo: yes
|
enable_sudo: yes
|
||||||
# Allow passwordless sudo (applied to group wheel)
|
# Allow passwordless sudo (applied to group wheel)
|
||||||
enable_passwordless_sudo: yes
|
enable_passwordless_sudo: yes
|
||||||
# Skip provisioning of the firewall
|
|
||||||
skip_firewall: no
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
|
@ -43,8 +41,7 @@ Example Playbook
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
- BSD-3-Clause
|
MIT
|
||||||
- MIT
|
|
||||||
|
|
||||||
Author Information
|
Author Information
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -17,11 +17,4 @@ ensure_ansible_version: 2.10.3
|
||||||
# Allow sudo with a password (applied to group sudo)
|
# Allow sudo with a password (applied to group sudo)
|
||||||
enable_sudo: yes
|
enable_sudo: yes
|
||||||
# Allow passwordless sudo (applied to group wheel)
|
# Allow passwordless sudo (applied to group wheel)
|
||||||
enable_passwordless_sudo: yes
|
enable_passwordless_sudo: yes
|
||||||
# Allow root to connect through SSH
|
|
||||||
enable_ssh_for_root: yes
|
|
||||||
# Allow root to connect only using public key authentication, no password
|
|
||||||
enable_ssh_for_root_prohibit_password: no
|
|
||||||
# Skip provisioning of the firewall
|
|
||||||
skip_firewall: no
|
|
||||||
authorized_keys_are_exclusive: false # Be careful, this will delete non-Ansible-managed authorized keys from the target!
|
|
|
@ -1,7 +1,2 @@
|
||||||
---
|
---
|
||||||
# handlers file for common
|
# handlers file for common
|
||||||
- name: Restart SSH
|
|
||||||
ansible.builtin.service:
|
|
||||||
name: ssh
|
|
||||||
state: restarted
|
|
||||||
become: true
|
|
|
@ -1,7 +1,7 @@
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: jotbe
|
author: your name
|
||||||
description: Common packages and configuration
|
description: your description
|
||||||
company: ""
|
company: your company (optional)
|
||||||
|
|
||||||
# If the issue tracker for your role is not on github, uncomment the
|
# If the issue tracker for your role is not on github, uncomment the
|
||||||
# next line and provide a value
|
# next line and provide a value
|
||||||
|
@ -14,9 +14,7 @@ galaxy_info:
|
||||||
# - GPL-3.0-only
|
# - GPL-3.0-only
|
||||||
# - Apache-2.0
|
# - Apache-2.0
|
||||||
# - CC-BY-4.0
|
# - CC-BY-4.0
|
||||||
license:
|
license: license (GPL-2.0-or-later, MIT, etc)
|
||||||
- BSD-3-Clause
|
|
||||||
- MIT
|
|
||||||
|
|
||||||
min_ansible_version: 2.4
|
min_ansible_version: 2.4
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,10 @@
|
||||||
import_role:
|
import_role:
|
||||||
name: geerlingguy.firewall
|
name: geerlingguy.firewall
|
||||||
tags: firewall
|
tags: firewall
|
||||||
when: not skip_firewall
|
|
||||||
|
|
||||||
- include: locales-debian.yml
|
- include: locales-debian.yml
|
||||||
become: true
|
become: true
|
||||||
when:
|
when: ansible_facts['os_family'] == 'Debian'
|
||||||
- ansible_facts['os_family'] == 'Debian'
|
|
||||||
- not ansible_is_chroot
|
|
||||||
|
|
||||||
- include: users.yml
|
- include: users.yml
|
||||||
become: true
|
become: true
|
||||||
|
|
|
@ -11,14 +11,6 @@
|
||||||
groups: users
|
groups: users
|
||||||
with_items: "{{ users }}"
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
- name: 'Add docker users'
|
|
||||||
user:
|
|
||||||
name: "{{ item }}"
|
|
||||||
groups: docker
|
|
||||||
append: yes
|
|
||||||
with_items: "{{ docker_users }}"
|
|
||||||
when: docker_users | count
|
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: 'Ensure that sudo group is existing'
|
- name: 'Ensure that sudo group is existing'
|
||||||
group:
|
group:
|
||||||
|
@ -52,9 +44,8 @@
|
||||||
user: "{{ item }}"
|
user: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
key: "{{ lookup('file', 'public_keys/id_{{ item }}.pub') }}"
|
key: "{{ lookup('file', 'public_keys/id_{{ item }}.pub') }}"
|
||||||
exclusive: "{{ authorized_keys_are_exclusive | bool }}"
|
|
||||||
with_items: "{{ users }}"
|
with_items: "{{ users }}"
|
||||||
ignore_errors: true
|
ignore_errors: yes
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: 'Ensure that wheel group is existing'
|
- name: 'Ensure that wheel group is existing'
|
||||||
|
@ -80,38 +71,6 @@
|
||||||
files:
|
files:
|
||||||
- /etc/sudoers
|
- /etc/sudoers
|
||||||
- /usr/local/etc/sudoers # e.g. FreeBSD
|
- /usr/local/etc/sudoers # e.g. FreeBSD
|
||||||
|
|
||||||
- name: 'Disable SSH for root'
|
|
||||||
lineinfile:
|
|
||||||
dest: "/etc/ssh/sshd_config"
|
|
||||||
state: present
|
|
||||||
regexp: '^#?\s*PermitRootLogin'
|
|
||||||
line: 'PermitRootLogin No'
|
|
||||||
notify: Restart SSH
|
|
||||||
when:
|
|
||||||
- enable_ssh_for_root | bool == false
|
|
||||||
|
|
||||||
- name: 'Enable SSH for root through password or key'
|
|
||||||
lineinfile:
|
|
||||||
dest: "/etc/ssh/sshd_config"
|
|
||||||
state: present
|
|
||||||
regexp: '^#?\s*PermitRootLogin'
|
|
||||||
line: 'PermitRootLogin Yes'
|
|
||||||
notify: Restart SSH
|
|
||||||
when:
|
|
||||||
- enable_ssh_for_root | bool == true
|
|
||||||
- enable_ssh_for_root_prohibit_password | bool == false
|
|
||||||
|
|
||||||
- name: 'Enable SSH for root through key only'
|
|
||||||
lineinfile:
|
|
||||||
dest: "/etc/ssh/sshd_config"
|
|
||||||
state: present
|
|
||||||
regexp: '^#?\s*PermitRootLogin'
|
|
||||||
line: 'PermitRootLogin prohibit-password'
|
|
||||||
notify: Restart SSH
|
|
||||||
when:
|
|
||||||
- enable_ssh_for_root | bool == true
|
|
||||||
- enable_ssh_for_root_prohibit_password | bool == true
|
|
||||||
when:
|
when:
|
||||||
- enable_sudo
|
- enable_sudo
|
||||||
- enable_passwordless_sudo
|
- enable_passwordless_sudo
|
||||||
|
@ -123,4 +82,4 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ item }}"
|
owner: "{{ item }}"
|
||||||
group: "{{ item }}"
|
group: "{{ item }}"
|
||||||
with_items: "{{ users }}"
|
with_items: "{{ users }}"
|
Loading…
Add table
Reference in a new issue