From 0bac22d3d5799ef6c95838d3de08a0d1e1d7ef2b Mon Sep 17 00:00:00 2001 From: Harald Pfeiffer Date: Mon, 10 Jan 2022 14:32:38 +0100 Subject: rename of ansible debian templating --- ansible-2.j2 | 19 -------------- ansible-2.yml | 71 ---------------------------------------------------- debian-ansible-2.j2 | 19 ++++++++++++++ debian-ansible-2.yml | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 ansible-2.j2 delete mode 100644 ansible-2.yml create mode 100644 debian-ansible-2.j2 create mode 100644 debian-ansible-2.yml diff --git a/ansible-2.j2 b/ansible-2.j2 deleted file mode 100644 index 746d5bf..0000000 --- a/ansible-2.j2 +++ /dev/null @@ -1,19 +0,0 @@ -{# -# vim:syntax=jinja -#} -{% if vars.ans is defined %} -{% if ansible_distribution_version is defined and ansible_distribution_version == "11" %} -# Debian 11 ({{vars.ans.11.debname}}) -deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.11.release}} main -{% elif ansible_distribution_version is defined and ansible_distribution_version == "10" %} -# Debian 10 ({{vars.ans.10.debname}}) -deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.10.release}} main -{% elif ansible_distribution_version is defined and ansible_distribution_version == "9" %} -# Debian 9 ({{vars.ans.9.debname}}) -deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.9.release}} main -{% else %} -# NO REPO KNOWN FOR THIS DEBIAN RELEASE -{% endif %} -{% else %} -# RS.ANS WAS NOT DEFINED -{% endif %} diff --git a/ansible-2.yml b/ansible-2.yml deleted file mode 100644 index f3fc1ce..0000000 --- a/ansible-2.yml +++ /dev/null @@ -1,71 +0,0 @@ -# preliminary: Debian ships with ansible 2.7 (buster) and at least 2.10 (bullseye). Well, in case -# of ansible, Ubuntu is not bleeding edge, so let's get our stuff there. For now, while we don't have -# a more sophisticated package distribution at hand. ---- -- hosts: "{{runtime_hosts|default('CHANGE_ME')}}" - gather_facts: "no" - vars: - ans: - 11: - release: "focal" - debname: "bullseye" - 10: - release: "bionic" - debname: "buster" - 9: - release: "xenial" - debname: "stretch" - key: - id: "93C4A3FD7BB9C367" - tasks: - - name: Gather facts subset - setup: - filter: "ansible_distribution*" - - name: Acquire Debian hosts - debug: - msg: "System is {{ansible_distribution}} {{ansible_distribution_version}}, checking in." - when: - - ansible_distribution == "Debian" - - ansible_distribution_version == "11" or ansible_distribution_version == "10" or ansible_distribution_version == "9" - changed_when: true - notify: - - "deb all" - handlers: - - name: Create ansible repository file - template: - src: "./ansible-2.j2" - dest: "/etc/apt/sources.list.d/ansible-ubuntu.list" - owner: root - group: root - mode: "0644" - become: true - listen: - - "deb all" - - name: Import repository key - apt_key: - id: "{{ans.key.id}}" - keyserver: keyserver.ubuntu.com - state: "present" - become: true - listen: "deb all" - - name: Update apt cache - apt: - update_cache: "yes" - become: true - listen: "deb all" - - name: Remove ansible - # just upgrading stuff ended up in a broken installation due to a file being locked mutually between old - # and new package on debian 11. apt -f install fixed it without flaws, however - do we want that here? no. - apt: - name: "ansible" - state: "absent" - become: true - listen: "deb all" - when: ansible_distribution_version == "11" - - name: Install ansible (again) - apt: - name: "ansible" - state: "latest" - install_recommends: "yes" - become: true - listen: "deb all" diff --git a/debian-ansible-2.j2 b/debian-ansible-2.j2 new file mode 100644 index 0000000..746d5bf --- /dev/null +++ b/debian-ansible-2.j2 @@ -0,0 +1,19 @@ +{# +# vim:syntax=jinja +#} +{% if vars.ans is defined %} +{% if ansible_distribution_version is defined and ansible_distribution_version == "11" %} +# Debian 11 ({{vars.ans.11.debname}}) +deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.11.release}} main +{% elif ansible_distribution_version is defined and ansible_distribution_version == "10" %} +# Debian 10 ({{vars.ans.10.debname}}) +deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.10.release}} main +{% elif ansible_distribution_version is defined and ansible_distribution_version == "9" %} +# Debian 9 ({{vars.ans.9.debname}}) +deb http://ppa.launchpad.net/ansible/ansible/ubuntu {{vars.ans.9.release}} main +{% else %} +# NO REPO KNOWN FOR THIS DEBIAN RELEASE +{% endif %} +{% else %} +# RS.ANS WAS NOT DEFINED +{% endif %} diff --git a/debian-ansible-2.yml b/debian-ansible-2.yml new file mode 100644 index 0000000..0780674 --- /dev/null +++ b/debian-ansible-2.yml @@ -0,0 +1,71 @@ +# preliminary: Debian ships with ansible 2.7 (buster) and at least 2.10 (bullseye). Well, in case +# of ansible, Ubuntu is not bleeding edge, so let's get our stuff there. For now, while we don't have +# a more sophisticated package distribution at hand. +--- +- hosts: "{{runtime_hosts|default('CHANGE_ME')}}" + gather_facts: "no" + vars: + ans: + 11: + release: "focal" + debname: "bullseye" + 10: + release: "bionic" + debname: "buster" + 9: + release: "xenial" + debname: "stretch" + key: + id: "93C4A3FD7BB9C367" + tasks: + - name: Gather facts subset + setup: + filter: "ansible_distribution*" + - name: Acquire Debian hosts + debug: + msg: "System is {{ansible_distribution}} {{ansible_distribution_version}}, checking in." + when: + - ansible_distribution == "Debian" + - ansible_distribution_version == "11" or ansible_distribution_version == "10" or ansible_distribution_version == "9" + changed_when: true + notify: + - "deb all" + handlers: + - name: Create ansible repository file + template: + src: "./debian-ansible-2.j2" + dest: "/etc/apt/sources.list.d/ansible-ubuntu.list" + owner: root + group: root + mode: "0644" + become: true + listen: + - "deb all" + - name: Import repository key + apt_key: + id: "{{ans.key.id}}" + keyserver: keyserver.ubuntu.com + state: "present" + become: true + listen: "deb all" + - name: Update apt cache + apt: + update_cache: "yes" + become: true + listen: "deb all" + - name: Remove ansible + # just upgrading stuff ended up in a broken installation due to a file being locked mutually between old + # and new package on debian 11. apt -f install fixed it without flaws, however - do we want that here? no. + apt: + name: "ansible" + state: "absent" + become: true + listen: "deb all" + when: ansible_distribution_version == "11" + - name: Install ansible (again) + apt: + name: "ansible" + state: "latest" + install_recommends: "yes" + become: true + listen: "deb all" -- cgit v1.2.3