X-Git-Url: https://git.realraum.at/?p=noc.git;a=blobdiff_plain;f=ansible%2Fhost_playbooks%2Fdeb.yml;fp=ansible%2Fhost_playbooks%2Fdeb.yml;h=d8dd046b349792556f71ee6ae52a91c7d130ba44;hp=0000000000000000000000000000000000000000;hb=939f1a6148f2483148a30b1184e154c214c7ce5d;hpb=83abc1f5cdb06e71e8674480d59a02365a967750 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