iloth_ansible/roles/common/tasks/main.yml

52 lines
1006 B
YAML

---
- 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