From 12f5700e6a20fdc9078c2b9a415df99ab8ee70d7 Mon Sep 17 00:00:00 2001 From: Lars Beckers <lars.beckers@rwth-aachen.de> Date: Thu, 27 Jul 2017 13:39:07 +0200 Subject: [PATCH] branding: make role configurable, add support for apt repo and tls ca --- branding/defaults/main.yml | 4 + branding/handlers/main.yml | 5 ++ branding/tasks/main.yml | 75 ++++++++++++++++--- .../gitconfig => templates/gitconfig.j2} | 4 +- .../issue.net => templates/issue.net.j2} | 2 +- .../{files/fsmpi/motd => templates/motd.j2} | 4 +- 6 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 branding/defaults/main.yml create mode 100644 branding/handlers/main.yml rename branding/{files/fsmpi/gitconfig => templates/gitconfig.j2} (50%) rename branding/{files/fsmpi/issue.net => templates/issue.net.j2} (51%) rename branding/{files/fsmpi/motd => templates/motd.j2} (61%) diff --git a/branding/defaults/main.yml b/branding/defaults/main.yml new file mode 100644 index 0000000..2628fb8 --- /dev/null +++ b/branding/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +branding_motd: motd.j2 +branding_issuenet: issue.net.j2 diff --git a/branding/handlers/main.yml b/branding/handlers/main.yml new file mode 100644 index 0000000..bb8554c --- /dev/null +++ b/branding/handlers/main.yml @@ -0,0 +1,5 @@ +--- + +- name: update apt cache + apt: update_cache=yes + diff --git a/branding/tasks/main.yml b/branding/tasks/main.yml index cf9183a..5d44561 100644 --- a/branding/tasks/main.yml +++ b/branding/tasks/main.yml @@ -1,25 +1,76 @@ --- -# file: roles/common/tasks/shell.yml +# file: supplemental/branding/tasks/main.yml -- name: ensure deployment of greeter - copy: src=fsmpi/motd dest=/etc/motd owner=root group=root mode=0644 +- name: ensure deployment of motd + template: + src: "{{ branding_motd }}" + dest: /etc/motd + owner: root + group: root + mode: 0644 + when: branding_motd tags: - - config + - branding - shell - - fsmpi - name: ensure deployment of issue.net - copy: src=fsmpi/issue.net dest=/etc/issue.net owner=root group=root mode=0644 + template: + src: "{{ branding_issuenet }}" + dest: /etc/issue.net + owner: root + group: root + mode: 0644 + when: branding_issuenet tags: - - config + - branding - shell - - fsmpi -- name: ensure deployment of a fancy gitconfig for root - copy: src=fsmpi/gitconfig dest=/root/.gitconfig owner=root group=root mode=0640 +- name: ensure deployment of gitconfig for root + template: + src: gitconfig.j2 + dest: /root/.gitconfig + owner: root + group: root + mode: 0640 tags: - - config + - branding - shell - root - - fsmpi + +- name: ensure deployment of CA certificates + copy: + src: "{{ item }}" + dest: "/etc/ssl/certs/{{ item }}" + owner: root + group: root + mode: 0644 + with_items: "{{ branding_cacerts }}" + when: branding_cacerts is defined + tags: + - branding + - tls + +- name: ensure deployment of apt repository keys + apt_key: + data: "{{ lookup('file', item) }}" + state: present + with_items: "{{ branding_apt_keys }}" + when: branding_apt_keys is defined + notify: + - update apt cache + tags: + - branding + - repos + +- name: ensure configuration of apt repositories + apt_repository: + repo: 'deb [arch=amd64] {{ item }}' + state: present + with_items: "{{ branding_apt_repos }}" + when: branding_apt_repos is defined + notify: + - update apt cache + tags: + - branding + - repos diff --git a/branding/files/fsmpi/gitconfig b/branding/templates/gitconfig.j2 similarity index 50% rename from branding/files/fsmpi/gitconfig rename to branding/templates/gitconfig.j2 index 64dc706..d3d4fc8 100644 --- a/branding/files/fsmpi/gitconfig +++ b/branding/templates/gitconfig.j2 @@ -1,6 +1,6 @@ [user] - name = FSMPI Admin-Team - email = admin@fsmpi.rwth-aachen.de + name = {{ branding_root_name }} + email = {{ branding_root_mail }} [push] default = simple [alias] diff --git a/branding/files/fsmpi/issue.net b/branding/templates/issue.net.j2 similarity index 51% rename from branding/files/fsmpi/issue.net rename to branding/templates/issue.net.j2 index 5cb7f36..80568e1 100644 --- a/branding/files/fsmpi/issue.net +++ b/branding/templates/issue.net.j2 @@ -1,2 +1,2 @@ -Fachschaft Mathematik/Physik/Informatik, RWTH Aachen +{{ branding_organization }} Access to this machine is for authorized personnel only. diff --git a/branding/files/fsmpi/motd b/branding/templates/motd.j2 similarity index 61% rename from branding/files/fsmpi/motd rename to branding/templates/motd.j2 index 7632daf..ec85696 100644 --- a/branding/files/fsmpi/motd +++ b/branding/templates/motd.j2 @@ -1,9 +1,9 @@ ######################################################################### -# RWTH Aachen University -- Fachschaft Mathematik/Physik/Informatik # +#{{ ' '*((71-branding_organization|length)/2)|round(0, 'floor')|int }}{{ branding_organization }}{{ ' '*((71-branding_organization|length)/2)|round(0, 'ceil')|int }}# ######################################################################### # # # If you have any problems send an eMail to # # # -# admin@fsmpi.rwth-aachen.de # +#{{ ' '*((71-branding_root_mail|length)/2)|round(0, 'floor')|int }}{{ branding_root_mail }}{{ ' '*((71-branding_root_mail|length)/2)|round(0, 'ceil')|int }}# # # ######################################################################### -- GitLab