0
0

Gitea: updated gitea-netrc config

This commit is contained in:
Opnxng 2024-11-02 13:34:37 +08:00
parent b4bfe42577
commit 1cd5bfdc3a
2 changed files with 12 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
vars/secrets.yaml vars/secrets.yaml
files/fly.io
templates/conf/users_database.yaml.j2 templates/conf/users_database.yaml.j2
templates/conf/configuration.yaml.j2 templates/conf/configuration.yaml.j2
production production

View File

@ -1,7 +1,6 @@
--- - name: Define the location of the gnupg folder
# Define the location of the gnupg folder set_fact:
vars: gnupg_folder: "/home/{{ control_user }}/.gnupg"
gnupg_folder: "/home/{{ control_user }}/.gnupg"
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
# Store git credentials with GPG and .netrc because SSH is too complicated for Gitea on Docker # Store git credentials with GPG and .netrc because SSH is too complicated for Gitea on Docker
@ -22,7 +21,7 @@ vars:
- name: Reminder to generate GPG key by hand - name: Reminder to generate GPG key by hand
pause: pause:
prompt: "Generate GPG key using gpg --gen-key" prompt: "Generate GPG key using gpg --gen-key --homedir /home/{{ user }}/.gnupg --pinentry-mode loopback"
delegate_to: "{{ control_host }}" delegate_to: "{{ control_host }}"
- name: Set up .netrc - name: Set up .netrc
@ -67,17 +66,21 @@ vars:
become: true become: true
- name: Use git-credential-netrc - name: Use git-credential-netrc
command: git config --global credential.helper "/usr/bin/git-credential-netrc -f {{ gnupg_folder }}/.netrc.gpg -v" command: "git config --global credential.helper '/usr/bin/git-credential-netrc -f {{ gnupg_folder }}/.netrc.gpg -v'"
delegate_to: "{{ control_host }}" delegate_to: "{{ control_host }}"
- name: Ensure gpg-agent.conf file exists - name: Ensure gpg-agent.conf file exists
file: file:
path: "{{ gnupg_folder }}/gpg-agent.conf" path: "{{ gnupg_folder }}/gpg-agent.conf"
state: touch # Ensure the file exists, but do not modify its contents state: touch
mode: '0755'
owner: 1000
group: 1000
delegate_to: "{{ control_host }}"
become: true become: true
- name: Add pinentry-program to gpg-agent.conf on control host - name: Add pinentry-program to gpg-agent.conf on control host
lineinfile: lineinfile:
path: "{{ gnupg_folder }}/gpg-agent.conf" path: "{{ gnupg_folder }}/gpg-agent.conf"
line: 'pinentry-program /usr/bin/pinentry-gnome3' line: "pinentry-program /usr/bin/pinentry-tty"
delegate_to: "{{ control_host }}" delegate_to: "{{ control_host }}"