Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 00e9aaf5 authored by Freezed's avatar Freezed
Browse files

:sparkles: Add system configuration

- root dot files, shell & font
- my_user shell
- openNTP deamon
parent 335ad2c2
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,9 @@ open_all:
${EDITOR} .gitignore inventory Makefile README.md
${EDITOR} tasks/*.yml
${EDITOR} tasks/files/sshd_config
${EDITOR} tasks/files/sshd_config
${EDITOR} tasks/user_cfg/*.yml
${EDITOR} tasks/system_cfg/*.yml
${EDITOR} tasks/system_cfg/templates/*.j2
${EDITOR} tasks/user_cfg/*.yml
${EDITOR} tasks/user_cfg/files/sshd_config
${EDITOR} tasks/user_cfg/files/dotfiles/*
${EDITOR} tasks/user_cfg/templates/*.j2
${EDITOR} tasks/user_cfg/vars/*.yml
......
......@@ -18,7 +18,8 @@ Suitable for server and workstation.
| [`become_user_cfg.yml`](tasks/become_user_cfg.yml) | Set `sudo` without password for `become_user` access |
| [`host_info.yml`](tasks/host_info.yml) | Return message with distribution full name & version |
| [`shutdown.yml`](tasks/shutdown.yml) | Shutdown target in 10 min |
| [`user_cfg`](tasks/user_cfg/main.yml) | Configure `{{ my_user }}` & `root` users |
| [`system_cfg`](tasks/system_cfg/main.yml) | Configure `root` users , NTP & `{{ my_users }}` shell |
| [`user_cfg`](tasks/user_cfg/main.yml) | Configure `{{ my_user }}` |
| [`whoami.yml`](tasks/whoami.yml) | Return message with `ansible_user` & `become_user` (`sudo` method) |
......
---
- hosts: "{{ host_list }}"
become_user: "{{ my_user }}"
become_method: su
remote_user: root
tasks:
- name: "IMPORT_TASKS | root"
ansible.builtin.import_tasks: root.yml
- name: "IMPORT_TASKS | ntp"
ansible.builtin.import_tasks: ntp.yml
- name: "IMPORT_TASKS | {{ my_user }}"
ansible.builtin.import_tasks: my_user.yml
---
- name: MY USER | set zsh for shell
become: no
ansible.builtin.user:
name: "{{ my_user }}"
shell: /bin/zsh
state: present
---
- name: NTP | INCLUDE_VARS
ansible.builtin.include_vars: "vars.yml"
- name: NTP | install NTP daemon
ansible.builtin.apt:
pkg: openntpd
state: present
- name: NTP | deploy OpenNTPd configuration file
ansible.builtin.template:
src: templates/ntpd.conf.j2
dest: /etc/openntpd/ntpd.conf
mode: 0644
owner: root
group: root
register: openntpd_cfg
- name: restart openntpd
when: openntpd_cfg.changed
ansible.builtin.service:
name: openntpd
state: restarted
---
- name: ROOT | dotfiles presence
become: no
ansible.builtin.copy:
src: "{{ item }}"
dest: "/root/.{{ item | basename }}"
mode: 0640
owner: root
group: root
with_fileglob:
../user_cfg/files/dotfiles/*
loop_control:
label: "{{ item | basename }}"
- name: ROOT | ZSH files absence
become: no
ansible.builtin.file:
path: "/etc/zsh/zlogin"
state: absent
- name: ROOT | Set ZSH for shell
become: no
ansible.builtin.user:
name: root
shell: /bin/zsh
state: present
- name: ROOT | TEMP-FIX font dir absence
become: no
ansible.builtin.file:
path: "/usr/local/share/fonts/fonts/"
state: absent
- name: ROOT | JetBrainsMono presence
become: no
ansible.builtin.find:
path: "/usr/local/share/fonts/"
patterns: "JetBrainsMono*"
recurse: yes
register: font_presence
- name: ROOT | install JetBrainsMono font
become: no
when: font_presence.matched < 50
ansible.builtin.unarchive:
dest: "/usr/local/share/"
remote_src: yes
src: https://download.jetbrains.com/fonts/JetBrainsMono-2.242.zip
# ############################################# #
# openNTP config file #
# /etc/ntp/ntpd.conf #
# #
# This file is managed by Ansible #
# Manual edition will be overridden #
# #
# https://lab.frogg.it/fcode/ansible/debian #
# #
# ############################################# #
# See http://support.ntp.org/bin/view/Servers/NTPPoolServers
{% for host in ntp_hosts %}
servers {{ host }}
{% endfor %}
---
ntp_hosts:
- '0.europe.pool.ntp.org'
- '1.europe.pool.ntp.org'
- '2.europe.pool.ntp.org'
- '3.europe.pool.ntp.org'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment