From: Ismaël Bouya Date: Wed, 21 Nov 2018 00:54:14 +0000 (+0100) Subject: Add a tag to prevent gpg-related actions during the home bootstrap X-Git-Tag: v1.0~2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=39749dd76fb02744f26c68054a9955cbe3e26849;p=perso%2FImmae%2FConfig%2FAnsible.git Add a tag to prevent gpg-related actions during the home bootstrap --- diff --git a/post_init.yml b/post_init.yml new file mode 100644 index 0000000..8a5c408 --- /dev/null +++ b/post_init.yml @@ -0,0 +1,17 @@ +--- +- hosts: home + tasks: + - file: + path: "$HOME/{{ item }}" + state: absent + loop: + - .bash_profile + - .bash_history + - Bureau + - Documents + - Images + - Modèles + - Musique + - Public + - Téléchargements + - Vidéos diff --git a/roles/gnupg/tasks/main.yml b/roles/gnupg/tasks/main.yml index 954c029..84957cf 100644 --- a/roles/gnupg/tasks/main.yml +++ b/roles/gnupg/tasks/main.yml @@ -22,13 +22,14 @@ changed_when: false check_mode: no - name: check existing secret key + tags: ["no_bootstrap"] shell: "gpg --list-secret-keys | grep '{{ gpg_useremail }}'" changed_when: false ignore_errors: true register: gpgkeys check_mode: no - name: Ask for gpg password - when: gpgkeys.stdout == "" + when: gpgkeys is defined and gpgkeys.stdout == "" block: - name: Ask for gpg password pause: @@ -44,7 +45,7 @@ assert: that: gpg_password_confirm.user_input == gpg_password.user_input - name: Generate gpg key - when: gpgkeys.stdout == "" + when: gpgkeys is defined and gpgkeys.stdout == "" block: - name: Copy default template for gpg key generation template: @@ -63,7 +64,7 @@ - name: get keygrip shell: "gpg -K --with-colons {{ gpg_useremail }} | grep '^grp' | cut -d':' -f10" register: keygrip - when: gpgkeys.stdout == "" + when: gpgkeys is defined and gpgkeys.stdout == "" notify: - notify add key to immae@immae.eu - send key to immae@immae.eu diff --git a/roles/init/tasks/main.yml b/roles/init/tasks/main.yml index e60bb2a..c06a078 100644 --- a/roles/init/tasks/main.yml +++ b/roles/init/tasks/main.yml @@ -31,7 +31,7 @@ when: pam_environment.changed - name: Add new lines in bashrc_temp lineinfile: - line: "{{ ('export ' ~ item) if item != '' and item.0 != '#' else '' }}" + line: "{{ ('export ' ~ item) | regex_replace('@{HOME}', '${HOME}') if item != '' and item.0 != '#' else '' }}" dest: $XDG_STATE_HOME/bash/bashrc_temp insertafter: EOF create: true diff --git a/roles/tools/tasks/main.yml b/roles/tools/tasks/main.yml index d8ce64f..82b575b 100644 --- a/roles/tools/tasks/main.yml +++ b/roles/tools/tasks/main.yml @@ -84,6 +84,7 @@ name: monitor_home.service enabled: true - name: Clone password store + tags: ["no_bootstrap"] git: dest: "$XDG_DATA_HOME/pass" repo: gitolite@git.immae.eu:perso/Immae/Prive/Password_store diff --git a/site.yml b/site.yml index 9010737..8683b1d 100644 --- a/site.yml +++ b/site.yml @@ -23,4 +23,4 @@ - tools - cron - role: contexts/fretlink - tags: ["fretlink"] + tags: ["no_bootstrap", "fretlink"]