From d4f185a99fd41f6927b3df2e80b1b24790242bd0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 5 Apr 2018 10:10:23 +0200 Subject: [PATCH 1/1] add basic packages playbook; work on upgrade playbook; provide script to run it on all hosts despite sudo PW differences --- .gitignore | 2 +- packages.yml | 14 ++++++++++++++ playall | 8 ++++++++ upgrade.yml | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 packages.yml create mode 100755 playall 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 -- 2.30.2