From 6d630ea83398057a7f085dfafda441f8aa8ef7b4 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 20 Apr 2021 20:22:49 +0200 Subject: [PATCH 01/15] add aur instalation --- defaults/main.yml | 3 +++ tasks/base_software.yml | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index dc1b3f3..f3248be 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -50,6 +50,9 @@ system_base_softwares_arch: - 'otf-cascadia-code' - 'neovim' +system_base_aur_soft: + - 'nodejs-markdownlint-cli' + system_base_softwares_debian: - 'zsh' - 'lsof' diff --git a/tasks/base_software.yml b/tasks/base_software.yml index 2e75bac..b2936f5 100644 --- a/tasks/base_software.yml +++ b/tasks/base_software.yml @@ -30,6 +30,13 @@ become: yes when: ansible_facts['os_family'] == "Archlinux" + - name: install aur workstation soft + aur: + name: "{{ system_base_aur_soft }}" + state: present + become: yes + become_user: aur_builder + when: ansible_facts['os_family'] == "Archlinux" - name: launch debian base install software apt: From d42d98218b0224789ae284f213accf0c9bdd3441 Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 20 Apr 2021 21:25:40 +0200 Subject: [PATCH 02/15] add yamllint & prettier --- defaults/main.yml | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index f3248be..d6c0a84 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,12 +1,12 @@ +--- user: name: 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" -] +arch_base_locales: + - "fr_FR.UTF-8" + - "en_US.UTF-8" time: hwclock: UTC timezone: Europe/Paris @@ -38,7 +38,7 @@ system_base_softwares_arch: - 'iftop' - 'zip' - 'unzip' - - 'unrar' + - 'unrar' - 'git-lfs' - 'httpie' - 'lsof' @@ -49,7 +49,8 @@ system_base_softwares_arch: - 'logrotate' - 'otf-cascadia-code' - 'neovim' - + - 'yamllint' + - 'prettier' system_base_aur_soft: - 'nodejs-markdownlint-cli' @@ -62,10 +63,10 @@ system_base_softwares_debian: - 'nmap' - 'dnsutils' - 'rsync' - #- 'awesome-terminal-fonts' + # - 'awesome-terminal-fonts' - 'wget' - #- 'bat' - #- 'diff-so-fancy' + # - 'bat' + # - 'diff-so-fancy' - 'git' - 'htop' - 'thefuck' @@ -82,7 +83,7 @@ system_base_softwares_debian: - 'iftop' - 'zip' - 'unzip' - - 'unrar' + - 'unrar' - 'git-lfs' - 'httpie' - 'ethtool' @@ -92,16 +93,16 @@ system_base_softwares_debian: system_upgrade: false system_arch_local_mirror: system_user: [] - #- name: toto - #home: /home/toto - #shell: '/bin/zsh' - #group: ezfef +# - name: toto +# home: /home/toto +# shell: '/bin/zsh' +# group: ezfef system_group: [] keystodeploy: [] - #- name: toto - # user: toto - # ssjkey: lrlrl +# - name: toto +# user: toto +# ssjkey: lrlrl privatekeytodeploy: [] - #- user: root - # keyfile: /root/.ssh/id_rsa - # privatekey: {{ vault_privatekey }} +# - user: root +# keyfile: /root/.ssh/id_rsa +# privatekey: {{ vault_privatekey }} From fe7e752f1e0ebc4519326e4ed7b5e9851466935e Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 22 Apr 2021 09:29:18 +0200 Subject: [PATCH 03/15] add .yammlint --- .yamllint | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .yamllint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..c311c97 --- /dev/null +++ b/.yamllint @@ -0,0 +1,11 @@ +--- +extends: default + +rules: + # 80 chars should be enough, but don't fail if a line is longer + line-length: + max: 80 + level: warning + allow-non-breakable-words: true + comments: + min-spaces-from-content: 1 From cc29c9bc7834679ced6ae38a206884898699c740 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 22 Apr 2021 10:38:50 +0200 Subject: [PATCH 04/15] add .drone.yml --- .drone.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..b8e35cd --- /dev/null +++ b/.drone.yml @@ -0,0 +1,19 @@ +--- +kind: pipeline +type: docker +name: lint + +steps: + - name: ansible linting + image: cytopia/ansible-lint + + commands: + - ansible-lint + - name: markdown linting + image: 06kellyjac/markdownlint-cli + commands: + - markdownlint . + when: + status: + - success + - failure From 8848219fec31867c1d12e0f32533534f5cfbd59e Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 22 Apr 2021 10:54:28 +0200 Subject: [PATCH 05/15] add .markdownlint.yaml --- .markdownlint.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .markdownlint.yaml diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..a085265 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,9 @@ +--- +# Default state for all rules +default: true +MD009: + strict: false + +MD013: false +MD033: false +MD024: false From 8b00e683d95b56c7fb4d7dbb87afbac472fa6217 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 22 Apr 2021 11:03:03 +0200 Subject: [PATCH 06/15] add task role path to ansible-lint --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index b8e35cd..cf05136 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ steps: image: cytopia/ansible-lint commands: - - ansible-lint + - ansible-lint tasks/main.yml - name: markdown linting image: 06kellyjac/markdownlint-cli commands: From ee96ad264d829b2ac784b8908bc7e848aee51948 Mon Sep 17 00:00:00 2001 From: vincent Date: Mon, 14 Jun 2021 19:21:09 +0200 Subject: [PATCH 07/15] add systemd parameter to hostname --- .yamllint | 36 +++++++++++++++++++++++++++++------- tasks/hostname.yml | 3 ++- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.yamllint b/.yamllint index c311c97..8827676 100644 --- a/.yamllint +++ b/.yamllint @@ -1,11 +1,33 @@ --- +# Based on ansible-lint config extends: default rules: - # 80 chars should be enough, but don't fail if a line is longer - line-length: - max: 80 - level: warning - allow-non-breakable-words: true - comments: - min-spaces-from-content: 1 + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + colons: + max-spaces-after: -1 + level: error + commas: + max-spaces-after: -1 + level: error + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 3 + level: error + hyphens: + level: error + indentation: disable + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + truthy: disable diff --git a/tasks/hostname.yml b/tasks/hostname.yml index a0e10ec..e906f20 100644 --- a/tasks/hostname.yml +++ b/tasks/hostname.yml @@ -2,4 +2,5 @@ - name: Ensure hostname set hostname: name: "{{ inventory_hostname }}" - become: yes \ No newline at end of file + use: systemd + become: yes From fb5c8991cd3bf192a6509605768bd88421e329b3 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 7 Jul 2021 21:20:35 +0200 Subject: [PATCH 08/15] add fzf and fd --- defaults/main.yml | 146 ++++++++++++++++++++++++---------------------- 1 file changed, 75 insertions(+), 71 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d6c0a84..d0996e2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,83 +12,87 @@ time: timezone: Europe/Paris system_base_softwares_arch: - - 'zsh' - - 'stow' - - 'wol' - - 'nmap' - - 'bind' - - 'rsync' - - 'awesome-terminal-fonts' - - 'wget' - - 'bat' - - 'diff-so-fancy' - - 'git' - - 'htop' - - 'thefuck' - - 'tldr' - - 'ntfs-3g' - - 'python-lxml' - - 'tmux' - - 'vim' - - 'python-pip' - - 'pacman-contrib' - - 'yarn' - - 'npm' - - 'nethogs' - - 'iftop' - - 'zip' - - 'unzip' - - 'unrar' - - 'git-lfs' - - 'httpie' - - 'lsof' - - 'glances' - - 'ethtool' - - 'gnu-netcat' - - 'netctl' - - 'logrotate' - - 'otf-cascadia-code' - - 'neovim' - - 'yamllint' - - 'prettier' + - "zsh" + - "stow" + - "wol" + - "nmap" + - "bind" + - "rsync" + - "awesome-terminal-fonts" + - "wget" + - "bat" + - "diff-so-fancy" + - "git" + - "htop" + - "thefuck" + - "tldr" + - "ntfs-3g" + - "python-lxml" + - "tmux" + - "vim" + - "python-pip" + - "pacman-contrib" + - "yarn" + - "npm" + - "nethogs" + - "iftop" + - "zip" + - "unzip" + - "unrar" + - "git-lfs" + - "httpie" + - "lsof" + - "glances" + - "ethtool" + - "gnu-netcat" + - "netctl" + - "logrotate" + - "otf-cascadia-code" + - "neovim" + - "yamllint" + - "prettier" + - "fd" + - "fzf" system_base_aur_soft: - - 'nodejs-markdownlint-cli' + - "nodejs-markdownlint-cli" system_base_softwares_debian: - - 'zsh' - - 'lsof' - - 'glances' - - 'stow' - - 'wakeonlan' - - 'nmap' - - 'dnsutils' - - 'rsync' + - "zsh" + - "lsof" + - "glances" + - "stow" + - "wakeonlan" + - "nmap" + - "dnsutils" + - "rsync" # - 'awesome-terminal-fonts' - - 'wget' + - "wget" # - 'bat' # - 'diff-so-fancy' - - 'git' - - 'htop' - - 'thefuck' - - 'tldr' - - 'ntfs-3g' - - 'python-lxml' - - 'tmux' - - 'neovim' - - 'python-neovim' - - 'python-pip' - - 'yarn' - - 'npm' - - 'nethogs' - - 'iftop' - - 'zip' - - 'unzip' - - 'unrar' - - 'git-lfs' - - 'httpie' - - 'ethtool' - - 'traceroute' - - 'fonts-cascadia-code' + - "git" + - "htop" + - "thefuck" + - "tldr" + - "ntfs-3g" + - "python-lxml" + - "tmux" + - "neovim" + - "python-neovim" + - "python-pip" + - "yarn" + - "npm" + - "nethogs" + - "iftop" + - "zip" + - "unzip" + - "unrar" + - "git-lfs" + - "httpie" + - "ethtool" + - "traceroute" + - "fonts-cascadia-code" + - "rust-fd-find" + - "fzf"" system_upgrade: false system_arch_local_mirror: From e424e084dba19ce08f1f5d8730819624d694d439 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 7 Jul 2021 21:20:35 +0200 Subject: [PATCH 09/15] add fzf and fd --- defaults/main.yml | 148 ++++++++++++++++++++++++---------------------- 1 file changed, 77 insertions(+), 71 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index d6c0a84..fbc8960 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,83 +12,88 @@ time: timezone: Europe/Paris system_base_softwares_arch: - - 'zsh' - - 'stow' - - 'wol' - - 'nmap' - - 'bind' - - 'rsync' - - 'awesome-terminal-fonts' - - 'wget' - - 'bat' - - 'diff-so-fancy' - - 'git' - - 'htop' - - 'thefuck' - - 'tldr' - - 'ntfs-3g' - - 'python-lxml' - - 'tmux' - - 'vim' - - 'python-pip' - - 'pacman-contrib' - - 'yarn' - - 'npm' - - 'nethogs' - - 'iftop' - - 'zip' - - 'unzip' - - 'unrar' - - 'git-lfs' - - 'httpie' - - 'lsof' - - 'glances' - - 'ethtool' - - 'gnu-netcat' - - 'netctl' - - 'logrotate' - - 'otf-cascadia-code' - - 'neovim' - - 'yamllint' - - 'prettier' + - "zsh" + - "stow" + - "wol" + - "nmap" + - "bind" + - "rsync" + - "awesome-terminal-fonts" + - "wget" + - "bat" + - "diff-so-fancy" + - "git" + - "htop" + - "thefuck" + - "tldr" + - "ntfs-3g" + - "python-lxml" + - "tmux" + - "vim" + - "python-pip" + - "pacman-contrib" + - "yarn" + - "npm" + - "nethogs" + - "iftop" + - "zip" + - "unzip" + - "unrar" + - "git-lfs" + - "httpie" + - "lsof" + - "glances" + - "ethtool" + - "gnu-netcat" + - "netctl" + - "logrotate" + - "otf-cascadia-code" + - "neovim" + - "yamllint" + - "prettier" + - "fd" + - "fzf" + system_base_aur_soft: - - 'nodejs-markdownlint-cli' + - "nodejs-markdownlint-cli" system_base_softwares_debian: - - 'zsh' - - 'lsof' - - 'glances' - - 'stow' - - 'wakeonlan' - - 'nmap' - - 'dnsutils' - - 'rsync' + - "zsh" + - "lsof" + - "glances" + - "stow" + - "wakeonlan" + - "nmap" + - "dnsutils" + - "rsync" # - 'awesome-terminal-fonts' - - 'wget' + - "wget" # - 'bat' # - 'diff-so-fancy' - - 'git' - - 'htop' - - 'thefuck' - - 'tldr' - - 'ntfs-3g' - - 'python-lxml' - - 'tmux' - - 'neovim' - - 'python-neovim' - - 'python-pip' - - 'yarn' - - 'npm' - - 'nethogs' - - 'iftop' - - 'zip' - - 'unzip' - - 'unrar' - - 'git-lfs' - - 'httpie' - - 'ethtool' - - 'traceroute' - - 'fonts-cascadia-code' + - "git" + - "htop" + - "thefuck" + - "tldr" + - "ntfs-3g" + - "python-lxml" + - "tmux" + - "neovim" + - "python-neovim" + - "python-pip" + - "yarn" + - "npm" + - "nethogs" + - "iftop" + - "zip" + - "unzip" + - "unrar" + - "git-lfs" + - "httpie" + - "ethtool" + - "traceroute" + - "fonts-cascadia-code" + - "rust-fd-find" + - "fzf" system_upgrade: false system_arch_local_mirror: @@ -106,3 +111,4 @@ privatekeytodeploy: [] # - user: root # keyfile: /root/.ssh/id_rsa # privatekey: {{ vault_privatekey }} + From c10188eedf66fccdccc435fe287131f75879beb9 Mon Sep 17 00:00:00 2001 From: vincent Date: Sat, 10 Jul 2021 14:40:17 +0200 Subject: [PATCH 10/15] fix issue with .ssh directory not existing --- tasks/base_software.yml | 30 +++++++++++++-------------- tasks/ssh.yml | 46 +++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/tasks/base_software.yml b/tasks/base_software.yml index b2936f5..8f4f1d0 100644 --- a/tasks/base_software.yml +++ b/tasks/base_software.yml @@ -1,25 +1,25 @@ - name: upgrade arch-keyring pacman: - state: latest # not required. choices: absent;latest;present. Desired state of the package. - name: archlinux-keyring - force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. - update_cache: false + state: latest # not required. choices: absent;latest;present. Desired state of the package. + name: archlinux-keyring + force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. + update_cache: false become: yes when: system_upgrade and ansible_facts['os_family'] == "Archlinux" - name: upgrade system pacman: - state: latest # not required. choices: absent;latest;present. Desired state of the package. - upgrade: true # not required. Whether or not to upgrade whole system. - force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. - update_cache: false + state: latest # not required. choices: absent;latest;present. Desired state of the package. + upgrade: true # not required. Whether or not to upgrade whole system. + force: true # not required. When removing package - force remove package, without any checks. When update_cache - force redownload repo databases. + update_cache: false become: yes when: system_upgrade and ansible_facts['os_family'] == "Archlinux" register: upgrade - name: Reboot updates to apply reboot: - reboot_timeout: 3600 + reboot_timeout: 3600 when: upgrade.changed and "linux" in upgrade.packages and system_upgrade and ansible_facts['os_family'] == "Archlinux" become: yes @@ -30,7 +30,7 @@ become: yes when: ansible_facts['os_family'] == "Archlinux" - - name: install aur workstation soft +- name: install aur workstation soft aur: name: "{{ system_base_aur_soft }}" state: present @@ -46,20 +46,18 @@ become: yes when: ansible_facts['os_family'] == "Debian" - - name: GITHUB | Get current version of bat shell: > - warn=False - curl --silent https://github.com/sharkdp/bat/releases/latest | - grep 'tag' | - sed -E 's/.*v([0-9].[0-9][0-9].[0-9]).*/\1/' + warn=False + curl --silent https://github.com/sharkdp/bat/releases/latest | + grep 'tag' | + sed -E 's/.*v([0-9].[0-9][0-9].[0-9]).*/\1/' register: bat_version failed_when: > bat_version.rc != 0 or not bat_version.stdout|regex_search('\w+\.\w+\.\w+') when: ansible_facts['os_family'] == "Debian" - - name: DEBIAN | Set URL to download bins set_fact: debian_url: "https://github.com/sharkdp/bat/releases/download/v{{ bat_version.stdout }}/bat_{{ bat_version.stdout }}_amd64.deb" diff --git a/tasks/ssh.yml b/tasks/ssh.yml index d3d0753..2b1d673 100644 --- a/tasks/ssh.yml +++ b/tasks/ssh.yml @@ -1,21 +1,29 @@ - name: copy ssh config for user become: yes copy: - dest: /home/{{item}}/.ssh/ # required. Remote absolute path where the file should be copied to. If I(src) is a directory, this must be a directory too. If I(dest) is a nonexistent path and if either I(dest) ends with "/" or I(src) is a directory, I(dest) is created. If I(src) and I(dest) are files, the parent directory of I(dest) isn't created: the task fails if it doesn't already exist. - src: "ssh/config" # not required. Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to Rsync. - force: yes # not required. the default is C(yes), which will replace the remote file when contents are different than the source. If C(no), the file will only be transferred if the destination does not exist. - remote_src: no # not required. If C(no), it will search for I(src) at originating/master machine.,If C(yes) it will go to the remote/target machine for the I(src). Default is C(no).,Currently I(remote_src) does not support recursive copying.,I(remote_src) only works with C(mode=preserve) as of version 2.6. - mode: "600" # not required. Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of version 2.3, the mode may also be the special string C(preserve). C(preserve) means that the file will be given the same permissions as the source file. - selevel: s0 # not required. Level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the C(range). C(_default) feature works as for I(seuser). - owner: "{{item}}" # not required. Name of the user that should own the file/directory, as would be fed to I(chown). + dest: /home/{{item}}/.ssh/ # required. Remote absolute path where the file should be copied to. If I(src) is a directory, this must be a directory too. If I(dest) is a nonexistent path and if either I(dest) ends with "/" or I(src) is a directory, I(dest) is created. If I(src) and I(dest) are files, the parent directory of I(dest) isn't created: the task fails if it doesn't already exist. + src: "ssh/config" # not required. Local path to a file to copy to the remote server; can be absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", only inside contents of that directory are copied to destination. Otherwise, if it does not end with "/", the directory itself with all contents is copied. This behavior is similar to Rsync. + force: yes # not required. the default is C(yes), which will replace the remote file when contents are different than the source. If C(no), the file will only be transferred if the destination does not exist. + remote_src: no # not required. If C(no), it will search for I(src) at originating/master machine.,If C(yes) it will go to the remote/target machine for the I(src). Default is C(no).,Currently I(remote_src) does not support recursive copying.,I(remote_src) only works with C(mode=preserve) as of version 2.6. + mode: "600" # not required. Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of version 2.3, the mode may also be the special string C(preserve). C(preserve) means that the file will be given the same permissions as the source file. + selevel: s0 # not required. Level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known as the C(range). C(_default) feature works as for I(seuser). + owner: "{{item}}" # not required. Name of the user that should own the file/directory, as would be fed to I(chown). with_items: - - "{{user.name}}" - - root + - "{{user.name}}" + - root +- name: ensure key directory exist + become: true + file: + state: directory + path: "{{ item.keyfile | dirname }}" + owner: "{{item.user}}" + mode: 0600 + with_items: "{{privatekeytodeploy}}" - name: Install ssh private key become: yes - copy: - content: "{{ item.privatekey }}" + copy: + content: "{{ item.privatekey }}" dest: "{{ item.keyfile }}" mode: 0600 owner: "{{item.user}}" @@ -29,12 +37,10 @@ with_items: "{{keystodeploy}}" become: yes - - -- name : les connexions par mot de passe sont désactivées +- name: les connexions par mot de passe sont désactivées become: yes - lineinfile : - dest: /etc/ssh/sshd_config + lineinfile: + dest: /etc/ssh/sshd_config regexp: "^#?PasswordAuthentication" line: "PasswordAuthentication no" state: present @@ -42,9 +48,9 @@ - name: Remove root SSH access become: yes - lineinfile: - dest: /etc/ssh/sshd_config - regexp: "^PermitRootLogin" - line: "PermitRootLogin no" + lineinfile: + dest: /etc/ssh/sshd_config + regexp: "^PermitRootLogin" + line: "PermitRootLogin no" state: present notify: Restart sshd From f8cffd3b03bddf89b0c29d9e7a9433389535b1f4 Mon Sep 17 00:00:00 2001 From: vincent Date: Sun, 18 Jul 2021 11:39:52 +0200 Subject: [PATCH 11/15] add hosts file management --- defaults/main.yml | 5 +++++ tasks/hosts.yml | 8 ++++++++ tasks/main.yml | 1 + templates/etc_hosts.j2 | 19 +++++++++++++++++++ vars/main.yml | 2 ++ 5 files changed, 35 insertions(+) create mode 100644 tasks/hosts.yml create mode 100644 templates/etc_hosts.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 3d29f6c..7b40db5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -111,3 +111,8 @@ privatekeytodeploy: [] # keyfile: /root/.ssh/id_rsa # privatekey: {{ vault_privatekey }} +# Custom hosts entries to be added +hosts_entries: [] + +# Custom host file snippets to be added +hosts_file_snippets: [] diff --git a/tasks/hosts.yml b/tasks/hosts.yml new file mode 100644 index 0000000..491fd56 --- /dev/null +++ b/tasks/hosts.yml @@ -0,0 +1,8 @@ +- name: Install custom hosts file + become: true + template: + src: etc_hosts.j2 + dest: "{{ hosts_file }}" + owner: root + group: root + mode: 0644 diff --git a/tasks/main.yml b/tasks/main.yml index 6e61f3a..13725bb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,5 @@ #- include_tasks: hostname.yml +- include_tasks: hosts.yml - include_tasks: hostname.yml - include_tasks: locales.yml - include_tasks: time.yml diff --git a/templates/etc_hosts.j2 b/templates/etc_hosts.j2 new file mode 100644 index 0000000..1fe3dac --- /dev/null +++ b/templates/etc_hosts.j2 @@ -0,0 +1,19 @@ +# Hosts file -- Don't edit manually! +# +# {{ ansible_managed }} +{% if hosts_entries|length != 0 %} + +# Custom entries +{% for host in hosts_entries %} +{{ host.ip }} {{ host.name }} {{ host.aliases | default('') | join(' ') }} +{% endfor %} +{% endif %} +{% if hosts_file_snippets %} + +# +# Hosts file snippets +# + +{{ hosts_file_snippets }} + +{% endif %} diff --git a/vars/main.yml b/vars/main.yml index e69de29..6a29bb7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +hosts_file: "/etc/hosts" From dd9e98ebeac978e5c8c551e8187ff361484ec3ad Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 17 Aug 2021 22:22:21 +0200 Subject: [PATCH 12/15] add python-pynvim' --- defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/main.yml b/defaults/main.yml index 7b40db5..75d0e45 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -49,6 +49,7 @@ system_base_softwares_arch: - "logrotate" - "otf-cascadia-code" - "neovim" + - "python-pynvim" - "yamllint" - "prettier" - "fd" From 4d562cb72ec4b18d56d322fa8f3e6638798fc92d Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 18 Aug 2021 18:56:37 +0200 Subject: [PATCH 13/15] change python3-pip --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 75d0e45..8516b00 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -78,7 +78,7 @@ system_base_softwares_debian: - "python-lxml" - "tmux" - "neovim" - - "python-neovim" + - "python3-neovim" - "python-pip" - "yarn" - "npm" From 50706dbde5e52225c595f5bf0019bb5927fbd5ab Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 18 Aug 2021 19:00:27 +0200 Subject: [PATCH 14/15] correct fd package debian --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8516b00..8bba794 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -92,7 +92,7 @@ system_base_softwares_debian: - "ethtool" - "traceroute" - "fonts-cascadia-code" - - "rust-fd-find" + - "fd-find" - "fzf" system_upgrade: false From fb7e42d0ef826b2065c702bafd11b1577cbc9e26 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 18 Aug 2021 19:14:45 +0200 Subject: [PATCH 15/15] change pip version debian --- defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 8bba794..748deec 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -79,7 +79,7 @@ system_base_softwares_debian: - "tmux" - "neovim" - "python3-neovim" - - "python-pip" + - "python3-pip" - "yarn" - "npm" - "nethogs"