oopen-server/roles/common/tasks/basic.yml
2022-01-22 00:06:54 +01:00

151 lines
3.3 KiB
YAML

---
- name: (basic.yml) Ensure timezone is is correct
timezone: name={{ time_zone }}
tags:
- timezone
- name: (basic.yml) Ensure locales are present
locale_gen:
name: "{{ item }}"
state: present
with_items: "{{ locales }}"
tags:
- locales
- name: (basic.yml) Create a symbolic link /bin/sh -> bash
file:
src: bash
dest: /bin/sh
owner: root
group: root
state: link
tags:
- symlink-sh
# ----------
# systemd stuff
# ----------
- name: (basic.yml) Ensure directory '/etc/systemd/system.conf.d' exists
file:
path: /etc/systemd/system.conf.d
state: directory
mode: 0755
group: root
owner: root
when:
- inventory_hostname not in groups['lxc_guest']
- copy_plain_files_systemd is defined
- copy_plain_files_systemd|length > 0
tags:
- systemd-config
- name: (basic.yml) Ensure files /etc/systemd/system.conf.d/*.conf exists
copy:
src: '{{ item.src_path }}'
dest: '{{ item.dest_path }}'
owner: root
group: root
mode: '0644'
loop: "{{ copy_plain_files_systemd }}"
loop_control:
label: 'dest: {{ item.name }}'
when:
- inventory_hostname not in groups['lxc_guest']
- copy_plain_files_systemd is defined
- copy_plain_files_systemd|length > 0
tags:
- systemd-config
# ----------
# kernel parameter
# ----------
- name: (basic.yml) Ensure directory '/etc/sysctl.d' exists
file:
path: etc/sysctl.d
state: directory
mode: 0755
group: root
owner: root
when:
- inventory_hostname not in groups['lxc_guest']
- copy_plain_files_sysctl is defined
- copy_plain_files_sysctl|length > 0
tags:
- systctl-config
- name: (basic.yml) Ensure files /etc/sysctl.d/*.conf exists
copy:
src: '{{ item.src_path }}'
dest: '{{ item.dest_path }}'
owner: root
group: root
mode: '0644'
loop: "{{ copy_plain_files_sysctl }}"
loop_control:
label: 'dest: {{ item.name }}'
when:
- inventory_hostname not in groups['lxc_guest']
- copy_plain_files_sysctl is defined
- copy_plain_files_sysctl|length > 0
tags:
- systctl-config
# ----------
# unattended upgrades
# ----------
- name: (basic.yml) install unattended-upgrades
apt: pkg=unattended-upgrades state=present
tags:
- unattended-upgrades
- name: (basic.yml) install apt-listchanges
apt: pkg=apt-listchanges state=present
tags:
- unattended-upgrades
- name: (basic.yml) remove apticron
apt: pkg=apticron state=absent
tags:
- unattended-upgrades
- name: (basic.yml) check if /etc/apt/apt.conf.d/20auto-upgrades exists
stat: path=/etc/apt/apt.conf.d/20auto-upgrades
register: ua_enabled
tags:
- unattended-upgrades
- name: (basic.yml) activate unattended upgrades
shell: dpkg-reconfigure -plow unattended-upgrades
when: ua_enabled.stat.exists == False
tags:
- unattended-upgrades
- name: (basic.yml) copy apt-listchanges.conf
template:
src: etc/apt/listchanges.conf.j2
dest: /etc/apt/listchanges.conf
owner: root
group: root
mode: 0644
tags:
- unattended-upgrades
- name: (basic.yml) copy unattended-upgrades conf
template:
src: etc/apt/apt.conf.d/50unattended-upgrades.j2
dest: /etc/apt/apt.conf.d/50unattended-upgrades
backup: yes
owner: root
group: root
mode: 0644
tags:
- unattended-upgrades