update urubamba role (basic packages)

This commit is contained in:
Vaclav Uruba 2023-08-11 21:30:56 +02:00
parent 8d8f209d2f
commit 39c2b425bd
Signed by: uruba
GPG Key ID: 9D8E987C4B2E1E9C
8 changed files with 77 additions and 0 deletions

View File

@ -2,3 +2,8 @@
hosts: all
roles:
- users
- python3
- docker
- htop
- tmux
- fail2ban

View File

@ -0,0 +1,30 @@
---
- name: "Install dependencies"
ansible.builtin.apt:
name:
- ca-certificates
- curl
- gnupg
state: present
- name: "Add Docker GPG key"
ansible.builtin.get_url:
url: "https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }}/gpg"
dest: /etc/apt/trusted.gpg.d/docker.asc
mode: "0644"
force: true
- name: "Set up apt repository for Docker"
ansible.builtin.apt_repository:
repo: >
deb [arch={{ architecture[ansible_architecture] }}]
https://download.docker.com/{{ ansible_system | lower }}/{{ ansible_distribution | lower }}
{{ ansible_distribution_release }} stable
update_cache: true
- name: "Install docker"
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present

View File

@ -0,0 +1,5 @@
---
architecture: {
"aarch64": "arm64",
"x86_64": "amd64"
}

View File

@ -0,0 +1,9 @@
---
- name: Install fail2ban
ansible.builtin.package:
name: fail2ban
state: present
- name: Run fail2ban service
ansible.builtin.service:
name: fail2ban
state: reloaded

View File

@ -0,0 +1,5 @@
---
- name: Install htop
ansible.builtin.package:
name: htop
state: present

View File

@ -0,0 +1,9 @@
---
- name: Install python3
ansible.builtin.package:
name: python3
state: present
- name: Install python3-systemd
ansible.builtin.package:
name: python3-systemd
state: present

View File

@ -0,0 +1,13 @@
---
- name: Install tmux
ansible.builtin.package:
name: tmux
state: present
- name: Start tmux in .bashrc
ansible.builtin.blockinfile:
path: "{{ lookup('env', 'HOME') }}/.bashrc"
marker: "# {mark} ANSIBLE MANAGED SECTION (tmux)"
block: |
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
tmux attach-session -t uruba || tmux new-session -s uruba
fi

View File

@ -3,6 +3,7 @@
ansible.builtin.user:
name: "{{ item.username }}"
password: "{{ item.password | password_hash('sha512') }}"
update_password: on_create
shell: /bin/bash
with_items: "{{ admin_users }}"