feat(netrc): init
All checks were successful
Ansible Linter / ansible-lint (push) Successful in 55s
Lint Markdown files / markdown-lint (push) Successful in 12s

This commit is contained in:
Markus Pesch 2025-06-27 20:38:59 +02:00
parent 04fa692006
commit 9a3dbcfa86
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,5 @@
---
#
# Documentation:
# https://yamllint.readthedocs.io/en/stable/

View File

@ -25,6 +25,10 @@ unix_users: {}
# - alice@alice-pc.ed25519.key
# home: /home/alice
# btrfs: false
# netrc:
# - machine_name: hostame.local
# login_name: username
# password: password
# shell: /bin/bash
# shell_rc_files:
# - file: "/home/alice/.bashrc.d/docker.bashrc" # absolute or relative path to home dir

View File

@ -195,3 +195,12 @@
- "{{ unix_user.value.shell_rc_files }}"
loop_control:
loop_var: shell_rc_file
- name: "Create .netrc file"
when: unix_user.value.netrc is defined and unix_user.value.netrc | length > 0
ansible.builtin.template:
src: netrc.j2
dest: "{{ user_user_home }}/.netrc"
owner: "{{ unix_user.key }}"
group: "{{ unix_user.value.group | default('users') }}"
mode: "0600"

7
templates/netrc.j2 Normal file
View File

@ -0,0 +1,7 @@
#jinja2: lstrip_blocks: "True", trim_blocks: "True"
#
# Ansible Managed
#
{% for netrc in nix_user.value.netrc %}
maschine {{ netrc.maschine }} login {{ netrc.login }} password {{ netrc.password }}
{% endfor %}