Moved playbooks here; zsh dotfiles distro; new config logs
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Upgrade Arch systems
|
||||
hosts: firewall
|
||||
roles:
|
||||
- arch_update
|
||||
- dotfiles
|
||||
|
||||
- name: Process any reboots
|
||||
hosts: "firewall, !control"
|
||||
roles:
|
||||
- reboot
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
- name: Upgrade Arch systems
|
||||
hosts: arch
|
||||
#strategy: free
|
||||
roles:
|
||||
- arch_update
|
||||
- dotfiles
|
||||
|
||||
- name: Upgrade Debian systems
|
||||
hosts: debian
|
||||
roles:
|
||||
- debian_update
|
||||
- dotfiles
|
||||
|
||||
- name: Update Docker Stacks
|
||||
hosts: docker
|
||||
roles:
|
||||
- docker_update
|
||||
|
||||
- name: Update mailcow Stacks
|
||||
hosts: mailcow
|
||||
roles:
|
||||
- mailcow_update
|
||||
|
||||
- name: Process any reboots
|
||||
hosts: "arch, debian, !control"
|
||||
roles:
|
||||
- reboot
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Deploy node_exporter
|
||||
hosts: arch,debian,barbican
|
||||
roles:
|
||||
- node_exporter
|
||||
@@ -63,6 +63,7 @@ def extract_ver(content):
|
||||
def strip_volatile_fields(content):
|
||||
content = re.sub(r'^pkgver=.*$', '', content, flags=re.MULTILINE)
|
||||
content = re.sub(r'^pkgrel=.*$', '', content, flags=re.MULTILINE)
|
||||
content = re.sub(r'^arch=\(.*?\)', '', content, flags=re.MULTILINE | re.DOTALL)
|
||||
|
||||
source_vars = set()
|
||||
source_matches = re.finditer(r'^source(?:_[a-zA-Z0-9_]+)?=\((.*?)\)', content, flags=re.MULTILINE | re.DOTALL)
|
||||
|
||||
@@ -5,8 +5,33 @@
|
||||
recurse: yes
|
||||
register: pacnew_files
|
||||
|
||||
- name: Ensure pacnew.logs directory exists locally
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/pacnew.logs"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
become: no
|
||||
|
||||
- name: Save .pacnew list to file
|
||||
ansible.builtin.copy:
|
||||
content: "{{ pacnew_files.files | map(attribute='path') | join('\n') }}\n"
|
||||
dest: "{{ playbook_dir }}/pacnew.logs/{{ inventory_hostname }}.pacnew"
|
||||
mode: '0644'
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
when: pacnew_files.matched > 0
|
||||
|
||||
- name: Clean up old .pacnew list file if no .pacnew files exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/pacnew.logs/{{ inventory_hostname }}.pacnew"
|
||||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
when: pacnew_files.matched == 0
|
||||
|
||||
- name: Alert if .pacnew files exist
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning: The following .pacnew files require merging: {{ pacnew_files.files | map(attribute='path') | list }}"
|
||||
when: pacnew_files.matched > 0
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
---
|
||||
- name: Check for pending dpkg/ucf config files
|
||||
ansible.builtin.find:
|
||||
paths: /etc
|
||||
patterns:
|
||||
- "*.dpkg-dist"
|
||||
- "*.dpkg-new"
|
||||
- "*.ucf-dist"
|
||||
- "*.ucf-new"
|
||||
recurse: yes
|
||||
register: debnew_files
|
||||
|
||||
- name: Ensure debnew.logs directory exists locally
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/debnew.logs"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
delegate_to: localhost
|
||||
run_once: true
|
||||
become: no
|
||||
|
||||
- name: Save debnew config list to file
|
||||
ansible.builtin.copy:
|
||||
content: "{{ debnew_files.files | map(attribute='path') | join('\n') }}\n"
|
||||
dest: "{{ playbook_dir }}/debnew.logs/{{ inventory_hostname }}.debnew"
|
||||
mode: '0644'
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
when: debnew_files.matched > 0
|
||||
|
||||
- name: Clean up old debnew config list file if none exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ playbook_dir }}/debnew.logs/{{ inventory_hostname }}.debnew"
|
||||
state: absent
|
||||
delegate_to: localhost
|
||||
become: no
|
||||
when: debnew_files.matched == 0
|
||||
|
||||
- name: Alert if debnew config files exist
|
||||
ansible.builtin.debug:
|
||||
msg: "Warning: The following Debian config files require merging: {{ debnew_files.files | map(attribute='path') | list }}"
|
||||
when: debnew_files.matched > 0
|
||||
@@ -4,3 +4,6 @@
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
upgrade: full
|
||||
|
||||
- name: Report on any Debian config files that need to be merged
|
||||
ansible.builtin.include_tasks: debnew.yaml
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- name: Pull latest non-buildable service images
|
||||
become: true
|
||||
ansible.builtin.command:
|
||||
cmd: docker compose pull --ignore-buildable
|
||||
cmd: docker compose pull --ignore-buildable --ignore-pull-failures
|
||||
chdir: "{{ item }}"
|
||||
loop: "{{ docker_compose_dirs | default([]) }}"
|
||||
changed_when: false
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Gruvbox colors for zsh (fallback)
|
||||
export MATUGEN_PRIMARY="#83a598"
|
||||
export MATUGEN_ON_PRIMARY="#282828"
|
||||
export MATUGEN_SECONDARY="#8ec07c"
|
||||
export MATUGEN_ON_SECONDARY="#282828"
|
||||
export MATUGEN_TERTIARY="#d3869b"
|
||||
export MATUGEN_ON_TERTIARY="#282828"
|
||||
export MATUGEN_BACKGROUND="#282828"
|
||||
export MATUGEN_FOREGROUND="#ebdbb2"
|
||||
export MATUGEN_ERROR="#fb4934"
|
||||
export MATUGEN_OUTLINE="#928374"
|
||||
export MATUGEN_SURFACE_CONTAINER="#3c3836"
|
||||
@@ -0,0 +1,20 @@
|
||||
# Tmux colors generated by Matugen (Gruvbox fallback)
|
||||
|
||||
set -g status-justify "left"
|
||||
set -g status "on"
|
||||
set -g status-left-style "none"
|
||||
set -g message-command-style "fg=#282828,bg=#83a598"
|
||||
set -g status-right-style "none"
|
||||
set -g pane-active-border-style "fg=#83a598"
|
||||
set -g status-style "none,bg=#3c3836"
|
||||
set -g message-style "fg=#282828,bg=#83a598"
|
||||
set -g pane-border-style "fg=#504945"
|
||||
set -g status-right-length "100"
|
||||
set -g status-left-length "100"
|
||||
setw -g window-status-activity-style "none"
|
||||
setw -g window-status-separator ""
|
||||
setw -g window-status-style "none,fg=#ebdbb2,bg=#3c3836"
|
||||
set -g status-left "#[fg=#282828,bg=#83a598] #S #[fg=#83a598,bg=#3c3836,nobold,nounderscore,noitalics]"
|
||||
set -g status-right "#[fg=#504945,bg=#3c3836,nobold,nounderscore,noitalics]#[fg=#ebdbb2,bg=#504945] %Y-%m-%d %H:%M #[fg=#83a598,bg=#504945,nobold,nounderscore,noitalics]#[fg=#282828,bg=#83a598] #h "
|
||||
setw -g window-status-format "#[fg=#ebdbb2,bg=#3c3836] #I #[fg=#ebdbb2,bg=#3c3836] #W "
|
||||
setw -g window-status-current-format "#[fg=#3c3836,bg=#504945,nobold,nounderscore,noitalics]#[fg=#ebdbb2,bg=#504945] #I #[fg=#ebdbb2,bg=#504945] #W #[fg=#504945,bg=#3c3836,nobold,nounderscore,noitalics]"
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
- name: "Ensure target config directories exist for {{ target_user.user }}"
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: "{{ target_user.user }}"
|
||||
loop:
|
||||
- "{{ target_user.home }}/.config/tmux"
|
||||
- "{{ target_user.home }}/.config/zsh"
|
||||
- "{{ target_user.home }}/.vim"
|
||||
become: yes
|
||||
|
||||
- name: "Sync tmux config directory for {{ target_user.user }}"
|
||||
ansible.posix.synchronize:
|
||||
src: /home/trey/.config/tmux/
|
||||
dest: "{{ target_user.home }}/.config/tmux/"
|
||||
archive: yes
|
||||
delete: no
|
||||
rsync_opts:
|
||||
- "--exclude=matugen.conf"
|
||||
become: yes
|
||||
become_user: "{{ target_user.user }}"
|
||||
|
||||
- name: "Sync zsh config directory for {{ target_user.user }}"
|
||||
ansible.posix.synchronize:
|
||||
src: /home/trey/.config/zsh/
|
||||
dest: "{{ target_user.home }}/.config/zsh/"
|
||||
archive: yes
|
||||
delete: no
|
||||
rsync_opts:
|
||||
- "--exclude=colors.zsh"
|
||||
become: yes
|
||||
become_user: "{{ target_user.user }}"
|
||||
|
||||
- name: "Sync vim directory for {{ target_user.user }}"
|
||||
ansible.posix.synchronize:
|
||||
src: /home/trey/.vim/
|
||||
dest: "{{ target_user.home }}/.vim/"
|
||||
archive: yes
|
||||
delete: no
|
||||
rsync_opts:
|
||||
- "--exclude=.git/"
|
||||
- "--exclude=.netrwhist"
|
||||
- "--exclude=swap/"
|
||||
- "--exclude=vimrc"
|
||||
become: yes
|
||||
become_user: "{{ target_user.user }}"
|
||||
|
||||
- name: "Deploy static fallback gruvbox colors for zsh for {{ target_user.user }}"
|
||||
ansible.builtin.copy:
|
||||
src: colors.zsh
|
||||
dest: "{{ target_user.home }}/.config/zsh/colors.zsh"
|
||||
mode: '0644'
|
||||
owner: "{{ target_user.user }}"
|
||||
become: yes
|
||||
|
||||
- name: "Deploy static fallback gruvbox colors for tmux for {{ target_user.user }}"
|
||||
ansible.builtin.copy:
|
||||
src: matugen.conf
|
||||
dest: "{{ target_user.home }}/.config/tmux/matugen.conf"
|
||||
mode: '0644'
|
||||
owner: "{{ target_user.user }}"
|
||||
become: yes
|
||||
|
||||
- name: "Copy .zshrc and modify prompt for root user"
|
||||
ansible.builtin.copy:
|
||||
content: |
|
||||
{% set zshrc_content = lookup('file', '/home/trey/.zshrc') %}
|
||||
{% if target_user.user == 'root' %}
|
||||
{{ zshrc_content | replace("export PS1='%F{$MATUGEN_PRIMARY}%n%F{$MATUGEN_SECONDARY}@%F{$MATUGEN_TERTIARY}%m%f", "export PS1='%F{red}%m%f") }}
|
||||
{% else %}
|
||||
{{ zshrc_content }}
|
||||
{% endif %}
|
||||
dest: "{{ target_user.home }}/.zshrc"
|
||||
mode: '0644'
|
||||
owner: "{{ target_user.user }}"
|
||||
become: yes
|
||||
|
||||
- name: "Copy vimrc without matugen for {{ target_user.user }}"
|
||||
ansible.builtin.copy:
|
||||
content: "{{ lookup('file', '/home/trey/.vim/vimrc') | regex_replace('(?m)^colorscheme matugen', 'colorscheme gruvbox') }}"
|
||||
dest: "{{ target_user.home }}/.vim/vimrc"
|
||||
mode: '0644'
|
||||
owner: "{{ target_user.user }}"
|
||||
become: yes
|
||||
|
||||
- name: "Ensure .vimrc symlink exists for {{ target_user.user }}"
|
||||
ansible.builtin.file:
|
||||
src: "{{ target_user.home }}/.vim/vimrc"
|
||||
dest: "{{ target_user.home }}/.vimrc"
|
||||
state: link
|
||||
owner: "{{ target_user.user }}"
|
||||
become: yes
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
- name: Deploy dotfiles for users
|
||||
ansible.builtin.include_tasks: deploy_user.yml
|
||||
loop:
|
||||
- user: "{{ 'admin' if inventory_hostname == 'bastion' else 'trey' }}"
|
||||
home: "{{ '/home/admin' if inventory_hostname == 'bastion' else '/home/trey' }}"
|
||||
- user: 'root'
|
||||
home: '/root'
|
||||
loop_control:
|
||||
loop_var: target_user
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Deploy smartctl_exporter
|
||||
hosts: smartd
|
||||
roles:
|
||||
- smartctl_exporter
|
||||
Reference in New Issue
Block a user