From: nicoo Date: Fri, 7 Feb 2020 11:54:08 +0000 (+0100) Subject: Create deb.http.realraum.at apt-cacher instance X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=939f1a6148f2483148a30b1184e154c214c7ce5d;p=noc.git Create deb.http.realraum.at apt-cacher instance --- diff --git a/ansible/host_playbooks/deb.yml b/ansible/host_playbooks/deb.yml new file mode 100644 index 0000000..d8dd046 --- /dev/null +++ b/ansible/host_playbooks/deb.yml @@ -0,0 +1,97 @@ +--- +- name: Basic Setup for deb.realraum.at + hosts: deb + roles: + - role: base + +- name: Set up data volume for apt-cacher-ng + hosts: deb + tasks: + - name: Format the data volume + filesystem: + dev: /dev/vdb + fstype: ext4 + resizefs: yes + + - name: Setup mountpoint + mount: + path: /var/cache/apt-cacher-ng + src: /dev/vdb + state: mounted + fstype: ext4 + + - name: Create user/group apt-cacher-ng + user: + name: apt-cacher-ng + system: yes + shell: /usr/sbin/nologin + home: /var/cache/apt-cacher-ng + create_home: no + + - name: Set up permissions on /var/cache/apt-cacher-ng + file: + path: /var/cache/apt-cacher-ng + owner: apt-cacher-ng + group: apt-cacher-ng + +- name: Set up apt-cacher-ng + hosts: deb + handlers: + - name: restart acng + service: + name: apt-cacher-ng + state: restarted + + tasks: + - name: Install acng + apt: + name: apt-cacher-ng + state: present + + - name: Configure acng + notify: restart acng + lineinfile: + path: /etc/apt-cacher-ng/acng.conf + line: "{{ item.key }}: {{ item.value }}" + regexp: "^(#\\s*)?{{ item.key }}:" + + loop_control: + label: "{{ item.key }}" + with_dict: + BindAddress: deb.http.realraum.at + Port: 8080 + ForceManaged: 1 + Remap-debsec: /debian-security ; file:backends_debian_security + Remap-grml: /grml ; file:backends_grml + Remap-pi: /pi ; file:backends_pi + Remap-raspbian: /raspbian ; file:backends_raspbian + + + - name: Configure's acng's backends + notify: restart acng + copy: + dest: /etc/apt-cacher-ng/backends_{{ item.key }} + content: | + {% for backend in item.value %} + {{ backend }} + {% endfor %} + mode: 0644 + + loop_control: + label: "{{ item.key }}" + with_dict: + debian: + - https://debian.ffgraz.net/debian + - http://cdn-fastly.deb.debian.org/debian + + debian_security: + - https://debian.ffgraz.net/debian-security + - http://cdn-fastly.deb.debian.org/debian-security + + pi: + - https://debian.ffgraz.net/pi + - https://archive.raspberrypi.org/debian + + raspbian: + - https://debian.ffgraz.net/raspbian + - https://archive.raspbian.org/raspbian diff --git a/ansible/host_vars/alfred/main.yml b/ansible/host_vars/alfred/main.yml index ed73d0c..f171f2a 100644 --- a/ansible/host_vars/alfred/main.yml +++ b/ansible/host_vars/alfred/main.yml @@ -10,4 +10,5 @@ vm_host: nameservers: "{{ net.mgmt.dns }}" indices: metrics: 74 + deb: 75 testvm: 99 diff --git a/ansible/host_vars/deb/main.yml b/ansible/host_vars/deb/main.yml new file mode 100644 index 0000000..0986fa7 --- /dev/null +++ b/ansible/host_vars/deb/main.yml @@ -0,0 +1,42 @@ +--- +localconfig_ssh_config_user: root + +vm_host: alfred + +install: + host: "{{ vm_host }}" + mem: 1024 + numcpu: 2 + disks: + primary: /dev/vda + virtio: + vda: + vg: "{{ vm_host }}" + lv: "{{ inventory_hostname }}" + size: 5g + vdb: + vg: "{{ vm_host }}" + lv: "{{ inventory_hostname }}-data" + size: 20g + + interfaces: + - bridge: "{{ hostvars[vm_host].vm_host.network.interface }}" + name: mgmt0 + - bridge: "br-svc" + name: svc0 + autostart: True + +network: + nameservers: "{{ hostvars[vm_host].vm_host.network.nameservers }}" + domain: realraum.at + systemd_link: + interfaces: "{{ install.interfaces }}" + primary: + interface: mgmt0 + ip: "{{ (hostvars[vm_host].vm_host.network.ip+'/'+hostvars[vm_host].vm_host.network.mask) | ipaddr(hostvars[vm_host].vm_host.network.indices[inventory_hostname]) | ipaddr('address') }}" + mask: "{{ hostvars[vm_host].vm_host.network.mask }}" + gateway: "{{ hostvars[vm_host].vm_host.network.gateway | default(hostvars[vm_host].vm_host.network.ip) }}" + secondary: + svc0: + ip: 192.168.34.75 + mask: 255.255.255.0 diff --git a/ansible/hosts.ini b/ansible/hosts.ini index 26bb727..c8ea0db 100644 --- a/ansible/hosts.ini +++ b/ansible/hosts.ini @@ -14,6 +14,7 @@ hacksch r3home tickets gnocchi[0:1] +deb ## TODO: remove the variable once https://github.com/ansible/ansible/issues/39119 is fixed metrics localconfig_ssh_config_user=root @@ -46,6 +47,7 @@ virtualservers-alfred athsdisc calendar ctf +deb entrance galley hacksch