Merge branch 'develop'

This merges a working ansible role for redshift & gnupg back into master
This commit is contained in:
Johanna Dorothea Reichmann 2019-05-18 21:46:07 +02:00
commit 476ea6a83f
Signed by: transcaffeine
GPG Key ID: 03624C433676E465
24 changed files with 115 additions and 23 deletions

8
gnupg.yml Normal file
View File

@ -0,0 +1,8 @@
---
- name: Sets up gpg and the configs for using it as a ssh-agent
#connection: local
hosts: gnupg
become: true
roles:
- gnupg

20
inventory.yaml Normal file
View File

@ -0,0 +1,20 @@
---
all:
hosts:
xenon:
ansible_host: xenon.int.finallycoffee.eu
ansible_connection: local
vars:
ansible_user: transcaffeine
ansible_become_user: transcaffeine
ansible_become: true
gnupg:
hosts:
xenon:
redshift:
hosts:
xenon:

7
redshift.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: Sets up redshift and creates an autostart file
hosts: redshift
become: true
roles:
- redshift

View File

@ -2,7 +2,14 @@
alias ll='ls -al --color=auto' alias ll='ls -al --color=auto'
alias ls='ls -l --color=auto' alias ls='ls -l --color=auto'
alias nb=man
alias enby=man
alias furryfox=firefox
alias flauschctl=systemctl
# GnuPG2 # GnuPG2
alias gpg=gpg2 alias gpg=gpg2

View File

@ -5,3 +5,5 @@ gpg_cache_ttl_ssh: 300
# Array of all keygrips to pass to sshcontrol # Array of all keygrips to pass to sshcontrol
gpg_keygrips: [] gpg_keygrips: []
gpg_folder: "~/.gnupg"

View File

@ -1,14 +0,0 @@
#!/bin/bash
rc=$(pgrep gpg-agent)
if [ "$rc" != 0 ]; then
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
else
eval $(gpg-agent --daemon)
fi
gpg-connect-agent /bye
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)

View File

@ -2,27 +2,40 @@
# Installs GnuPG2 and templates the configs # Installs GnuPG2 and templates the configs
- name: Install gnupg (RedHat*) - name: Install gnupg (RedHat*)
yum: name=gnupg2 state=latest package:
name: gnupg2
state: latest
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: Install gnupg (Arch) - name: Install gnupg (Arch)
pacman: package:
name: gnupg name: gnupg
state: latest state: latest
when: ansible_os_family == "Archlinux" when: ansible_os_family == "Archlinux"
- name: Configure gpg.conf (behaviour of gpg) - name: Configure gpg.conf (behaviour of gpg)
template: src=gpg.conf.j2 ~/.gnupg/gpg.conf template:
src: gpg.conf.j2
dest: "{{ gpg_folder }}/gpg.conf"
- name: Configure gpg-agent.conf (agent configuration) - name: Configure gpg-agent.conf (agent configuration)
template: src=gpg-agent.conf.j2 ~/.gnupg/gpg-agent.conf template:
src: gpg-agent.conf.j2
dest: "{{ gpg_folder }}/gpg-agent.conf"
- name: Configure ssh-control (in order for gpg-agent to act as ssh-agent) - name: Configure ssh-control (in order for gpg-agent to act as ssh-agent)
template: src=sshcontrol.j2 ~/.gnupg/sshcontrol template:
src: sshcontrol.j2
dest: "{{ gpg_folder }}/sshcontrol"
- name: Copy gnupg_agent script, which makes gpg-agent responsible for ssh-auth - name: Copy gnupg_agent script, which makes gpg-agent responsible for ssh-auth
copy: template:
src: "{{ role_path }}/files/gpg_agent" src: gnupg_agent.j2
dest: ~/.gnupg/gpg_agent dest: "{{ gpg_folder }}/gnupg_agent"
mode: 0700 mode: 0700

View File

@ -0,0 +1,14 @@
#!/bin/bash
rc=$(pgrep gpg-agent)
if [ "$rc" != 0 ]; then
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
else
eval $(gpg-agent --daemon)
fi
gpg-connect-agent /bye
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)

View File

@ -10,5 +10,5 @@
# flags. Prepend the keygrip with an '!' mark to disable it. # flags. Prepend the keygrip with an '!' mark to disable it.
{% for keygrip in gpg_keygrips %} {% for keygrip in gpg_keygrips %}
{{ gpg_keygrips.keygrip }} {{ keygrip }}
{% endfor %} {% endfor %}

View File

@ -0,0 +1,23 @@
---
- name: Install redshift
package:
name: redshift
state: present
- name: Ensure .config folder for redshift exists
file:
path: ~/.config/redshift
state: directory
- name: Template redshift config
template:
src: redshift.conf.j2
dest: ~/.config/redshift/redshift.conf
- name: Template redshift autostart file
template:
src: redshift-gtk.desktop.j2
dest: ~/.config/autostart/redshift-gtk.desktop

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Name=Redshift
Exec=redshift-gtk
Icon=redshift
Terminal=false
Type=Application
Categories=Utility;
StartupNotify=true
Hidden=false
X-GNOME-Autostart-enabled=true