From 46f25cf6161508e93fdd2baf07d1d59b831efd32 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Thu, 2 May 2019 19:39:41 +0200 Subject: [PATCH 01/11] Use YAML consistently --- roles/gnupg/tasks/main.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/roles/gnupg/tasks/main.yml b/roles/gnupg/tasks/main.yml index 1ba4f4e..65b2599 100644 --- a/roles/gnupg/tasks/main.yml +++ b/roles/gnupg/tasks/main.yml @@ -2,23 +2,31 @@ # Installs GnuPG2 and templates the configs - name: Install gnupg (RedHat*) - yum: name=gnupg2 state=latest + package: + name: gnupg2 + state: latest when: ansible_os_family == "RedHat" - name: Install gnupg (Arch) - pacman: + package: name: gnupg state: latest when: ansible_os_family == "Archlinux" - name: Configure gpg.conf (behaviour of gpg) - template: src=gpg.conf.j2 ~/.gnupg/gpg.conf + template: + src: gpg.conf.j2 + dest: ~/.gnupg/gpg.conf - name: Configure gpg-agent.conf (agent configuration) - template: src=gpg-agent.conf.j2 ~/.gnupg/gpg-agent.conf + template: + src: gpg-agent.conf.j2 + dest: ~/.gnupg/gpg-agent.conf - 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: ~/.gnupg/sshcontrol - name: Copy gnupg_agent script, which makes gpg-agent responsible for ssh-auth copy: From 383abb4458972903604b30257db2ad6448da1a36 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Thu, 2 May 2019 19:51:20 +0200 Subject: [PATCH 02/11] Use the latest version of the agent file, externalize common strings into var in defaults --- roles/gnupg/defaults/main.yml | 2 ++ roles/gnupg/files/gnupg_agent | 14 -------------- roles/gnupg/tasks/main.yml | 15 ++++++++++----- roles/gnupg/templates/gnupg_agent.j2 | 14 ++++++++++++++ 4 files changed, 26 insertions(+), 19 deletions(-) delete mode 100755 roles/gnupg/files/gnupg_agent diff --git a/roles/gnupg/defaults/main.yml b/roles/gnupg/defaults/main.yml index 4687fc3..2ca58dc 100644 --- a/roles/gnupg/defaults/main.yml +++ b/roles/gnupg/defaults/main.yml @@ -5,3 +5,5 @@ gpg_cache_ttl_ssh: 300 # Array of all keygrips to pass to sshcontrol gpg_keygrips: [] +gpg_folder: "~/.gnupg" + diff --git a/roles/gnupg/files/gnupg_agent b/roles/gnupg/files/gnupg_agent deleted file mode 100755 index 1de5761..0000000 --- a/roles/gnupg/files/gnupg_agent +++ /dev/null @@ -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) - diff --git a/roles/gnupg/tasks/main.yml b/roles/gnupg/tasks/main.yml index 65b2599..590ab04 100644 --- a/roles/gnupg/tasks/main.yml +++ b/roles/gnupg/tasks/main.yml @@ -16,21 +16,26 @@ - name: Configure gpg.conf (behaviour of gpg) template: src: gpg.conf.j2 - dest: ~/.gnupg/gpg.conf + dest: "(( gpg_folder ))/gpg.conf" - name: Configure gpg-agent.conf (agent configuration) template: src: gpg-agent.conf.j2 - dest: ~/.gnupg/gpg-agent.conf + dest: "(( gpg_folder }}/gpg-agent.conf" - name: Configure ssh-control (in order for gpg-agent to act as ssh-agent) template: src: sshcontrol.j2 - dest: ~/.gnupg/sshcontrol + dest: "{{ gpg_folder }}/sshcontrol" - name: Copy gnupg_agent script, which makes gpg-agent responsible for ssh-auth copy: - src: "{{ role_path }}/files/gpg_agent" - dest: ~/.gnupg/gpg_agent + src: gpg_agent.j2 + dest: "{{ gpg_folder }}/gpg_agent" mode: 0700 + + + + + diff --git a/roles/gnupg/templates/gnupg_agent.j2 b/roles/gnupg/templates/gnupg_agent.j2 index e69de29..1de5761 100644 --- a/roles/gnupg/templates/gnupg_agent.j2 +++ b/roles/gnupg/templates/gnupg_agent.j2 @@ -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) + From 988411340e7eee10195f0324d9277e79fcced68e Mon Sep 17 00:00:00 2001 From: jreichmann Date: Thu, 2 May 2019 20:03:49 +0200 Subject: [PATCH 03/11] Add redshift with autostart to the available roles --- roles/redshift/tasks/main.yml | 23 +++++++++++++++++++ .../templates/redshift-gtk.desktop.j2 | 12 ++++++++++ .../redshift/templates/redshift.conf.j2 | 0 3 files changed, 35 insertions(+) create mode 100644 roles/redshift/tasks/main.yml create mode 100644 roles/redshift/templates/redshift-gtk.desktop.j2 rename redshift/redshift.conf => roles/redshift/templates/redshift.conf.j2 (100%) diff --git a/roles/redshift/tasks/main.yml b/roles/redshift/tasks/main.yml new file mode 100644 index 0000000..d94ab9f --- /dev/null +++ b/roles/redshift/tasks/main.yml @@ -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: redshift-gtk.desktop + diff --git a/roles/redshift/templates/redshift-gtk.desktop.j2 b/roles/redshift/templates/redshift-gtk.desktop.j2 new file mode 100644 index 0000000..8d81728 --- /dev/null +++ b/roles/redshift/templates/redshift-gtk.desktop.j2 @@ -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 + diff --git a/redshift/redshift.conf b/roles/redshift/templates/redshift.conf.j2 similarity index 100% rename from redshift/redshift.conf rename to roles/redshift/templates/redshift.conf.j2 From 9a55b0e4320743a389ee678abd6abec96e8170d8 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Fri, 3 May 2019 13:32:42 +0200 Subject: [PATCH 04/11] Move files into the template folder of their role --- bash_aliases => roles/bash/templates/bash_aliases | 7 +++++++ .../bash/templates/bash_includes/moshy.sh | 0 {tmux => roles/tmux/templates}/tmux.conf | 0 {vim => roles/vim/templates}/colors/kuroi.vim | 0 {vim => roles/vim/templates}/vimrc | 0 5 files changed, 7 insertions(+) rename bash_aliases => roles/bash/templates/bash_aliases (54%) rename bash_includes/mushy.sh => roles/bash/templates/bash_includes/moshy.sh (100%) rename {tmux => roles/tmux/templates}/tmux.conf (100%) rename {vim => roles/vim/templates}/colors/kuroi.vim (100%) rename {vim => roles/vim/templates}/vimrc (100%) diff --git a/bash_aliases b/roles/bash/templates/bash_aliases similarity index 54% rename from bash_aliases rename to roles/bash/templates/bash_aliases index 88cc58a..df4fd51 100644 --- a/bash_aliases +++ b/roles/bash/templates/bash_aliases @@ -2,7 +2,14 @@ alias ll='ls -al --color=auto' alias ls='ls -l --color=auto' +alias nb=man +alias enby=man + +alias furryfox=firefox + +alias flauschctl=systemctl # GnuPG2 alias gpg=gpg2 + diff --git a/bash_includes/mushy.sh b/roles/bash/templates/bash_includes/moshy.sh similarity index 100% rename from bash_includes/mushy.sh rename to roles/bash/templates/bash_includes/moshy.sh diff --git a/tmux/tmux.conf b/roles/tmux/templates/tmux.conf similarity index 100% rename from tmux/tmux.conf rename to roles/tmux/templates/tmux.conf diff --git a/vim/colors/kuroi.vim b/roles/vim/templates/colors/kuroi.vim similarity index 100% rename from vim/colors/kuroi.vim rename to roles/vim/templates/colors/kuroi.vim diff --git a/vim/vimrc b/roles/vim/templates/vimrc similarity index 100% rename from vim/vimrc rename to roles/vim/templates/vimrc From 1f8193bd8c8d3b026fb1e7a5df5d5d3d94180e94 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Fri, 3 May 2019 14:37:51 +0200 Subject: [PATCH 05/11] Move legacy files into legacy folder, add inventory file --- inventory.yaml | 8 ++++++++ {gnupg => legacy/gnupg}/gnupg_agent | 0 {gnupg => legacy/gnupg}/gpg-agent.conf | 0 {gnupg => legacy/gnupg}/gpg.conf | 0 {gnupg => legacy/gnupg}/sshcontrol | 0 initialSetup.sh => legacy/initialSetup.sh | 0 keybindings.sh => legacy/keybindings.sh | 0 .../xfce4-keyboard-shortcuts.xml | 0 .../bash/templates/bash_includes/costumPrompt.sh | 0 9 files changed, 8 insertions(+) create mode 100644 inventory.yaml rename {gnupg => legacy/gnupg}/gnupg_agent (100%) rename {gnupg => legacy/gnupg}/gpg-agent.conf (100%) rename {gnupg => legacy/gnupg}/gpg.conf (100%) rename {gnupg => legacy/gnupg}/sshcontrol (100%) rename initialSetup.sh => legacy/initialSetup.sh (100%) rename keybindings.sh => legacy/keybindings.sh (100%) rename xfce4-keyboard-shortcuts.xml => legacy/xfce4-keyboard-shortcuts.xml (100%) rename costumPrompt.sh => roles/bash/templates/bash_includes/costumPrompt.sh (100%) diff --git a/inventory.yaml b/inventory.yaml new file mode 100644 index 0000000..e494d85 --- /dev/null +++ b/inventory.yaml @@ -0,0 +1,8 @@ +--- + +all: + hosts: + xenon: + ansible_host: xenon.int.finallycoffee.eu + vars: + ansible_user: transcaffeine diff --git a/gnupg/gnupg_agent b/legacy/gnupg/gnupg_agent similarity index 100% rename from gnupg/gnupg_agent rename to legacy/gnupg/gnupg_agent diff --git a/gnupg/gpg-agent.conf b/legacy/gnupg/gpg-agent.conf similarity index 100% rename from gnupg/gpg-agent.conf rename to legacy/gnupg/gpg-agent.conf diff --git a/gnupg/gpg.conf b/legacy/gnupg/gpg.conf similarity index 100% rename from gnupg/gpg.conf rename to legacy/gnupg/gpg.conf diff --git a/gnupg/sshcontrol b/legacy/gnupg/sshcontrol similarity index 100% rename from gnupg/sshcontrol rename to legacy/gnupg/sshcontrol diff --git a/initialSetup.sh b/legacy/initialSetup.sh similarity index 100% rename from initialSetup.sh rename to legacy/initialSetup.sh diff --git a/keybindings.sh b/legacy/keybindings.sh similarity index 100% rename from keybindings.sh rename to legacy/keybindings.sh diff --git a/xfce4-keyboard-shortcuts.xml b/legacy/xfce4-keyboard-shortcuts.xml similarity index 100% rename from xfce4-keyboard-shortcuts.xml rename to legacy/xfce4-keyboard-shortcuts.xml diff --git a/costumPrompt.sh b/roles/bash/templates/bash_includes/costumPrompt.sh similarity index 100% rename from costumPrompt.sh rename to roles/bash/templates/bash_includes/costumPrompt.sh From 08e94d0bd52e2aed28ead9addabc9e5824de79fb Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sat, 4 May 2019 21:25:43 +0200 Subject: [PATCH 06/11] Add inventory and play for gnupg role --- gnupg.yml | 8 ++++++++ inventory.yaml | 6 ++++++ 2 files changed, 14 insertions(+) create mode 100644 gnupg.yml diff --git a/gnupg.yml b/gnupg.yml new file mode 100644 index 0000000..cd2ae7a --- /dev/null +++ b/gnupg.yml @@ -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 diff --git a/inventory.yaml b/inventory.yaml index e494d85..f7ff8e9 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -4,5 +4,11 @@ all: hosts: xenon: ansible_host: xenon.int.finallycoffee.eu + ansible_connection: local vars: ansible_user: transcaffeine + +gnupg: + hosts: + xenon: + From 48ef2075fa5e72537b9e33c77195532d5a0057a5 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sun, 5 May 2019 18:22:49 +0200 Subject: [PATCH 07/11] Add redshift play, add redshift group to inventory --- inventory.yaml | 4 ++++ redshift.yml | 7 +++++++ roles/redshift/tasks/main.yml | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 redshift.yml diff --git a/inventory.yaml b/inventory.yaml index f7ff8e9..f4495e9 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -12,3 +12,7 @@ gnupg: hosts: xenon: +redshift: + hosts: + xenon: + diff --git a/redshift.yml b/redshift.yml new file mode 100644 index 0000000..21ef9f3 --- /dev/null +++ b/redshift.yml @@ -0,0 +1,7 @@ +--- + +- name: Sets up redshift and creates an autostart file + hosts: redshift + become: true + roles: + - redshift diff --git a/roles/redshift/tasks/main.yml b/roles/redshift/tasks/main.yml index d94ab9f..3e85bfa 100644 --- a/roles/redshift/tasks/main.yml +++ b/roles/redshift/tasks/main.yml @@ -5,7 +5,6 @@ name: redshift state: present - - name: Ensure .config folder for redshift exists file: path: ~/.config/redshift @@ -19,5 +18,5 @@ - name: Template redshift autostart file template: src: redshift-gtk.desktop.j2 - dest: redshift-gtk.desktop + dest: ~/.config/autotstart/redshift-gtk.desktop From 5d7a7c270994fda73343f102c3ebcdff2becee2a Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sun, 5 May 2019 19:07:14 +0200 Subject: [PATCH 08/11] GPG: Fix parantheses --- roles/gnupg/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/gnupg/tasks/main.yml b/roles/gnupg/tasks/main.yml index 590ab04..1bcd849 100644 --- a/roles/gnupg/tasks/main.yml +++ b/roles/gnupg/tasks/main.yml @@ -16,12 +16,12 @@ - name: Configure gpg.conf (behaviour of gpg) template: src: gpg.conf.j2 - dest: "(( gpg_folder ))/gpg.conf" + dest: "{{ gpg_folder }}/gpg.conf" - name: Configure gpg-agent.conf (agent configuration) template: src: gpg-agent.conf.j2 - dest: "(( gpg_folder }}/gpg-agent.conf" + dest: "{{ gpg_folder }}/gpg-agent.conf" - name: Configure ssh-control (in order for gpg-agent to act as ssh-agent) template: From 00defb27a4d0fd76457c84abdb6f2b4d5b213da9 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sat, 18 May 2019 20:07:11 +0200 Subject: [PATCH 09/11] Redshift: Fix config generation --- roles/redshift/tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/redshift/tasks/main.yml b/roles/redshift/tasks/main.yml index 3e85bfa..04d6944 100644 --- a/roles/redshift/tasks/main.yml +++ b/roles/redshift/tasks/main.yml @@ -5,6 +5,7 @@ name: redshift state: present + - name: Ensure .config folder for redshift exists file: path: ~/.config/redshift @@ -18,5 +19,5 @@ - name: Template redshift autostart file template: src: redshift-gtk.desktop.j2 - dest: ~/.config/autotstart/redshift-gtk.desktop + dest: ~/.config/autostart/redshift-gtk.desktop From 51339f42b028ef907d5f4691d824b02953bb7b95 Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sat, 18 May 2019 20:08:06 +0200 Subject: [PATCH 10/11] Inventory: Make ansible run as my user on the local machine --- inventory.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/inventory.yaml b/inventory.yaml index f4495e9..5b46f5c 100644 --- a/inventory.yaml +++ b/inventory.yaml @@ -7,6 +7,8 @@ all: ansible_connection: local vars: ansible_user: transcaffeine + ansible_become_user: transcaffeine + ansible_become: true gnupg: hosts: From 4c2564cd2128230b7bb430bc12b2fde9977c3dae Mon Sep 17 00:00:00 2001 From: jreichmann Date: Sat, 18 May 2019 21:14:04 +0200 Subject: [PATCH 11/11] GPG: Complete autogeneration of all configs --- roles/gnupg/tasks/main.yml | 6 +++--- roles/gnupg/templates/sshcontrol.j2 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/gnupg/tasks/main.yml b/roles/gnupg/tasks/main.yml index 1bcd849..79ae2b6 100644 --- a/roles/gnupg/tasks/main.yml +++ b/roles/gnupg/tasks/main.yml @@ -29,9 +29,9 @@ dest: "{{ gpg_folder }}/sshcontrol" - name: Copy gnupg_agent script, which makes gpg-agent responsible for ssh-auth - copy: - src: gpg_agent.j2 - dest: "{{ gpg_folder }}/gpg_agent" + template: + src: gnupg_agent.j2 + dest: "{{ gpg_folder }}/gnupg_agent" mode: 0700 diff --git a/roles/gnupg/templates/sshcontrol.j2 b/roles/gnupg/templates/sshcontrol.j2 index 3c6a2c2..afca206 100644 --- a/roles/gnupg/templates/sshcontrol.j2 +++ b/roles/gnupg/templates/sshcontrol.j2 @@ -10,5 +10,5 @@ # flags. Prepend the keygrip with an '!' mark to disable it. {% for keygrip in gpg_keygrips %} -{{ gpg_keygrips.keygrip }} +{{ keygrip }} {% endfor %}