2016-11-07 14:00:57 +01:00
|
|
|
---
|
2016-12-23 20:05:06 +01:00
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: /tmp must be world-writable
|
|
|
|
file:
|
|
|
|
path: /tmp
|
|
|
|
state: directory
|
2017-05-19 22:32:22 +02:00
|
|
|
mode: "u=rwx,g=rwx,o=rwxt"
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_system_chmod_tmp
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Setting default locales
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/locale.gen
|
|
|
|
line: "{{ item }}"
|
2016-12-23 14:12:13 +01:00
|
|
|
create: yes
|
2016-11-07 14:00:57 +01:00
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- "en_US.UTF-8 UTF-8"
|
|
|
|
- "fr_FR ISO-8859-1"
|
|
|
|
- "fr_FR.UTF-8 UTF-8"
|
2016-12-23 14:12:13 +01:00
|
|
|
register: default_locales
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_system_locales
|
2016-12-23 14:12:13 +01:00
|
|
|
|
|
|
|
- name: Reconfigure locales
|
|
|
|
command: /usr/sbin/locale-gen
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_system_locales and default_locales | changed
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2016-12-28 15:06:36 +01:00
|
|
|
- name: Setting default timezone
|
2017-07-12 10:23:21 +02:00
|
|
|
timezone:
|
|
|
|
name: "{{ evolinux_system_timezone | mandatory }}"
|
|
|
|
notify: restart cron
|
2017-07-13 02:20:28 +02:00
|
|
|
when: evolinux_system_set_timezone
|
2016-12-28 15:06:36 +01:00
|
|
|
|
|
|
|
# TODO : find a way to force the console-data configuration
|
|
|
|
# non-interactively (like tzdata ↑)
|
|
|
|
|
2017-11-07 12:18:02 +01:00
|
|
|
- include_role:
|
|
|
|
name: remount-usr
|
2017-05-23 14:55:31 +02:00
|
|
|
|
2017-07-12 10:15:47 +02:00
|
|
|
- name: Ensure automagic vim conf is disabled
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/vim/vimrc
|
|
|
|
regexp: 'let g:skip_defaults_vim ='
|
|
|
|
line: 'let g:skip_defaults_vim = 1'
|
2017-07-12 10:24:09 +02:00
|
|
|
when: evolinux_system_vim_skip_defaults
|
2017-07-12 10:15:47 +02:00
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Setting vim as default editor
|
|
|
|
alternatives:
|
|
|
|
name: editor
|
|
|
|
path: /usr/bin/vim.basic
|
2017-07-12 10:15:47 +02:00
|
|
|
when: evolinux_system_vim_default_editor
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Add "umask 027" to /etc/profile.d/evolinux.sh
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/profile.d/evolinux.sh
|
|
|
|
line: "umask 027"
|
|
|
|
create: yes
|
|
|
|
state: present
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_system_profile
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Set /etc/adduser.conf DIR_MODE to 0700
|
|
|
|
replace:
|
|
|
|
dest: /etc/adduser.conf
|
2017-10-07 22:59:06 +02:00
|
|
|
regexp: "^DIR_MODE=0755$"
|
2016-11-07 14:00:57 +01:00
|
|
|
replace: "DIR_MODE=0700"
|
2017-01-03 16:37:23 +01:00
|
|
|
when: evolinux_system_dirmode_adduser
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
# TODO: trouver comment ne pas faire ça sur Xen Dom-U
|
|
|
|
|
|
|
|
- name: Deactivating login on all tty except tty2
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/securetty
|
|
|
|
line: "tty2"
|
|
|
|
create: yes
|
|
|
|
state: present
|
2017-07-11 00:42:38 +02:00
|
|
|
when: evolinux_system_restrict_securetty
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-07-12 09:34:46 +02:00
|
|
|
- name: Setting TMOUT to disconnect inactive users
|
2016-11-07 14:00:57 +01:00
|
|
|
lineinfile:
|
2017-07-11 00:29:06 +02:00
|
|
|
dest: /etc/profile.d/evolinux.sh
|
2016-11-07 14:00:57 +01:00
|
|
|
line: "export TMOUT=36000"
|
2017-07-11 00:29:06 +02:00
|
|
|
create: yes
|
2016-11-07 14:00:57 +01:00
|
|
|
state: present
|
2017-07-11 00:42:38 +02:00
|
|
|
when: evolinux_system_set_timeout
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
#- name: Customizing /etc/fstab
|
|
|
|
|
2017-07-11 00:42:38 +02:00
|
|
|
- name: Set verbose logging for cron deamon
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/default/cron
|
|
|
|
line: "EXTRA_OPTS='-L 15'"
|
|
|
|
create: yes
|
|
|
|
state: present
|
|
|
|
when: evolinux_system_cron_verboselog
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: Modify default umask for cron deamon
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/default/cron
|
|
|
|
line: "umask 022"
|
|
|
|
create: yes
|
|
|
|
state: present
|
2017-07-11 00:42:38 +02:00
|
|
|
when: evolinux_system_cron_umask
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
- name: Randomize periodic crontabs
|
|
|
|
replace:
|
|
|
|
dest: /etc/crontab
|
|
|
|
regexp: "{{ item.regexp }}"
|
|
|
|
replace: "{{ item.replace }}"
|
|
|
|
with_items:
|
2017-07-17 14:46:01 +02:00
|
|
|
- { regexp: '^17((\s*\*){4})', replace: '{{ 59|random(start=1) }}\1' }
|
|
|
|
- { regexp: '^25\s*6((\s*\*){3})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
|
|
|
- { regexp: '^47\s*6((\s*\*){2}\s*7)', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
|
|
|
- { regexp: '^52\s*6(\s*1(\s*\*){2})', replace: '{{ 59|random(start=1) }} {{ [0,1,3,4,5,6,7]|random }}\1' }
|
2017-07-11 00:42:38 +02:00
|
|
|
when: evolinux_system_cron_random
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-08-31 03:31:00 +02:00
|
|
|
- include_role:
|
|
|
|
name: ntpd
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
## alert5
|
|
|
|
|
2017-10-06 01:09:48 +02:00
|
|
|
- name: Install alert5 init script (jessie/stretch)
|
2016-11-07 14:00:57 +01:00
|
|
|
template:
|
2017-10-05 00:25:13 +02:00
|
|
|
src: system/alert5.sysvinit.j2
|
2016-11-07 14:00:57 +01:00
|
|
|
dest: /etc/init.d/alert5
|
2016-12-26 12:11:37 +01:00
|
|
|
force: no
|
2017-03-23 16:59:43 +01:00
|
|
|
mode: "0755"
|
2017-10-05 00:25:13 +02:00
|
|
|
when:
|
|
|
|
- evolinux_system_alert5_init
|
2019-07-03 09:41:35 +02:00
|
|
|
- ansible_distribution_release == "jessie" or ansible_distribution_release == "stretch"
|
2016-11-07 14:00:57 +01:00
|
|
|
|
2017-10-06 01:09:48 +02:00
|
|
|
- name: Enable alert5 init script (jessie/stretch)
|
2017-10-05 00:25:13 +02:00
|
|
|
service:
|
|
|
|
name: alert5
|
|
|
|
enabled: yes
|
|
|
|
when:
|
|
|
|
- evolinux_system_alert5_init
|
|
|
|
- evolinux_system_alert5_enable
|
2019-07-03 09:41:35 +02:00
|
|
|
- ansible_distribution_release == "jessie" or ansible_distribution_release == "stretch"
|
2017-02-09 17:36:49 +01:00
|
|
|
|
2017-01-04 18:58:39 +01:00
|
|
|
|
2017-10-05 00:25:13 +02:00
|
|
|
|
2017-10-06 01:09:48 +02:00
|
|
|
- name: Install alert5 init script (buster)
|
2017-10-05 00:25:13 +02:00
|
|
|
template:
|
|
|
|
src: system/alert5.sh.j2
|
|
|
|
dest: /usr/share/scripts/alert5.sh
|
|
|
|
force: no
|
|
|
|
mode: "0755"
|
|
|
|
when:
|
|
|
|
- evolinux_system_alert5_init
|
2017-10-06 01:09:48 +02:00
|
|
|
- ansible_distribution_major_version | version_compare('10', '>=')
|
2017-10-05 00:25:13 +02:00
|
|
|
|
2017-10-06 01:09:48 +02:00
|
|
|
- name: Install alert5 service (buster)
|
2017-10-05 00:25:13 +02:00
|
|
|
copy:
|
|
|
|
src: alert5.service
|
|
|
|
dest: /etc/systemd/system/alert5.service
|
|
|
|
force: yes
|
|
|
|
mode: "0755"
|
|
|
|
when:
|
|
|
|
- evolinux_system_alert5_init
|
2017-10-06 01:09:48 +02:00
|
|
|
- ansible_distribution_major_version | version_compare('10', '>=')
|
2017-10-05 00:25:13 +02:00
|
|
|
|
2017-10-06 01:09:48 +02:00
|
|
|
- name: Enable alert5 init script (buster)
|
2017-10-05 00:25:13 +02:00
|
|
|
systemd:
|
2017-01-04 18:58:39 +01:00
|
|
|
name: alert5
|
2017-10-05 00:25:13 +02:00
|
|
|
daemon_reload: yes
|
2017-01-04 18:58:39 +01:00
|
|
|
enabled: yes
|
2017-10-05 00:25:13 +02:00
|
|
|
when:
|
|
|
|
- evolinux_system_alert5_init
|
|
|
|
- evolinux_system_alert5_enable
|
2017-10-06 01:09:48 +02:00
|
|
|
- ansible_distribution_major_version | version_compare('10', '>=')
|
2016-11-07 14:00:57 +01:00
|
|
|
|
|
|
|
## network interfaces
|
|
|
|
|
2017-04-21 14:12:15 +02:00
|
|
|
- name: "Is there an \"allow-hotplug\" interface ?"
|
|
|
|
command: grep allow-hotplug /etc/network/interfaces
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
|
|
|
check_mode: no
|
|
|
|
register: grep_hotplug_eni
|
|
|
|
|
2016-11-07 14:00:57 +01:00
|
|
|
- name: "Network interfaces must be \"auto\" and not \"allow-hotplug\""
|
|
|
|
replace:
|
|
|
|
dest: /etc/network/interfaces
|
|
|
|
regexp: "allow-hotplug"
|
|
|
|
replace: "auto"
|
2017-04-21 14:12:15 +02:00
|
|
|
when: evolinux_system_eni_auto and grep_hotplug_eni.rc == 0
|
2017-01-03 17:02:23 +01:00
|
|
|
|
|
|
|
- meta: flush_handlers
|