114 lines
2.7 KiB
YAML
114 lines
2.7 KiB
YAML
---
|
||
|
||
- 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: Copy bashrc config file
|
||
ansible.builtin.copy:
|
||
src: files/dotbashrc
|
||
dest: /root/.bashrc
|
||
mode: 0644
|
||
owner: root
|
||
group: root
|
||
|
||
- name: Copy vimrc config file
|
||
ansible.builtin.copy:
|
||
src: files/vim/
|
||
dest: /root/.vim
|
||
mode: 0755
|
||
owner: root
|
||
group: root
|
||
|
||
- name: SSH configuration
|
||
block:
|
||
- name: Put SSH configuration file
|
||
ansible.builtin.template:
|
||
src: sshd_config.j2
|
||
dest: /etc/ssh/sshd_config
|
||
mode: 0644
|
||
notify:
|
||
- Restart sshd
|
||
|
||
- name: SSH key home
|
||
ansible.posix.authorized_key:
|
||
user: root
|
||
state: present
|
||
key: "{{ lookup('file', 'ssh/home.id_rsa.pub') }}"
|
||
|
||
- name: SSH key work
|
||
ansible.posix.authorized_key:
|
||
user: root
|
||
state: present
|
||
key: "{{ lookup('file', 'ssh/work.id_rsa.pub') }}"
|
||
|
||
- name: SSH key stef
|
||
ansible.posix.authorized_key:
|
||
user: root
|
||
state: present
|
||
key: "{{ lookup('file', 'ssh/stefofficiel.id_rsa.pub') }}"
|
||
path: "~/.ssh/instance_keys"
|
||
when: inventory_hostname in groups['fedinupesservers']
|
||
|
||
- name: Set cron-apt configuration file
|
||
ansible.builtin.copy:
|
||
src: files/5-install
|
||
dest: /etc/cron-apt/action.d/5-install
|
||
mode: 0644
|