refactor: optimize system role
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install https transport for apt
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: apt-transport-https
|
|
||||||
state: present
|
|
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install aptitude
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: aptitude
|
|
||||||
state: present
|
|
||||||
when: ansible_facts['os_family'] == 'Debian'
|
|
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Copy basic bashrc files
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/dotbashrc
|
|
||||||
dest: /root/.bashrc
|
|
||||||
mode: 0644
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install cron-apt
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: cron-apt
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Default configuration file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/5-install
|
|
||||||
dest: /etc/cron-apt/action.d/5-install
|
|
||||||
mode: 0644
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install cron
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: cron
|
|
||||||
state: present
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install curl
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: curl
|
|
||||||
state: present
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install gpg package
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: gpg
|
|
||||||
state: present
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install htop
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: htop
|
|
||||||
state: present
|
|
@@ -1,27 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- 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'
|
|
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Set localtime
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: /usr/share/zoneinfo/Europe/Paris
|
|
||||||
dest: /etc/localtime
|
|
||||||
state: link
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install lshw
|
|
||||||
ansible.builtin.package:
|
|
||||||
state: present
|
|
||||||
name: lshw
|
|
@@ -1,42 +1,113 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Include aptitude
|
- name: Install general utilities
|
||||||
ansible.builtin.include_tasks: aptitude.yml
|
ansible.builtin.package:
|
||||||
- name: Include localtime
|
name:
|
||||||
ansible.builtin.include_tasks: localtime.yml
|
- apt-transport-https
|
||||||
- name: Include locales
|
- aptitude
|
||||||
ansible.builtin.include_tasks: locales.yml
|
- cron
|
||||||
- name: Include ping
|
- cron-apt
|
||||||
ansible.builtin.include_tasks: ping.yml
|
- curl
|
||||||
- name: Include sudo
|
- gpg
|
||||||
ansible.builtin.include_tasks: sudo.yml
|
- htop
|
||||||
- name: Include telnet
|
- iputils-ping
|
||||||
ansible.builtin.include_tasks: telnet.yml
|
- sudo
|
||||||
- name: Include tmux
|
- telnet
|
||||||
ansible.builtin.include_tasks: tmux.yml
|
- tmux
|
||||||
- name: Include bashrc
|
- vim
|
||||||
ansible.builtin.include_tasks: bashrc.yml
|
- wget
|
||||||
- name: Include vim
|
state: present
|
||||||
ansible.builtin.include_tasks: vimrc.yml
|
|
||||||
- name: Include sshd
|
- name: Install hypervisors’ specific utilities
|
||||||
ansible.builtin.include_tasks: sshd.yml
|
ansible.builtin.package:
|
||||||
- name: Include curl
|
name:
|
||||||
ansible.builtin.include_tasks: curl.yml
|
- fuse-overlayfs
|
||||||
- name: Include wget
|
- lshw
|
||||||
ansible.builtin.include_tasks: wget.yml
|
state: present
|
||||||
- name: Include cron
|
|
||||||
ansible.builtin.include_tasks: cron.yml
|
|
||||||
- name: Include htop
|
|
||||||
ansible.builtin.include_tasks: htop.yml
|
|
||||||
- name: Include apt-transport-https
|
|
||||||
ansible.builtin.include_tasks: apt-transport-https.yml
|
|
||||||
- name: Include gpg
|
|
||||||
ansible.builtin.include_tasks: gpg.yml
|
|
||||||
- name: Include cron-apt
|
|
||||||
ansible.builtin.include_tasks: cron-apt.yml
|
|
||||||
- name: Include lshw
|
|
||||||
ansible.builtin.include_tasks: lshw.yml
|
|
||||||
when: "'hypervisors' in group_names"
|
|
||||||
- name: Include overlayfs
|
|
||||||
ansible.builtin.include_tasks: overlayfs.yml
|
|
||||||
when: "'hypervisors' in group_names"
|
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
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install fuse-overlayfs
|
|
||||||
ansible.builtin.package:
|
|
||||||
state: present
|
|
||||||
name: fuse-overlayfs
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install ping utility
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: iputils-ping
|
|
||||||
state: present
|
|
@@ -1,29 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: SSH configuration file
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: sshd_config.j2
|
|
||||||
dest: /etc/ssh/sshd_config
|
|
||||||
mode: 0644
|
|
||||||
notify:
|
|
||||||
- Restart sshd
|
|
||||||
|
|
||||||
- name: SSH keys home
|
|
||||||
ansible.posix.authorized_key:
|
|
||||||
user: root
|
|
||||||
state: present
|
|
||||||
key: "{{ lookup('file', 'ssh/home.id_rsa.pub') }}"
|
|
||||||
|
|
||||||
- name: SSH keys work
|
|
||||||
ansible.posix.authorized_key:
|
|
||||||
user: root
|
|
||||||
state: present
|
|
||||||
key: "{{ lookup('file', 'ssh/work.id_rsa.pub') }}"
|
|
||||||
|
|
||||||
- name: SSH keys 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']
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install sudo utility
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: sudo
|
|
||||||
state: present
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install telnet
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: telnet
|
|
||||||
state: present
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install tmux
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: tmux
|
|
||||||
state: present
|
|
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install vim package
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: vim
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Copy vimrc config file
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: files/vim/
|
|
||||||
dest: /root/.vim
|
|
||||||
mode: 0755
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
@@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- name: Install wget package
|
|
||||||
ansible.builtin.package:
|
|
||||||
name: wget
|
|
||||||
state: present
|
|
Reference in New Issue
Block a user