import du dossier ansible

This commit is contained in:
2020-04-19 03:28:50 +02:00
parent 8cce13d9e4
commit 534737fd56
21 changed files with 974 additions and 0 deletions

10
roles/common/README.md Normal file
View File

@@ -0,0 +1,10 @@
common
=========
Update system, install base packages, configure system ...
Role Variables
--------------
This role just needs to have an email defined in vars

View File

@@ -0,0 +1,31 @@
---
commonRequirePackages:
- htop
- vim
- man
- bash-completion
- locales
- python-pip
- wget
- bzip2
- lsof
- sudo
- tree
- ccze
- vim-common
- tmux
- curl
- git
- unzip
- ufw
commonDeletePackages:
- bind9
- telnet
- ftp
locales: "fr_FR.UTF-8"
# Timezone
Area : Europe
City: Paris

View File

@@ -0,0 +1,51 @@
---
- name: Update & upgrade system
apt:
update_cache: yes
upgrade: dist
- name: Install common required packages
apt:
name: "{{ commonRequirePackages }}"
- name: Remove useless stuff
apt:
name: "{{ commonDeletePackages }}"
state: absent
- name: Set the hostname
hostname:
name: "{{ cthostname }}"
- name: Set locales
locale_gen:
name: "{{ locales }}"
state: present
- name: Set the Timezone to {{ Area }}/{{ City }}
shell: "ln -sf /usr/share/zoneinfo/{{ Area}}/{{ City }} /etc/localtime"
- name: Fix /etc/hosts removing the old hostname
tags:
- hosts
lineinfile:
state: present
dest: /etc/hosts
line: "{{ ansible_default_ipv4.address }} {{ cthostname }} {{ domain }}"
regexp: "^{{ ansible_default_ipv4.address }}"
- name: Allow SSH connexions
ufw:
rule: limit
port: ssh
proto: tcp
- name: Set logging off
ufw:
logging: 'off'
- name: Deny everything and enable UFW
ufw:
state: enabled
policy: deny