run as user fixes

This commit is contained in:
Morten Olsen
2024-10-09 12:27:02 +02:00
parent 034994e398
commit f62c1d7d25
16 changed files with 38 additions and 55 deletions

View File

@@ -1,6 +1,14 @@
- name: Ensure dir
tags:
- config
ansible.builtin.file:
path: "{{ context.path }}"
state: directory
owner: "{{ username }}"
mode: "700"
- name: Setup context env - name: Setup context env
tags: tags:
- git
- config - config
ansible.builtin.template: ansible.builtin.template:
src: "../templates/envrc.context.j2" src: "../templates/envrc.context.j2"

View File

@@ -0,0 +1 @@
install_with_root: true

View File

@@ -1,33 +0,0 @@
---
- name: "Unload vars : {{ context }}"
ansible.builtin.include_vars: ../vars/empty.yml
tags:
- install
- name: "Load vars : {{ context }}"
ansible.builtin.include_vars: "{{ item }}"
tags:
- install
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- default.yml
paths: ../vars/{{ context }}
skip: true
- name: "Install dependencies : {{ context }}"
tags:
- install
when: desktop_pkgs
ansible.builtin.package:
name: "{{ dev_pkgs }}"
- name: "Install casks : {{ context }}"
tags:
- install
when: dev_casks
community.general.homebrew_cask:
name: "{{ dev_casks }}"
state: installed

View File

@@ -15,6 +15,7 @@
- name: "Install dependencies" - name: "Install dependencies"
tags: tags:
- install - install
become: "{{ install_with_root }}"
when: env_develop_pkgs when: env_develop_pkgs
ansible.builtin.package: ansible.builtin.package:
name: "{{ env_develop_pkgs }}" name: "{{ env_develop_pkgs }}"

View File

@@ -0,0 +1 @@
install_with_root: true

View File

@@ -13,6 +13,7 @@
skip: true skip: true
- name: "Install dependencies" - name: "Install dependencies"
become: "{{ install_with_root }}"
tags: tags:
- install - install
when: terminal_pkgs when: terminal_pkgs

View File

@@ -11,7 +11,12 @@
format = ssh format = ssh
[gpg "ssh"] [gpg "ssh"]
{% if mac_os %}
program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
{% else %}
program = "/opt/1Password/op-ssh-sign"
{% endif %}
{% endif %} {% endif %}
{% if 'replacements' in git %} {% if 'replacements' in git %}

View File

@@ -0,0 +1 @@
install_with_root: true

View File

@@ -2,6 +2,7 @@
- name: Install dependencies - name: Install dependencies
tags: tags:
- install - install
become: "{{ install_with_root }}"
ansible.builtin.package: ansible.builtin.package:
name: name:
- neovim - neovim

View File

@@ -0,0 +1 @@
install_with_root: true

View File

@@ -1,5 +1,6 @@
--- ---
- name: Install dependencies - name: Install dependencies
become: "{{ install_with_root }}"
ansible.builtin.package: ansible.builtin.package:
name: name:
- git - git

View File

@@ -1,29 +1,18 @@
- name: Copy config ---
- name: Ensure dir
tags: tags:
- git
- config - config
ansible.builtin.file: ansible.builtin.file:
mode: "{{ item.mode }}" path: "{{ home }}/.ssh"
path: "{{ home }}/{{ item.path }}" mode: "0700"
owner: "{{ username }}" owner: "{{ username }}"
state: directory state: directory
with_community.general.filetree:
- ../files
loop_control:
label: "{{ item.path }}"
when: item.state == 'directory'
- name: "Copy configs" - name: Setup config
tags: tags:
- git
- config - config
ansible.builtin.copy: ansible.builtin.template:
src: "{{ item.src }}" src: "../templates/config.j2"
dest: "{{ home }}/{{ item.path }}" dest: "{{ home }}/.ssh/config"
mode: "{{ item.mode }}"
owner: "{{ username }}" owner: "{{ username }}"
with_community.general.filetree: mode: "644"
- ../files
loop_control:
label: "{{ item.path }}"
when: item.state == 'file'

View File

@@ -5,6 +5,10 @@ Include ~/.ssh/config.d/*
Host * Host *
Controlmaster auto Controlmaster auto
Controlpath /tmp/ssh-%r@%h:%p Controlpath /tmp/ssh-%r@%h:%p
{% if mac_os %}
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
{% else %}
IdentityAgent ~/.1password/agent.sock
{% endif %}
ForwardAgent yes ForwardAgent yes

View File

@@ -1,5 +1,5 @@
set -g mouse on set -g mouse on
set -g default-terminal "screen-256color-bce" #set -g default-terminal "screen-256color-bce"
#set -g status-justify centre #set -g status-justify centre
#set -ga terminal-overrides ',xterm-256color:Tc' #set -ga terminal-overrides ',xterm-256color:Tc'

View File

@@ -0,0 +1 @@
install_with_root: true

View File

@@ -2,6 +2,7 @@
- name: Install core dependencies - name: Install core dependencies
tags: tags:
- install - install
become: "{{ install_with_root }}"
ansible.builtin.package: ansible.builtin.package:
name: name:
- zsh - zsh