From bd247d0b9438a6cd7e098e3229c86e113750cb3e Mon Sep 17 00:00:00 2001 From: mg Date: Tue, 29 Dec 2020 23:07:49 +0100 Subject: [PATCH] Rolle apt_sources aktualisiert (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rolle prÜft ZielOS, when in Playbook entfernt Rolle umbenannt: set_apt_sources --> set_apt_proxy Doku aktaulisiert acng_server --> apt_proxy_server_hostname acng_server_port --> apt_proxy_server_port Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com> Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/15 Co-Authored-By: mg Co-Committed-By: mg --- group_vars/all.yml | 6 +++--- playbooks/base/2_packages.yml | 6 ++---- roles/mgrote.set_apt_proxy/README.md | 14 ++++++++++++++ .../defaults/main.yml | 0 .../handlers/main.yml | 0 .../tasks/main.yml | 4 +--- roles/mgrote.set_apt_proxy/templates/sources.list | 10 ++++++++++ roles/mgrote.set_apt_sources/README.md | 14 -------------- .../mgrote.set_apt_sources/templates/sources.list | 10 ---------- 9 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 roles/mgrote.set_apt_proxy/README.md rename roles/{mgrote.set_apt_sources => mgrote.set_apt_proxy}/defaults/main.yml (100%) rename roles/{mgrote.set_apt_sources => mgrote.set_apt_proxy}/handlers/main.yml (100%) rename roles/{mgrote.set_apt_sources => mgrote.set_apt_proxy}/tasks/main.yml (59%) create mode 100644 roles/mgrote.set_apt_proxy/templates/sources.list delete mode 100644 roles/mgrote.set_apt_sources/README.md delete mode 100644 roles/mgrote.set_apt_sources/templates/sources.list diff --git a/group_vars/all.yml b/group_vars/all.yml index 66daeccb..9e339664 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -8,9 +8,9 @@ postfix_smtp_server: smtp.strato.de postfix_smtp_server_port: 587 postfix_smtp_use_tls: "yes" - ### mgrote.set_apt_sources - acng_server: acng.grote.lan - acng_server_port: 9999 + ### mgrote.set_apt_proxy + apt_proxy_server_hostname: acng.grote.lan + apt_proxy_server_port: 9999 ### mgrote.restic restic_folders_to_backup: "/usr/local /etc /root /var/www /home" restic_cron_hours: "19" diff --git a/playbooks/base/2_packages.yml b/playbooks/base/2_packages.yml index 7bb0ef7e..e9953fbe 100644 --- a/playbooks/base/2_packages.yml +++ b/playbooks/base/2_packages.yml @@ -3,8 +3,6 @@ serial: 3 max_fail_percentage: 20% roles: - - { role: mgrote.set_apt_sources, tags: "apt_sources", - when: "not 'virt' in group_names" } + - { role: mgrote.set_apt_proxy, tags: "apt_sources" } - { role: mgrote.update_packages, tags: "updates" } - - { role: mgrote.install_packages, - tags: "install" } + - { role: mgrote.install_packages, tags: "install" } diff --git a/roles/mgrote.set_apt_proxy/README.md b/roles/mgrote.set_apt_proxy/README.md new file mode 100644 index 00000000..21e05831 --- /dev/null +++ b/roles/mgrote.set_apt_proxy/README.md @@ -0,0 +1,14 @@ +## mgrote.set_apt_proxy + +### Beschreibung +- Diese Rolle ersetzt die `/etc/apt/sources.list` mit einer Datei in der ein Apt-Cacher-NG gesetzt ist. + +Rolle prüft mit `when: ansible_os_family == 'Ubuntu'` ob das Ziel auch Ubuntu ist. + +- [x] Ubuntu (>=18.04) + +### Variablen + Defaults +##### Apt-Cacher-NG Adresse +apt_proxy_server_hostname: acng.grote.lan +##### Apt-Cacher-NG Port +apt_proxy_server_port: 9999 diff --git a/roles/mgrote.set_apt_sources/defaults/main.yml b/roles/mgrote.set_apt_proxy/defaults/main.yml similarity index 100% rename from roles/mgrote.set_apt_sources/defaults/main.yml rename to roles/mgrote.set_apt_proxy/defaults/main.yml diff --git a/roles/mgrote.set_apt_sources/handlers/main.yml b/roles/mgrote.set_apt_proxy/handlers/main.yml similarity index 100% rename from roles/mgrote.set_apt_sources/handlers/main.yml rename to roles/mgrote.set_apt_proxy/handlers/main.yml diff --git a/roles/mgrote.set_apt_sources/tasks/main.yml b/roles/mgrote.set_apt_proxy/tasks/main.yml similarity index 59% rename from roles/mgrote.set_apt_sources/tasks/main.yml rename to roles/mgrote.set_apt_proxy/tasks/main.yml index 8b1e4d77..2deb0383 100644 --- a/roles/mgrote.set_apt_sources/tasks/main.yml +++ b/roles/mgrote.set_apt_proxy/tasks/main.yml @@ -1,5 +1,3 @@ -# Distribution_Release wird mit {{ansible_distribution_release}} gesetzt -# deb http://{{ acng_server }}:{{ acng_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security multiverse - name: sources.list kopieren become: yes ansible.builtin.template: @@ -7,7 +5,7 @@ dest: "/etc/apt/sources.list" backup: yes register: copy_src - + when: ansible_os_family == 'Ubuntu' - name: apt_update # noqa 503 503 become: yes diff --git a/roles/mgrote.set_apt_proxy/templates/sources.list b/roles/mgrote.set_apt_proxy/templates/sources.list new file mode 100644 index 00000000..af89663e --- /dev/null +++ b/roles/mgrote.set_apt_proxy/templates/sources.list @@ -0,0 +1,10 @@ +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} main restricted +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates main restricted +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} universe +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates universe +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} multiverse +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates multiverse +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-backports main restricted universe multiverse +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security main restricted +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security universe +deb http://{{ apt_proxy_server_hostname }}:{{ apt_proxy_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security multiverse diff --git a/roles/mgrote.set_apt_sources/README.md b/roles/mgrote.set_apt_sources/README.md deleted file mode 100644 index 2ec73ef2..00000000 --- a/roles/mgrote.set_apt_sources/README.md +++ /dev/null @@ -1,14 +0,0 @@ -## mgrote.set_apt_sources - -### Beschreibung -- setzt die sources.list fuer apt mit apt-cacher-ng ein - -- [x] Ubuntu (>=18.04) -- [x] Debian - - -### Variablen + Defaults -##### Apt-Cacher-NG Adresse -acng_server: acng.grote.lan -##### Apt-Cacher-NG Port -acng_server_port: 9999 diff --git a/roles/mgrote.set_apt_sources/templates/sources.list b/roles/mgrote.set_apt_sources/templates/sources.list deleted file mode 100644 index d1f24ca3..00000000 --- a/roles/mgrote.set_apt_sources/templates/sources.list +++ /dev/null @@ -1,10 +0,0 @@ -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} main restricted -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates main restricted -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} universe -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates universe -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}} multiverse -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-updates multiverse -deb http://{{ acng_server }}:{{ acng_server_port }}/de.archive.ubuntu.com/ubuntu/ {{ansible_distribution_release}}-backports main restricted universe multiverse -deb http://{{ acng_server }}:{{ acng_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security main restricted -deb http://{{ acng_server }}:{{ acng_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security universe -deb http://{{ acng_server }}:{{ acng_server_port }}/security.ubuntu.com/ubuntu {{ansible_distribution_release}}-security multiverse