Skip to content

Commit d9ce490

Browse files
authored
Bump to version 2.0.0 (#34)
- Add Debian Bullseye support - Drop Kali Linux and Debian/Devuan Jessie support - Modern Ansible (use collections) - Improve code and CI with lintters - Migrate from legacy Travis to new Travis
1 parent c6ac7ca commit d9ce490

33 files changed

+322
-258
lines changed

.ansible-lint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enable_list:
2+
- fqcn-builtins

.travis.yml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
env:
2-
- PLATFORM='docker-debian-jessie' ANSIBLE_VERSION='ansible>=2.9,<2.10'
3-
- PLATFORM='docker-debian-stretch' ANSIBLE_VERSION='ansible>=2.9,<2.10'
4-
- PLATFORM='docker-debian-buster' ANSIBLE_VERSION='ansible>=2.9,<2.10'
5-
- PLATFORM='docker-ubuntu-bionic' ANSIBLE_VERSION='ansible>=2.9,<2.10'
6-
7-
sudo: required
1+
---
82

9-
dist: trusty
3+
env:
4+
global:
5+
- VAGRANT_VERSION='2.2.18'
6+
jobs:
7+
- PLATFORM='docker-debian-stretch' ANSIBLE_VERSION='>=2.11,<2.12'
8+
- PLATFORM='docker-debian-bullseye' ANSIBLE_VERSION='>=2.11,<2.12'
9+
- PLATFORM='docker-debian-buster' ANSIBLE_VERSION='>=2.11,<2.12'
10+
- PLATFORM='docker-ubuntu-bionic' ANSIBLE_VERSION='>=2.11,<2.12'
11+
12+
jobs:
13+
allow_failures:
14+
- env: PLATFORM='docker-ubuntu-bionic' ANSIBLE_VERSION='>=2.11,<2.12'
15+
16+
os:
17+
- linux
18+
dist: focal
1019

1120
language: python
1221
python:
13-
- 2.7
14-
- 3.6
22+
- 3.8
1523

1624
services:
1725
- docker
1826

1927
before_install:
20-
- wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
21-
- sudo dpkg -i vagrant_2.0.1_x86_64.deb
28+
- sudo apt-get -q update
29+
- sudo apt-get install -y yamllint
30+
- sudo wget -nv https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb
31+
- sudo dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb
2232

2333
install:
24-
- pip install "$ANSIBLE_VERSION"
34+
- sudo pip install "ansible-core$ANSIBLE_VERSION"
35+
- sudo pip install ansible-lint
36+
- ansible-galaxy collection install ansible.posix community.general
2537

2638
script:
2739
- VAGRANT_DEFAULT_PROVIDER=docker vagrant up $PLATFORM
@@ -31,6 +43,14 @@ script:
3143
&& (echo 'Idempotence test: pass' && exit 0)
3244
|| (echo 'Idempotence test: fail' && exit 1)
3345
- VAGRANT_DEFAULT_PROVIDER=docker vagrant status
46+
- >
47+
yamllint .
48+
&& (echo 'YAML lint test: pass' && exit 0)
49+
|| (echo 'YAML lint test: fail' && exit 1)
50+
- >
51+
ansible-lint -v tests/test.yml
52+
&& (echo 'Ansible lint test: pass' && exit 0)
53+
|| (echo 'Ansible lint test: fail' && exit 1)
3454
3555
notifications:
3656
webhooks: https://galaxy.ansible.com/api/v1/notifications/

.yamllint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
3+
rules:
4+
line-length: disable

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Ansible Debian/Devuan/Kali/Ubuntu/Raspbian bootstrap
1+
Ansible Debian/Devuan/Ubuntu/Raspbian bootstrap
22
====================================================
33

4-
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-HanXHX.debian_bootstrap-blue.svg)](https://galaxy.ansible.com/HanXHX/debian_bootstrap) [![Build Status](https://travis-ci.org/HanXHX/ansible-debian-bootstrap.svg?branch=master)](https://travis-ci.org/HanXHX/ansible-debian-bootstrap)
4+
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-HanXHX.debian_bootstrap-blue.svg)](https://galaxy.ansible.com/HanXHX/debian_bootstrap) [![Build Status](https://app.travis-ci.com/HanXHX/ansible-debian-bootstrap.svg?branch=master)](https://app.travis-ci.com/HanXHX/ansible-debian-bootstrap)
55

6-
This role bootstraps Debian/Devuan/Kali/Ubuntu/Raspbian hosts:
6+
This role bootstraps Debian/Devuan/Ubuntu/Raspbian hosts:
77

88
- Configure APT (sources.list)
99
- Install minimal packages (vim, htop...)
@@ -20,20 +20,19 @@ Supported versions
2020

2121
| OS | Working | Stable (active support) |
2222
| --------------------- | ------- | ----------------------- |
23-
| Debian Jessie (8) | Yes | Yes |
2423
| Debian Stretch (9) | Yes | Yes |
2524
| Debian Buster (10) | Yes | Yes |
26-
| Devuan Jessie (1) | Yes | No |
25+
| Debian Bullseye (11) | Yes | Yes |
2726
| Devuan Ascii (2) | Yes | No |
28-
| Kali Linux | Partial | No |
2927
| Raspbian Stretch (9) | Experimental | No |
3028
| Raspbian Buster (10) | Experimental | No |
3129
| Ubuntu Bionic (18.04) | Yes | No |
3230

3331
Requirements
3432
------------
3533

36-
Min Ansible 2.9
34+
- Ansible >= 2.11
35+
- Collections: [ansible.posix collection](https://galaxy.ansible.com/ansible/posix) / [community.general](https://galaxy.ansible.com/community/general)
3736

3837
Role Variables
3938
--------------

Vagrantfile

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,22 @@
66
Vagrant.configure("2") do |config|
77

88
vms_debian = [
9-
{ :name => "debian-jessie", :box => "debian/jessie64", :vars => { dbs_use_systemd: true, dbs_set_apt: false } },
10-
{ :name => "debian-jessie-sysvinit", :box => "debian/jessie64", :vars => { dbs_use_systemd: false, dbs_set_apt: false} },
11-
{ :name => "debian-stretch", :box => "debian/stretch64", :vars => { dbs_use_systemd: true } },
12-
{ :name => "debian-stretch-sysvinit", :box => "debian/stretch64", :vars => { dbs_use_systemd: false } },
13-
{ :name => "debian-buster", :box => "debian/buster64", :vars => { dbs_use_systemd: true } },
14-
{ :name => "debian-buster-sysvinit", :box => "debian/buster64", :vars => { dbs_use_systemd: false } },
15-
{ :name => "devuan-jessie", :box => "https://files.devuan.org/devuan_jessie/virtual/devuan_jessie_1.0.0_amd64_vagrant.box" },
16-
{ :name => "devuan-ascii", :box => "https://files.devuan.org/devuan_ascii/virtual/devuan_ascii_2.0.0_amd64_vagrant.box" },
17-
{ :name => "kali", :box => "offensive-security/kali-linux-light", :vars => { dbs_use_systemd: true } },
18-
{ :name => "kali-sysvinit", :box => "offensive-security/kali-linux-light", :vars => { dbs_use_systemd: false } },
19-
{ :name => "raspbian-stretch", :box => "gvfoster/raspbian",:vars => { dbs_use_systemd: true } },
20-
{ :name => "ubuntu-bionic", :box => "ubuntu/bionic64", :vars => { dbs_use_systemd: true } },
9+
{ :name => "debian-stretch", :box => "debian/stretch64", :vars => { dbs_use_systemd: true } },
10+
{ :name => "debian-stretch-sysvinit", :box => "debian/stretch64", :vars => { dbs_use_systemd: false } },
11+
{ :name => "debian-buster", :box => "debian/buster64", :vars => { dbs_use_systemd: true } },
12+
{ :name => "debian-buster-sysvinit", :box => "debian/buster64", :vars => { dbs_use_systemd: false } },
13+
{ :name => "debian-bullseye", :box => "debian/bullseye64", :vars => { dbs_use_systemd: true } },
14+
{ :name => "debian-bullseye-sysvinit", :box => "debian/bullseye64", :vars => { dbs_use_systemd: false } },
15+
{ :name => "devuan-ascii", :box => "https://files.devuan.org/devuan_ascii/virtual/devuan_ascii_2.0.0_amd64_vagrant.box" },
16+
{ :name => "raspbian-stretch", :box => "gvfoster/raspbian",:vars => { dbs_use_systemd: true } },
17+
{ :name => "ubuntu-bionic", :box => "ubuntu/bionic64", :vars => { dbs_use_systemd: true } },
2118
]
2219

2320
conts = [
24-
{ :name => "docker-debian-jessie", :docker => "hanxhx/vagrant-ansible:debian8", :vars => { dbs_set_apt: false } },
25-
{ :name => "docker-debian-stretch", :docker => "hanxhx/vagrant-ansible:debian9", :vars => {} },
26-
{ :name => "docker-debian-buster", :docker => "hanxhx/vagrant-ansible:debian10", :vars => {} },
27-
{ :name => "docker-ubuntu-bionic", :docker => "hanxhx/vagrant-ansible:ubuntu18.04", :vars => {} }
21+
{ :name => "docker-debian-stretch", :docker => "hanxhx/vagrant-ansible:debian9", :vars => {} },
22+
{ :name => "docker-debian-buster", :docker => "hanxhx/vagrant-ansible:debian10", :vars => {} },
23+
{ :name => "docker-debian-bullseye", :docker => "hanxhx/vagrant-ansible:debian11", :vars => {} },
24+
{ :name => "docker-ubuntu-bionic", :docker => "hanxhx/vagrant-ansible:ubuntu18.04", :vars => {} }
2825
]
2926

3027
config.vm.network "private_network", type: "dhcp"
@@ -36,12 +33,18 @@ Vagrant.configure("2") do |config|
3633
d.remains_running = true
3734
d.has_ssh = true
3835
end
36+
37+
if opts[:name].include? "bullseye"
38+
m.vm.provision "shell", inline: "[ -f '/root/first_provision' ] || (apt-get update -qq && apt-get -y dist-upgrade && touch /root/first_provision)"
39+
end
40+
3941
m.vm.provision "ansible" do |ansible|
4042
ansible.playbook = "tests/test.yml"
4143
ansible.verbose = 'vv'
4244
ansible.become = true
4345
ansible.extra_vars = opts[:vars]
4446
ansible.raw_arguments = ["-D"]
47+
ansible.compatibility_mode = "2.0"
4548
end
4649
end
4750
end
@@ -51,23 +54,29 @@ Vagrant.configure("2") do |config|
5154
if opts[:name].include? "devuan" or opts[:name].include? "ubuntu"
5255
m.vm.provision "shell", inline: "apt-get update -qq && apt-get -y install python"
5356
end
57+
58+
if opts[:name].include? "bullseye"
59+
m.vm.provision "shell", inline: "apt-get update -qq && apt-get -y dist-upgrade"
60+
end
61+
5462
if opts[:name].include? "devuan"
5563
m.vm.box_url = opts[:box]
5664
m.vm.box = opts[:name]
5765
else
5866
m.vm.box = opts[:box]
5967
end
68+
6069
m.vm.provider "virtualbox" do |v|
6170
v.cpus = 1
62-
v.memory = 256
63-
v.gui = false # Force hide gui with Kali Linux
71+
v.memory = 512
6472
end
6573
m.vm.provision "ansible" do |ansible|
6674
ansible.playbook = "tests/test.yml"
6775
ansible.verbose = 'vv'
6876
ansible.become = true
6977
ansible.extra_vars = opts[:vars]
7078
ansible.raw_arguments = ["-D"]
79+
ansible.compatibility_mode = "2.0"
7180
end
7281
end
7382
end

defaults/main.yml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
# -------------------------
24
# APT configuration
35
# -------------------------
@@ -57,60 +59,60 @@ dbs_groups: []
5759
# Sysctl
5860
# -------------------------
5961
dbs_sysctl_config:
60-
### IMPROVE SYSTEM MEMORY MANAGEMENT ###
61-
# Increase size of file handles and inode cache
62+
### IMPROVE SYSTEM MEMORY MANAGEMENT ###
63+
# Increase size of file handles and inode cache
6264
'fs.file-max': '2097152'
63-
# Do less swapping
65+
# Do less swapping
6466
'vm.swappiness': '10'
6567
'vm.dirty_ratio': '60'
6668
'vm.dirty_background_ratio': '2'
67-
### GENERAL NETWORK SECURITY OPTIONS ###
68-
# Number of times SYNACKs for passive TCP connection.
69+
### GENERAL NETWORK SECURITY OPTIONS ###
70+
# Number of times SYNACKs for passive TCP connection.
6971
'net.ipv4.tcp_synack_retries': '2'
70-
# Allowed local port range
72+
# Allowed local port range
7173
'net.ipv4.ip_local_port_range': '2000 65535'
72-
# Protect Against TCP Time-Wait
74+
# Protect Against TCP Time-Wait
7375
'net.ipv4.tcp_rfc1337': '1'
74-
# Decrease the time default value for tcp_fin_timeout connection
76+
# Decrease the time default value for tcp_fin_timeout connection
7577
'net.ipv4.tcp_fin_timeout': '15'
76-
# Decrease the time default value for connections to keep alive
78+
# Decrease the time default value for connections to keep alive
7779
'net.ipv4.tcp_keepalive_time': '300'
7880
'net.ipv4.tcp_keepalive_probes': '5'
7981
'net.ipv4.tcp_keepalive_intvl': '15'
80-
# Resist SYN flood attack
82+
# Resist SYN flood attack
8183
'net.ipv4.tcp_syncookies': '1'
82-
### TUNING NETWORK PERFORMANCE ###
83-
# Default Socket Receive Buffer
84+
### TUNING NETWORK PERFORMANCE ###
85+
# Default Socket Receive Buffer
8486
'net.core.rmem_default': '31457280'
85-
# Maximum Socket Receive Buffer
87+
# Maximum Socket Receive Buffer
8688
'net.core.rmem_max': '12582912'
87-
# Default Socket Send Buffer
89+
# Default Socket Send Buffer
8890
'net.core.wmem_default': '31457280'
89-
# Maximum Socket Send Buffer
91+
# Maximum Socket Send Buffer
9092
'net.core.wmem_max': '12582912'
91-
# Increase number of incoming connections
93+
# Increase number of incoming connections
9294
'net.core.somaxconn': '65536'
93-
# Increase number of incoming connections backlog
95+
# Increase number of incoming connections backlog
9496
'net.core.netdev_max_backlog': '65536'
95-
# Increase the maximum amount of option memory buffers
97+
# Increase the maximum amount of option memory buffers
9698
'net.core.optmem_max': '25165824'
97-
# Increase the maximum total buffer-space allocatable
98-
# This is measured in units of pages (4096 bytes)
99+
# Increase the maximum total buffer-space allocatable
100+
# This is measured in units of pages (4096 bytes)
99101
'net.ipv4.tcp_mem': '65536 131072 262144'
100102
'net.ipv4.udp_mem': '65536 131072 262144'
101-
# Increase the read-buffer space allocatable
103+
# Increase the read-buffer space allocatable
102104
'net.ipv4.tcp_rmem': '8192 87380 16777216'
103105
'net.ipv4.udp_rmem_min': '16384'
104-
# Increase the write-buffer-space allocatable
106+
# Increase the write-buffer-space allocatable
105107
'net.ipv4.tcp_wmem': '8192 65536 16777216'
106108
'net.ipv4.udp_wmem_min': '16384'
107-
# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
109+
# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
108110
'net.ipv4.tcp_max_tw_buckets': '1440000'
109-
# Reuse TIME-WAIT state for outgoing connexion (safe)
111+
# Reuse TIME-WAIT state for outgoing connexion (safe)
110112
'net.ipv4.tcp_tw_reuse': '1'
111-
# Increase system IP port limits to allow for more connections
113+
# Increase system IP port limits to allow for more connections
112114
'net.ipv4.tcp_window_scaling': '1'
113-
# number of packets to keep in backlog before the kernel starts dropping them
115+
# number of packets to keep in backlog before the kernel starts dropping them
114116
'net.ipv4.tcp_max_syn_backlog': '3240000'
115117

116118
# Internal use (DO NOT UPDATE)

handlers/main.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
---
2+
23
- name: restart openntpd
3-
service: name=openntpd state=restarted
4+
ansible.builtin.service:
5+
name: openntpd
6+
state: restarted
47

58
- name: restart ntp
6-
service: name=ntp state=restarted
9+
ansible.builtin.service:
10+
name: ntp
11+
state: restarted
712

813
- name: restart cron
9-
service: name=cron state=restarted
14+
ansible.builtin.service:
15+
name: cron
16+
state: restarted
1017

1118
- name: restart rsyslog
12-
service: name=rsyslog state=restarted
19+
ansible.builtin.service:
20+
name: rsyslog
21+
state: restarted
1322

1423
- name: update tzdata
15-
command: dpkg-reconfigure -f noninteractive tzdata
24+
ansible.builtin.command: dpkg-reconfigure -f noninteractive tzdata
1625

1726
- name: locale-gen
18-
command: locale-gen
27+
ansible.builtin.command: locale-gen
1928

2029
- name: reload networking
21-
service: name=networking state=reloaded
30+
ansible.builtin.service:
31+
name: networking
32+
state: reloaded

meta/main.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
---
2+
23
galaxy_info:
4+
role_name: debian_bootstrap
5+
namespace: HanXHX
36
author: Emilien Mantel
4-
description: Normalize and prepare a Debian/Devuan/Kali Linux server
7+
description: Normalize and prepare a Debian/Devuan/Ubuntu Linux server
58
company:
69
license: GPLv2
7-
min_ansible_version: 2.9
10+
min_ansible_version: 2.11
811
platforms:
9-
- name: Debian
10-
versions:
11-
- jessie
12-
- stretch
13-
- buster
14-
- name: Devuan
15-
versions:
16-
- jessie
17-
- ascii
18-
- name: Kali Linux
19-
versions:
20-
- rolling-kali
21-
- name: Ubuntu
22-
versions:
23-
- bionic
12+
- name: Debian
13+
versions:
14+
- stretch
15+
- buster
16+
- bullseye
17+
- name: Devuan
18+
versions:
19+
- ascii
20+
- name: Ubuntu
21+
versions:
22+
- bionic
2423
galaxy_tags:
25-
- networking
26-
- packaging
27-
- system
28-
- debian
29-
- apt
30-
- alternatives
31-
- editor
32-
- ntp
24+
- networking
25+
- packaging
26+
- system
27+
- debian
28+
- apt
29+
- alternatives
30+
- editor
31+
- ntp
32+
3333
dependencies: []

0 commit comments

Comments
 (0)