From 30ace79d734654d0a11cffaaae7a56a6c1cb6b2e Mon Sep 17 00:00:00 2001 From: Ataxya Date: Mon, 11 Oct 2021 21:30:52 +0200 Subject: [PATCH] Initial commit: update&upgrade --- README.md | 0 files/list-bullseye.j2 | 5 +++++ files/list-bullseye.j2~ | 5 +++++ inventory | 3 +++ playbook/update.yml | 6 ++++++ playbook/update.yml~ | 6 ++++++ playbook/upgrade.yml | 17 +++++++++++++++++ playbook/upgrade.yml~ | 13 +++++++++++++ 8 files changed, 55 insertions(+) create mode 100644 README.md create mode 100644 files/list-bullseye.j2 create mode 100644 files/list-bullseye.j2~ create mode 100644 inventory create mode 100644 playbook/update.yml create mode 100644 playbook/update.yml~ create mode 100644 playbook/upgrade.yml create mode 100644 playbook/upgrade.yml~ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/files/list-bullseye.j2 b/files/list-bullseye.j2 new file mode 100644 index 0000000..72941ce --- /dev/null +++ b/files/list-bullseye.j2 @@ -0,0 +1,5 @@ +deb http://deb.debian.org/debian/ bullseye main contrib non-free +deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free +deb http://deb.debian.org/debian bullseye-proposed-updates main contrib non-free +deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free +deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free diff --git a/files/list-bullseye.j2~ b/files/list-bullseye.j2~ new file mode 100644 index 0000000..8da549a --- /dev/null +++ b/files/list-bullseye.j2~ @@ -0,0 +1,5 @@ +deb http://deb.debian.org/debian/ bullseye main contrib non-free +deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free +deb http://deb.debian.org/debian bullseye-proposed-updates main contrib non-free +deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free +deb http://deb.debian.org/debian/ bullseye-backports main contrib non-free \ No newline at end of file diff --git a/inventory b/inventory new file mode 100644 index 0000000..9947ec0 --- /dev/null +++ b/inventory @@ -0,0 +1,3 @@ +[all] + +10.20.1.101 ansible_user=root #website \ No newline at end of file diff --git a/playbook/update.yml b/playbook/update.yml new file mode 100644 index 0000000..6b3b150 --- /dev/null +++ b/playbook/update.yml @@ -0,0 +1,6 @@ +- hosts: all + tasks: + - name: update a server + apt: update_cache=yes + - name: upgrade a server + apt: upgrade diff --git a/playbook/update.yml~ b/playbook/update.yml~ new file mode 100644 index 0000000..5bb1f2c --- /dev/null +++ b/playbook/update.yml~ @@ -0,0 +1,6 @@ +- hosts: all + tasks: + - name: update a server + apt: update_cache=yes + - name: upgrade a server + apt: upgrade=dist diff --git a/playbook/upgrade.yml b/playbook/upgrade.yml new file mode 100644 index 0000000..c0aa020 --- /dev/null +++ b/playbook/upgrade.yml @@ -0,0 +1,17 @@ +--- +- hosts: all + tasks: + - name: Change /etc/apt/sources.list + template: + src: /home/ansible/ansible/files/list-bullseye.j2 + dest: /etc/apt/sources.list + + - name: Updating apt cache + apt: update_cache=yes + + - name: Lauch upgrade + apt: upgrade=dist + + - name: Reboot + reboot: + msg: "Attention au reboot !" diff --git a/playbook/upgrade.yml~ b/playbook/upgrade.yml~ new file mode 100644 index 0000000..d81b46e --- /dev/null +++ b/playbook/upgrade.yml~ @@ -0,0 +1,13 @@ +--- +- hosts: all + tasks: + - name: Change /etc/apt/sources.list + template: + src: /home/ansible/ansible/files/list-bullseye.j2 + dest: /etc/apt/sources.list + + - name: Updating apt cache + apt: update_cache=yes + + - name: Lauch upgrade + apt: upgrade=dist