]> freie-schul-it.de Git - fsit_smgt.git/blob - tasks/bootstrap.yml
config fuer bootstrapping und inventory
[fsit_smgt.git] / tasks / bootstrap.yml
1 ---
2 - name: Remove apt-config-file derived from preseeding
3 ansible.builtin.file:
4 path: /etc/apt/apt.conf
5 state: absent
6 when: ("baremetal" in group_names)
7 - name: Create apt-proxy config file
8 ansible.builtin.template:
9 src: apt-proxy_01proxy.j2
10 dest: /etc/apt/apt.conf.d/01proxy
11 when: ("DMZ" not in group_names)
12 - name: Remove apt-config-file only for aptproxy
13 ansible.builtin.file:
14 path: /etc/apt/apt.conf.d/01proxy
15 state: absent
16 when: ("aptproxy" in inventory_hostname)
17 - name: Copy apt-unattended-upgrades config file
18 ansible.builtin.copy:
19 src: apt-unattended-upgrades_10periodic
20 dest: /etc/apt/apt.conf.d/10periodic
21 - name: Update and upgrade apt packages
22 ansible.builtin.apt:
23 update_cache: true
24 upgrade: true
25 autoremove: true
26 - name: Install core-packages
27 ansible.builtin.apt:
28 pkg:
29 - sudo
30 - gnupg
31 - htop
32 - ncdu
33 - vim
34 - tmux
35 - gnupg2
36 - nethogs
37 - iftop
38 - rsync
39 - ripgrep
40 - name: Install core-packages for bare-metal-server
41 ansible.builtin.apt:
42 pkg:
43 - inxi
44 when: ("baremetal" in group_names)
45 - name: Install core-packages for server in DMZ
46 ansible.builtin.apt:
47 pkg:
48 - fail2ban
49 when: ("DMZ" in group_names)
50 - name: Add ansible user to server
51 ansible.builtin.user:
52 name: ansible
53 shell: /bin/bash
54 - name: Allow "ansible"-user to have passwordless sudo
55 ansible.builtin.copy:
56 src: sudo_ansible
57 dest: /etc/sudoers.d/ansible
58 owner: root
59 group: root
60 mode: "0440"
61 - name: Add installbox-ansible-user _public_ ssh-key to the servers authorized_keys file
62 ansible.posix.authorized_key:
63 user: ansible
64 state: present
65 manage_dir: true
66 key: "{{ lookup('file', '/home/ansible/.ssh/id_ed25519.pub') }}"
67