Files
ansible/roles/system/tasks/main.yml

106 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: Install general utilities
ansible.builtin.package:
name:
- apt-transport-https
- aptitude
- cron
- cron-apt
- curl
- gpg
- htop
- iputils-ping
- sudo
- telnet
- tmux
- vim
- wget
state: present
- name: Install hypervisors specific utilities
ansible.builtin.package:
name:
- fuse-overlayfs
- lshw
state: present
when: "'hypervisors' in group_names"
- name: Set localtime
ansible.builtin.file:
src: /usr/share/zoneinfo/Europe/Paris
dest: /etc/localtime
state: link
- name: Set locale
block:
- name: Set default locale to fr_FR.UTF-8
ansible.builtin.debconf:
name: locales
question: locales/default_environment_locale
value: fr_FR.UTF-8
vtype: select
- name: Set to generate locales fr_FR/en_US
ansible.builtin.debconf:
name: locales
question: locales/locales_to_be_generated
value: en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8
vtype: multiselect
- name: Delete original locale.gen
ansible.builtin.file:
path: /etc/locale.gen
state: absent
when: ansible_facts['env']['LANG'] != 'fr_FR.UTF-8'
- name: Update original locale.gen
ansible.builtin.command:
cmd: dpkg-reconfigure -f noninteractive locales
changed_when: true
when: ansible_facts['env']['LANG'] != 'fr_FR.UTF-8'
- name: Put bashrc configuration file
ansible.builtin.copy:
src: files/dotbashrc
dest: /root/.bashrc
mode: 0644
owner: root
group: root
- name: Put vimrc configuration file
ansible.builtin.copy:
src: files/vim/
dest: /root/.vim
mode: 0755
owner: root
group: root
- name: Config ssh
block:
- name: Put ssh configuration file
ansible.builtin.template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
mode: 0644
notify:
- Restart sshd
- name: Put ssh key home
ansible.posix.authorized_key:
user: root
state: present
key: "{{ lookup('file', 'ssh/home.id_rsa.pub') }}"
- name: Put ssh key work
ansible.posix.authorized_key:
user: root
state: present
key: "{{ lookup('file', 'ssh/work.id_rsa.pub') }}"
- name: Put cron-apt configuration file
ansible.builtin.copy:
src: files/5-install
dest: /etc/cron-apt/action.d/5-install
mode: 0644