From cfdaa4e30d465dc0cf76245f37918a9c908d7895 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 2 Dec 2018 21:03:03 +0100 Subject: [PATCH] finalyse system --- defaults/main.yml | 9 ++++++++- handlers/main.yml | 11 +++++++++++ tasks/base_software.yml | 2 +- tasks/hostname.yml | 4 ++++ tasks/locales.yml | 22 ++++++++++++++++++++++ tasks/main.yml | 7 +++++-- tasks/pacman.yml | 12 ++++++++++++ tasks/time.yml | 6 ++++++ 8 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 tasks/hostname.yml create mode 100644 tasks/locales.yml create mode 100644 tasks/pacman.yml create mode 100644 tasks/time.yml diff --git a/defaults/main.yml b/defaults/main.yml index 5fa57bb..88cb688 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1 +1,8 @@ -username: user \ No newline at end of file +username: user +arch_base_locale: fr_FR.UTF-8 +arch_base_keymap: FR +arch_base_timezone: Europe/Paris +arch_base_locales: [ + "fr_FR.UTF-8", + "en_US.UTF-8" +] \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml index e69de29..356ec0b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -0,0 +1,11 @@ +--- +- name: Update hostname + hostname: name={{ arch_base_hostname }} + +- name: Update keymap + command: localectl set-keymap {{ arch_base_keymap }} + +- name: Update pacman repos + pacman: update_cache=yes +- name: Restart sshd + service: name=sshd state=restarted \ No newline at end of file diff --git a/tasks/base_software.yml b/tasks/base_software.yml index 8ceec97..5809217 100644 --- a/tasks/base_software.yml +++ b/tasks/base_software.yml @@ -1,7 +1,7 @@ - name: launch base install software pacman: state: present # not required. choices: absent;latest;present. Desired state of the package. - name: ['zsh','stow','awesome-terminal-fonts','wget','bat','diff-so-fancy','git','htop','thefuck','tldr','ntfs-3g','tmux','vim','zsh-theme-powerlevel9k' ] # not required. Name or list of names of the packages to install, upgrade, or remove. + name: ['zsh','stow','nmap','rsync','awesome-terminal-fonts','wget','bat','diff-so-fancy','git','htop','thefuck','tldr','ntfs-3g','tmux','vim','zsh-theme-powerlevel9k' ] # not required. Name or list of names of the packages to install, upgrade, or remove. update_cache: true # not required. Whether or not to refresh the master package lists. This can be run as part of a package installation or as a separate step. become: yes diff --git a/tasks/hostname.yml b/tasks/hostname.yml new file mode 100644 index 0000000..fd759ef --- /dev/null +++ b/tasks/hostname.yml @@ -0,0 +1,4 @@ + +- name: Ensure hostname set + hostname: name={{ inventory_hostname }} + diff --git a/tasks/locales.yml b/tasks/locales.yml new file mode 100644 index 0000000..089276b --- /dev/null +++ b/tasks/locales.yml @@ -0,0 +1,22 @@ +--- +- name: Set keymap + copy: content="KEYMAP={{ arch_base_keymap }}\n" dest=/etc/vconsole.conf + notify: Update keymap + become: yes + +- name: Generate locales + locale_gen: + name: "{{ item }}" + state: present + with_items: "{{ arch_base_locales }}" + become: yes + +- name: Set locale + lineinfile: dest=/etc/locale.conf line="LANG={{ arch_base_locale }}" regexp="^LANG=" create=yes + become: yes +- name: Set timezone + become: yes + command: timedatectl set-timezone {{ arch_base_timezone }} + args: + creates: /etc/localtime + diff --git a/tasks/main.yml b/tasks/main.yml index c41da13..59b4c84 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,7 @@ --- +- include_tasks: hostname.yml +- include_tasks: locales.yml +- include_tasks: pacman.yml +- include_tasks: time.yml - include_tasks: AUR_builder.yml -- include_tasks: base_software.yml -- include_tasks: user_config_file.yml +- include_tasks: base_software.yml \ No newline at end of file diff --git a/tasks/pacman.yml b/tasks/pacman.yml new file mode 100644 index 0000000..b6fa9e3 --- /dev/null +++ b/tasks/pacman.yml @@ -0,0 +1,12 @@ +--- +- name: Configure pacman color + replace: dest=/etc/pacman.conf regexp="^#(Color)" replace="\1" + become: yes +- name: Configure more pacman visuals + replace: dest=/etc/pacman.conf regexp="#(VerbosePkgLists)" replace="\1\nILoveCandy" + become: yes +- name: Configure pacman multilib repo + become: yes + replace: dest=/etc/pacman.conf regexp="^#(\[multilib\])\n^#(.*)$" replace="\1\n\2" + when: ansible_architecture == "x86_64" + notify: Update pacman repos \ No newline at end of file diff --git a/tasks/time.yml b/tasks/time.yml new file mode 100644 index 0000000..7ff4e0b --- /dev/null +++ b/tasks/time.yml @@ -0,0 +1,6 @@ +--- +- name: Enable timesync + command: timedatectl set-ntp true + become: yes + args: + creates: /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service \ No newline at end of file