Commit 05f1faab authored by julian.gethmann's avatar julian.gethmann

Add LaTeX role that works, mostly

* Add texlive-latexdiff for producing LaTeX documents as a diff of
LaTeX-documents (a bit like trackchanges
* Add a4wide
* Add systemdocu LaTeX dependencies
* Arial probably not working (no testcase)
* Fix issue #16 and #17
* Make rule idempotent

* Add las122
parent 3e40ecd9
...@@ -3,7 +3,6 @@ You need to have access to this repository (you need to add your public ssh-key ...@@ -3,7 +3,6 @@ You need to have access to this repository (you need to add your public ssh-key
Then you can clone the git repository to work on in locally. Then you can clone the git repository to work on in locally.
`git clone git@git.scc.kit.edu:las/ansible.git` `git clone git@git.scc.kit.edu:las/ansible.git`
## How to use ansible for software installation/computer *setup*
Add your computer to the hosts file or if you are just testing add it to the local file. Add your computer to the hosts file or if you are just testing add it to the local file.
Add your hostname under each role name (the name in the square brackets) you want to be run on your computer. Add your hostname under each role name (the name in the square brackets) you want to be run on your computer.
Also create a new file which is named Also create a new file which is named
...@@ -37,7 +36,7 @@ Open an issue in the GitLab issue tracker with the label: softwarerequest ...@@ -37,7 +36,7 @@ Open an issue in the GitLab issue tracker with the label: softwarerequest
* lasarchiv: client side mount las126/las-archiv1 * lasarchiv: client side mount las126/las-archiv1
* opera.yml: Cobham's Opera3d (client) ^2 ^3 * opera.yml: Cobham's Opera3d (client) ^2 ^3
* admin.yml: tools for administrators * admin.yml: tools for administrators
* latex.yml: basic LaTeX installation (KIT classes not yet) ^1 * latex.yml: basic LaTeX installation (Arial not yet) ^1
* kdev.yml: KDevelope (with Python PlugIn) ^1 * kdev.yml: KDevelope (with Python PlugIn) ^1
* jabref.yml: Cross platform BibTeX bibilography software [JabRef](http://www.jabref.org/) * jabref.yml: Cross platform BibTeX bibilography software [JabRef](http://www.jabref.org/)
* pycharm.yml: Cross platform Python IDE: [PyCharm](https://www.jetbrains.com/pycharm/) IDE * pycharm.yml: Cross platform Python IDE: [PyCharm](https://www.jetbrains.com/pycharm/) IDE
......
[defaults] [defaults]
inventory=hosts inventory=hosts
pipelining = True pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
remote_user=gethmann remote_user=gethmann
roles_path=roles roles_path=roles
become=False become=False
......
...@@ -228,4 +228,10 @@ texlivepackages: ...@@ -228,4 +228,10 @@ texlivepackages:
- texlive-gitinfo2.noarch - texlive-gitinfo2.noarch
- texlive-fncychap # e. g. Sphinx - texlive-fncychap # e. g. Sphinx
- texlive-tabulary - texlive-tabulary
# to be continued - texlive-latexdiff
# - texlive-latexdiff-bin
- texlive-a4wide
# systemdocu
- texlive-koma-script
- texlive-ctablestack
# to be continued
...@@ -17,6 +17,7 @@ las118.las.kit.edu ...@@ -17,6 +17,7 @@ las118.las.kit.edu
las120.las.kit.edu las120.las.kit.edu
las122.las.kit.edu las122.las.kit.edu
las-gethmann.las.kit.edu las-gethmann.las.kit.edu
las122.las.kit.edu
[lasarchiv] [lasarchiv]
las113.las.kit.edu las113.las.kit.edu
...@@ -37,6 +38,7 @@ las122.las.kit.edu ...@@ -37,6 +38,7 @@ las122.las.kit.edu
[ipynb] # Jupyter notebook [ipynb] # Jupyter notebook
las-gethmann.las.kit.edu las-gethmann.las.kit.edu
las120.las.kit.edu las120.las.kit.edu
las122.las.kit.edu
[kdev] # KDevelope [kdev] # KDevelope
......
...@@ -30,3 +30,9 @@ ...@@ -30,3 +30,9 @@
- name: lock root user - name: lock root user
become: yes become: yes
command: passwd -l root command: passwd -l root
- name: Register all TeX fonts
environment:
PATH: "{{ lookup('env', 'PATH') }}"
become: yes
shell: getnonfreefonts-sys -r
--- ---
- name: create bst dir
become: yes
file:
path: "{{ texpath }}/bibtex/bst"
state: directory
- name: install Axel Bernhard's BibTeX-class for poster kurz.bst - name: install Axel Bernhard's BibTeX-class for poster kurz.bst
become: yes become: yes
copy: copy:
src: kurz.bst src: kurz.bst
dest: /usr/local/texlive/texmf-local/bibtex/bst/ dest: "{{ texpath }}/bibtex/bst/kurz.bst"
backup: yes backup: yes
notify: hash latex notify:
- hash latex
tags: kurzbst tags: kurzbst
...@@ -20,83 +20,68 @@ ...@@ -20,83 +20,68 @@
- texlive-lettrine - texlive-lettrine
- texlive-mathpazo - texlive-mathpazo
- texlive-rcs - texlive-rcs
# - texlive-refcount
- texlive-sciposter - texlive-sciposter
- texlive-shadow - texlive-shadow
- texlive-pgf - texlive-pgf
- texlive-xcolor - texlive-xcolor
- "{{ kit_tikz }}" - "{{ kit_tikz }}"
- name: make tmpdir
# ansible 2.0 tempfile:
#- download current zip files prefix: ansi
# unarchive: src="{{item}}" dest=~/ansible/roles/latex/files/ copy=no state: directory
# delegate_to: 127.0.0.1 register: tmpdir
# with_items:
# - "https://intranet.kit.edu/downloads/KIT-Vorlagen-Folien.zip"
# - "https://intranet.kit.edu/downloads/KIT-Vorlagen-Poster.zip"
# - name: Unzip KIT-Classes
# become: yes
# #shell: ls /tmp > /tmp/list
# unarchive: src={{ item }}.zip dest=/usr/share/texlive/texmf-local/
# with_items:
# - KITbase
# - KITbeamer
# - KITbrief
# - KITposter
# notify: update latex
# tags: kit
- name: clone git repo - name: clone git repo
git: git:
repo: https://git.scc.kit.edu/las/templates/KITlatex.git repo: https://git.scc.kit.edu/las/templates/KITlatex.git
dest: "{{ texpath }}/KIT" dest: "{{ tmpdir.path }}"
clone: yes clone: yes
key_file: "{{ lookup('file', '/home/gethmann/.ssh/id_rsa.pub') }}" version: HEAD
update: yes
become: yes become: yes
register: kit_git register: kit_git
# This causes status change (because of the recursive copy I think) - name: create tex dir
- name: copy files become: yes
file:
path: "{{ texpath }}/tex/latex/KIT"
state: directory
- name: copy tex files
copy: copy:
src: "{{ texpath }}/KIT/" src: "{{ item }}"
dest: "{{ texpath }}" dest: "{{ texpath }}/tex/latex/KIT/"
become: yes become: yes
remote_src: yes
notify: notify:
- update latex - update latex
when: kit_git|changed with_fileglob:
- "{{ tmpdir.path }}/KIT/tex/latex/KIT/*"
# - name: cleanup - name: create doc dir
# file: state=absent dest=/tmp/{{item}} become: yes
# with_items: file:
# - Install-En.pdf path: "{{ texpath }}/doc/latex/KIT"
# - Install-De.pdf state: directory
# - Install-En.txt
# - Install-De.txt
# - KITbase.zip
# - KITbeamerXmpl.zip
# - KITbeamer.zip
# - KIT_Briefvorlagen_LaTeX.zip
# - KITbriefXmpl.zip
# - KITbrief.zip
# - KITmanualD.pdf
# - KITmanualE.pdf
# - KITposterXmpl.zip
# - KITposter.zip
# - KIT-Vorlagen-Folien-LaTeX_06-12.zip
# - KIT-Vorlagen-Poster-LaTeX_06-12.zip
# - KIT-Vorlagen-Folien.zip
# - KIT-Vorlagen-Poster.zip
# tags:
# - latex
# - kit
- name: copy pdf files
become: yes
copy:
src: "{{ item }}"
dest: "{{ texpath }}/doc/latex/KIT/"
remote_src: yes
notify:
- update latex
with_fileglob:
- "{{ tmpdir.path }}/KIT/doc/latex/KIT/*"
# This should be deleted when the Arial task is working
- name: hack Helvetica into KIT styles due to broken font installation - name: hack Helvetica into KIT styles due to broken font installation
lineinfile: lineinfile:
line: "\\RequirePackage{helvet}" line: "\\RequirePackage{helvet}"
regexp: "\\RequirePackage{uarial}" regexp: "\\RequirePackage{(uarial|helvet)}"
dest: "{{ texpath }}/tex/latex/KIT/{{item}}" dest: "{{ texpath }}/tex/latex/KIT/{{ item }}"
backup: yes backup: yes
become: yes become: yes
with_items: with_items:
...@@ -107,66 +92,3 @@ ...@@ -107,66 +92,3 @@
tags: tags:
- latex - latex
- kit - kit
when: kit_git|changed
# TODO
# - name: download uarial
# unarchive: src="ftp://ftp.dante.de/tex-archive/fonts/urw/arial.zip" dest={{ texpath }}/KIT/arial creates={{ texpath }}/KIT/arial
# become: yes
#
# - name: create missing directories
# file: state=directory path={{ texpath }}/{{ item }}
# with_items:
# - fonts/afm/urw
# - fonts/tfm/urw
# - fonts/type1/urw
# - fonts/vf/urw
# - fonts/map/dvips/ua1
# - fonts/map/vtex
# - dvips/config
# - doc/fonts
# become: yes
# notify:
# - update latex local
# - update fonts
# - update latex
#
# - name: move afm, tfm, type1, vf dirs
# copy: src={{ item }} dest={{ texpath }}/fonts/{{ item }}/arial
# with_items:
# - afm
# - tfm
# - type1
# - vf
# become: yes
# notify:
# - update latex local
# - update fonts
# - update latex
#
# - name: copy latex dir
# copy: src=latex dest={{ texpath }}/tex/latex/ua1
# become: yes
# notify:
# - update latex local
# - update fonts
# - update latex
#
# - name: copy map dir
# copy: src={{ item.from }} dest={{ texpath }}/{{ item.to }}
# with_items:
# - {from: "map/ua1.map", to: "dvips/config"}
# - {from: "map/ua1.map", to: "fonts/map/dvips/ua1"}
# - {from: "map/ua1.ali", to: "fonts/map/vtex"}
# become: yes
# notify:
# - update latex local
# - update fonts
# - update latex
#
# - name: copy docu 1/2
# copy: src={{ item }} dest={{ texpath }}/doc/fonts/urw
# with_items:
# - doc
# - README
# become: yes
...@@ -5,32 +5,34 @@ ...@@ -5,32 +5,34 @@
changed_when: gnff_available.rc != 0 changed_when: gnff_available.rc != 0
ignore_errors: yes ignore_errors: yes
- name: Check installed fonts
become: yes
command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -l | grep 'not installed'"
register: all_fonts
changed_when: all_fonts.rc == 0
ignore_errors: yes
- name: Download common MS fonts - name: Download common MS fonts
become: yes
get_url: get_url:
dest: /tmp/ dest: "{{ texpath }}"
url: https://www.tug.org/fonts/getnonfreefonts/install-getnonfreefonts url: "https://www.tug.org/fonts/getnonfreefonts/install-getnonfreefonts"
mode: 0777 mode: 0777
register: tex_fonts_dl_ok register: tex_fonts_dl_ok
when: gnff_available.changed when: gnff_available.changed
- name: Install getnonfreefonts - name: Install getnonfreefonts
become: yes
environment: environment:
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
command: /tmp/install-getnonfreefonts command: "{{ texpath }}/install-getnonfreefonts"
when: gnff_available.changed args:
register: gnff_downloaded creates: /usr/local/bin/getnonfreefonts
- name: Check installed fonts
become: yes
command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -l | grep 'not installed'"
register: all_fonts
changed_when: all_fonts.rc == 0
ignore_errors: yes
- name: Install all TeX fonts - name: Install all TeX fonts
become: yes
environment: environment:
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
become: yes
command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -a" command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -a"
when: all_fonts.changed when: all_fonts.changed
...@@ -41,10 +43,5 @@ ...@@ -41,10 +43,5 @@
command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -r" command: sudo su -c "/usr/local/bin/getnonfreefonts-sys -r"
when: all_fonts.changed when: all_fonts.changed
- name: cleanup - name: flush handlers
file: meta: flush_handlers
state: absent
dest: "/tmp/{{ item }}"
with_items:
- install-getnonfreefonts
when: gnff_downloaded.changed
--- ---
# Install LaTeX and KIT classes on host # Install LaTeX
# not tested yet
- name: Install Fedora's LaTeX - name: Install Fedora's LaTeX
become: yes become: yes
dnf: dnf:
name: texlive name: texlive
state: present state: installed
when: ansible_distribution == "Fedora"
tags: latex tags: latex
- name: Install LaTeX subpackages - name: Install LaTeX subpackages
become: yes become: yes
dnf: dnf:
name: "{{ item }}" name: "{{ item }}"
state: present state: installed
with_items: "{{ texlivepackages }}" with_items: "{{ texlivepackages }}"
when: ansible_distribution == "Fedora" when: ansible_distribution == "Fedora"
# - name: profile.d (for TL {{tlyear}})
# copy: src=latex.sh dest=/etc/profile.d/latex.sh owner=root group=root mode=744
# become: yes
# tags: latex
# register: latexsh
#
# - name: run latex.sh (for TL {{tlyear}})
# action: shell bash /etc/profile.d/latex.sh
# become: yes
# tags: latex
# notify: update latex
# when: latexsh|changed
---
- name: check if arial is installed
stat:
path: "{{ texpath }}/fonts/map/vtex/ua1.ali"
register: arial
# - name: temporary directory
# file:
# path: /tmp/arial
# state: directory
# when: arial.stat.isreg
- name: download uarial
become: yes
unarchive:
src: "ftp://ftp.dante.de/tex-archive/fonts/urw/arial.zip"
dest: /tmp
creates: /tmp/arial
remote_src: yes
when: arial.stat.isreg == false
- name: create missing directories
become: yes
file:
state: directory
path: "{{ texpath }}/{{ item }}"
with_items:
- fonts/afm/urw
- fonts/tfm/urw
- fonts/type1/urw
- fonts/vf/urw
- fonts/map/dvips/ua1
- fonts/map/vtex
- dvips/config
- doc/fonts
when: arial.stat.isreg == false
notify:
- update latex
- name: move afm, tfm, type1, vf dirs
become: yes
copy:
src: "/tmp/arial/{{ item }}/"
dest: "{{ texpath }}/fonts/{{ item }}/urw/arial"
with_items:
- afm
- tfm
- type1
- vf
when: arial.stat.isreg == false
notify:
- update latex
- name: copy latex dir
become: yes
copy:
src: /tmp/arial/latex/
dest: "{{ texpath }}/tex/latex/ua1"
when: arial.stat.isreg == false
notify:
- update latex
- name: copy map dir
become: yes
copy:
src: "/tmp/arial/{{ item.from }}"
dest: "{{ texpath }}/{{ item.to }}"
with_items:
- { from: "map/ua1.map", to: "dvips/config" }
- { from: "map/ua1.map", to: "fonts/map/dvips/ua1" }
- { from: "map/ua1.ali", to: "fonts/map/vtex" }
when: arial.stat.isreg == false
notify:
- update latex
- name: copy docu
become: yes
copy:
src: "/tmp/arial/{{ item }}"
dest: "{{ texpath }}/doc/fonts/urw"
with_items:
- doc/
- README
when: arial.stat.isreg == false
notify:
- update latex
- name: activate fonts
become: yes
environment:
PATH: "{{ lookup('env', 'PATH') }}"
command: updmap-sys --enable Map ua1.map
args:
chdir: "{{ texpath }}"
when: arial.stat.isreg == false
notify:
- update latex
--- ---
- name: create tex dir
become: yes
file:
path: "{{ texpath }}/tex/latex"
state: directory
- name: Install DPG-Tagungen document class - name: Install DPG-Tagungen document class
become: yes become: yes
copy: copy:
src: scdpg.cls src: scdpg.cls
dest: "{{ texpath }}/tex/latex/" dest: "{{ texpath }}/tex/latex/"
notify: hash latex notify:
- hash latex
tags: latex tags: latex
- name: Install JACoW-Tagungen document class - name: Install JACoW-Tagungen document class
...@@ -12,5 +19,6 @@ ...@@ -12,5 +19,6 @@
copy: copy:
src: jacow.cls src: jacow.cls
dest: "{{ texpath }}/tex/latex/" dest: "{{ texpath }}/tex/latex/"
notify: hash latex notify:
- hash latex
tags: latex tags: latex
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- name: create destination directories - name: create destination directories
become: yes become: yes
file: file:
path: "/usr/share/texlive/texmf-local/{{ item }}/latex/uniinput" path: "{{ texpath }}/{{ item }}/latex/uniinput"
state: directory state: directory
mode: 0755 mode: 0755
with_items: with_items:
...@@ -25,12 +25,16 @@ ...@@ -25,12 +25,16 @@
chdir: /tmp chdir: /tmp
creates: /tmp/uniinput.pdf creates: /tmp/uniinput.pdf
ignore_errors: yes ignore_errors: yes
when: uniinputdir.changed
register: pdf_file
- name: compile package - name: compile package
command: latex uniinput.ins command: latex uniinput.ins
args: args:
chdir: /tmp chdir: /tmp
creates: /tmp/uniinput.sty creates: /tmp/uniinput.sty
when: uniinputdir.changed
register: sty_file
- name: move style to LaTeX dir - name: move style to LaTeX dir
become: yes become: yes
...@@ -39,6 +43,7 @@ ...@@ -39,6 +43,7 @@
dest: "{{ texpath }}/tex/latex/uniinput/uniinput.sty" dest: "{{ texpath }}/tex/latex/uniinput/uniinput.sty"
remote_src: yes remote_src: yes
notify: update latex notify: update latex
when: sty_file is defined and sty_file.changed
- name: move docu to LaTeX dir - name: move docu to LaTeX dir
become: yes become: yes
...@@ -47,3 +52,4 @@ ...@@ -47,3 +52,4 @@
dest: "{{ texpath }}/doc/latex/uniinput/uniinput.pdf" dest: "{{ texpath }}/doc/latex/uniinput/uniinput.pdf"
remote_src: yes remote_src: yes
notify: update latex notify: update latex
when: pdf_file is defined and pdf_file.changed
---
kit_tex:
- audit_fgh_z_10_rgb_7.jpg
- audit_fgh_z_10_rgb_7_mask.jpg
- audit_fgh_z_10_sw_7.jpg
- audit_fgh_z_10_sw_7_mask.jpg
- beamercolorthemeKIT.sty
- beamerfontthemeKIT.sty
- beamerinnerthemeKIT.sty
- beamerouterthemeKIT.sty
- beamerthemeKIT.sty
- KIT16.clo
- KIT18.clo
- KIT20.clo
- KIT22.clo
- KIT24.clo
- KITbrief.cls
- KITcolors.sty
- KITdefs.sty
- KITfax.cls
- kit_logo_de_1c_schwarz.pdf
- kit_logo_de_4c_positiv.pdf
- kit_logo_de_4c_positiv-rgb.pdf
- kit_logo_en_1c_schwarz.pdf
- kit_logo_en_4c_positiv.pdf
- kit_logo_en_4c_positiv-rgb.pdf
- KITmcfloat.sty
- KITposter.cls
- papera4.cfg
- paperb4.cfg
kit_doc:
- KITmanualD.pdf
- KITmanualE.pdf
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
line: "# add_executable (NAFF main_NAFF.cpp ${SOURCE_FILES} ${HEADER_FILES})" line: "# add_executable (NAFF main_NAFF.cpp ${SOURCE_FILES} ${HEADER_FILES})"
regexp: "add_executable.*" regexp: "add_executable.*"
path: /tmp/NAFF_cpp/CMakeLists.txt path: /tmp/NAFF_cpp/CMakeLists.txt
- name: build - name: build
command: cmake .. command: cmake ..
args: args:
...@@ -90,5 +90,5 @@ ...@@ -90,5 +90,5 @@
src: /tmp/NAFF_cpp/NAFF.so src: /tmp/NAFF_cpp/NAFF.so
dest: /usr/lib/python2.7/site-packages/NAFF.so dest: /usr/lib/python2.7/site-packages/NAFF.so
backup: yes backup: yes
remote_src: True remote_src: yes
when: not_there.rc == 1 when: not_there.rc == 1
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
copy: copy:
src: /mnt/las-archiv1/system/Opera/18/Opera_RHEL7.tar.bz src: /mnt/las-archiv1/system/Opera/18/Opera_RHEL7.tar.bz
dest: /tmp dest: /tmp
remote_src: True remote_src: yes
when: stat_result.stat.exists == False when: stat_result.stat.exists == False
- name: unzip Opera - name: unzip Opera
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
copy: copy:
src: "/mnt/las-archiv1/system/Opera/18/CentOS7libs/{{ item.src }}" src: "/mnt/las-archiv1/system/Opera/18/CentOS7libs/{{ item.src }}"
dest: "{{ opera_path }}/CentOS7libs/{{ item.dest }}" dest: "{{ opera_path }}/CentOS7libs/{{ item.dest }}"
remote_src: True remote_src: yes
with_items: with_items:
- { dest: 'libicui18n.so.50', src: 'libicui18n.so.50.1.2' } - { dest: 'libicui18n.so.50', src: 'libicui18n.so.50.1.2' }
- { dest: 'libicuuc.so.50', src: 'libicuuc.so.50.1.2' } - { dest: 'libicuuc.so.50', src: 'libicuuc.so.50.1.2' }
......
--- ---
- name: check if PyCharm is installed - name: create directory
stat:
path: "/usr/local/pycharm/{{ pycharm_name | regex_replace('-professional') }}"
register: pycharm_installation
- name: create temporary download directory
tempfile:
state: directory
register: tmpdir
when: not (pycharm_installation.stat.isdir is defined and pycharm_installation.stat.isdir)
- name: download PyCharm
get_url:
url: "https://download-cf.jetbrains.com/python/{{ pycharm_name }}.tar.gz"
dest: "{{ tmpdir.path }}/pycharm.tar.gz"
when: tmpdir.changed
- name: Create directory
become: yes become: yes
file