From: Ralf Jung Date: Thu, 5 Apr 2018 08:10:23 +0000 (+0200) Subject: add basic packages playbook; work on upgrade playbook; provide script to run it on... X-Git-Url: https://git.ralfj.de/ansible.git/commitdiff_plain/d4f185a99fd41f6927b3df2e80b1b24790242bd0?hp=5df124769817a210fc836f518f7326a11ac61adc add basic packages playbook; work on upgrade playbook; provide script to run it on all hosts despite sudo PW differences --- diff --git a/.gitignore b/.gitignore index ab47601..c04e2b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ *.retry - +hosts diff --git a/packages.yml b/packages.yml new file mode 100644 index 0000000..d4b108f --- /dev/null +++ b/packages.yml @@ -0,0 +1,14 @@ +# basic system package preparation +- hosts: all + tasks: + - name: detect if we have backports in the sources.list + command: fgrep backports /etc/apt/sources.list + ignore_errors: True + register: backports + - name: add backports repository + apt_repository: repo='deb http://httpredir.debian.org/debian {{ansible_distribution_release}}-backports main contrib non-free' state=present update_cache=yes + when: backports is failed + - name: get rid of packages we do not want + apt: name=exim4-base,rpcbind state=absent autoremove=yes + - name: install latest version of some packages, coming from backports if possible + apt: name=needrestart state=latest default_release={{ansible_distribution_release}}-backports diff --git a/playall b/playall new file mode 100755 index 0000000..b4abf6b --- /dev/null +++ b/playall @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +for HOST in $(fgrep 'all:' hosts | sed 's/.*all: *//g'); do + echo "Playing on $HOST" + ansible-playbook --diff -l "$HOST" "$@" + echo +done diff --git a/upgrade.yml b/upgrade.yml index 5da0759..31f6619 100644 --- a/upgrade.yml +++ b/upgrade.yml @@ -6,3 +6,5 @@ autoclean: yes update_cache: yes upgrade: dist + environment: + NEEDRESTART_MODE: automatically