* project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
74 lines
2.0 KiB
YAML
74 lines
2.0 KiB
YAML
---
|
|
- name: set_fact distro_setup
|
|
set_fact:
|
|
distro_setup: "{{ distro_settings[node_distro] }}"
|
|
|
|
- name: set_fact other distro settings
|
|
set_fact:
|
|
distro_user: "{{ distro_setup['user'] }}"
|
|
distro_ssh_service: "{{ distro_setup['ssh_service'] }}"
|
|
distro_extra_packages: "{{ distro_setup['extra_packages'] }}"
|
|
|
|
- name: Null-ify some linux tools to ease DIND
|
|
file:
|
|
src: "/bin/true"
|
|
dest: "{{ item }}"
|
|
state: link
|
|
force: yes
|
|
with_items:
|
|
# DIND box may have swap enable, don't bother
|
|
- /sbin/swapoff
|
|
# /etc/hosts handling would fail on trying to copy file attributes on edit,
|
|
# void it by successfully returning nil output
|
|
- /usr/bin/lsattr
|
|
# disable selinux-isms, sp needed if running on non-Selinux host
|
|
- /usr/sbin/semodule
|
|
|
|
- name: Void installing dpkg docs and man pages on Debian based distros
|
|
copy:
|
|
content: |
|
|
# Delete locales
|
|
path-exclude=/usr/share/locale/*
|
|
# Delete man pages
|
|
path-exclude=/usr/share/man/*
|
|
# Delete docs
|
|
path-exclude=/usr/share/doc/*
|
|
path-include=/usr/share/doc/*/copyright
|
|
dest: /etc/dpkg/dpkg.cfg.d/01_nodoc
|
|
mode: 0644
|
|
when:
|
|
- ansible_os_family == 'Debian'
|
|
|
|
- name: Install system packages to better match a full-fledge node
|
|
package:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items: "{{ distro_extra_packages + [ 'rsyslog', 'openssh-server' ] }}"
|
|
|
|
- name: Start needed services
|
|
service:
|
|
name: "{{ item }}"
|
|
state: started
|
|
with_items:
|
|
- rsyslog
|
|
- "{{ distro_ssh_service }}"
|
|
|
|
- name: Create distro user "{{ distro_user }}"
|
|
user:
|
|
name: "{{ distro_user }}"
|
|
uid: 1000
|
|
# groups: sudo
|
|
append: yes
|
|
|
|
- name: Allow password-less sudo to "{{ distro_user }}"
|
|
copy:
|
|
content: "{{ distro_user }} ALL=(ALL) NOPASSWD:ALL"
|
|
dest: "/etc/sudoers.d/{{ distro_user }}"
|
|
mode: 0640
|
|
|
|
- name: Add my pubkey to "{{ distro_user }}" user authorized keys
|
|
ansible.posix.authorized_key:
|
|
user: "{{ distro_user }}"
|
|
state: present
|
|
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
|