Compare commits
5 Commits
2afbfaedcd
...
main
Author | SHA1 | Date | |
---|---|---|---|
5c3ed1736e | |||
023227fff7 | |||
03b371650c | |||
33e3ebea6f | |||
b21d28587f |
@@ -38,24 +38,28 @@
|
|||||||
repo: '{{ genvm_os_auto_upgrades_git_repo }}'
|
repo: '{{ genvm_os_auto_upgrades_git_repo }}'
|
||||||
dest: '{{ genvm_os_auto_upgrades_git_clone_dir }}'
|
dest: '{{ genvm_os_auto_upgrades_git_clone_dir }}'
|
||||||
version: '{{ genvm_os_auto_upgrades_git_branch }}'
|
version: '{{ genvm_os_auto_upgrades_git_branch }}'
|
||||||
|
|
||||||
|
- name: 'If Arch Linux copy systemd unit files for OS auto-upgrades to ''/etc/systemd/system'''
|
||||||
|
when: 'ansible_facts[''os_family''] | lower == ''archlinux'''
|
||||||
|
loop_control:
|
||||||
|
loop_var: 'genvm_os_auto_upgrades_unit'
|
||||||
|
label: 'Copy ''{{ genvm_os_auto_upgrades_unit.source | basename }}'' to ''/etc/systemd/system'''
|
||||||
|
loop:
|
||||||
|
- { source: '{{ genvm_os_auto_upgrades_git_clone_dir }}/arch-linux-update-and-restart.service', target: '/etc/systemd/system/arch-linux-update-and-restart.service' }
|
||||||
|
- { source: '{{ genvm_os_auto_upgrades_git_clone_dir }}/arch-linux-update-and-restart.timer', target: '/etc/systemd/system/arch-linux-update-and-restart.timer' }
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: '{{ genvm_os_auto_upgrades_unit.source }}'
|
||||||
|
dest: '{{ genvm_os_auto_upgrades_unit.target }}'
|
||||||
|
remote_src: true
|
||||||
notify:
|
notify:
|
||||||
- 'Reload systemd unit configs'
|
- 'Reload systemd unit configs'
|
||||||
|
|
||||||
- name: 'If Arch Linux create symlinks to repo for OS auto-upgrades'
|
# Chances are we've just updated systemd unit files in '/etc/systemd/system'. In
|
||||||
when: 'ansible_facts[''os_family''] | lower == ''archlinux'''
|
# a second we'll be enabling a timer unit that was among those files we just
|
||||||
loop_control:
|
# (potentially) changed. We should flush our handlers now, i.e. 'systemctl
|
||||||
loop_var: 'genvm_os_auto_upgrades_symlink'
|
# daemon-reload' to make sure systemd knows the newest state of our units.
|
||||||
label: 'Create symlink to ''{{ genvm_os_auto_upgrades_symlink.target | basename }}'''
|
- name: 'Flush handlers'
|
||||||
loop:
|
meta: flush_handlers
|
||||||
- { target: '{{ genvm_os_auto_upgrades_git_clone_dir }}/arch-linux-update-and-restart.service', symlink: '/etc/systemd/system/arch-linux-update-and-restart.service' }
|
|
||||||
- { target: '{{ genvm_os_auto_upgrades_git_clone_dir }}/arch-linux-update-and-restart.timer', symlink: '/etc/systemd/system/arch-linux-update-and-restart.timer' }
|
|
||||||
ansible.builtin.file:
|
|
||||||
src: '{{ genvm_os_auto_upgrades_symlink.target }}'
|
|
||||||
dest: '{{ genvm_os_auto_upgrades_symlink.symlink }}'
|
|
||||||
state: 'link'
|
|
||||||
force: true
|
|
||||||
notify:
|
|
||||||
- 'Reload systemd unit configs'
|
|
||||||
|
|
||||||
- name: 'If Arch Linux enable systemd timer for OS auto-upgrades'
|
- name: 'If Arch Linux enable systemd timer for OS auto-upgrades'
|
||||||
ansible.builtin.systemd_service:
|
ansible.builtin.systemd_service:
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
zfs list zpool/data/var/cache/pacman/pkg
|
zfs list zpool/root/archlinux/var/cache/pacman/pkg
|
||||||
|
|
||||||
- name: 'If no pacman cache dataset exists create dataset'
|
- name: 'If no pacman cache dataset exists create dataset'
|
||||||
when: 'genvm_archlinux_zfs_pacman_cache_zfs_has_pacman_cache_dataset.rc > 0'
|
when: 'genvm_archlinux_zfs_pacman_cache_zfs_has_pacman_cache_dataset.rc > 0'
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
changed_when: 'genvm_archlinux_zfs_pacman_cache_pacman_cache_dir_was_temp_moved.rc == 0'
|
changed_when: 'genvm_archlinux_zfs_pacman_cache_pacman_cache_dir_was_temp_moved.rc == 0'
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
mv '/var/cache/pacman/pkg'{,'.bak'} && \
|
mv '/var/cache/pacman/pkg'{,'.bak'} && \
|
||||||
if ! zfs list zpool/data/var &>/dev/null; then zfs create -o canmount=off zpool/data/var; fi && \
|
if ! zfs list zpool/root/archlinux/var &>/dev/null; then zfs create -o canmount=off zpool/root/archlinux/var; fi && \
|
||||||
if ! zfs list zpool/data/var/cache &>/dev/null; then zfs create -o canmount=off zpool/data/var/cache; fi && \
|
if ! zfs list zpool/root/archlinux/var/cache &>/dev/null; then zfs create -o canmount=off zpool/root/archlinux/var/cache; fi && \
|
||||||
if ! zfs list zpool/data/var/cache/pacman &>/dev/null; then zfs create -o canmount=off zpool/data/var/cache/pacman; fi && \
|
if ! zfs list zpool/root/archlinux/var/cache/pacman &>/dev/null; then zfs create -o canmount=off zpool/root/archlinux/var/cache/pacman; fi && \
|
||||||
zfs create zpool/data/var/cache/pacman/pkg && \
|
zfs create zpool/root/archlinux/var/cache/pacman/pkg && \
|
||||||
rsync -a --remove-source-files '/var/cache/pacman/pkg'{'.bak',}'/' && \
|
rsync -a --remove-source-files '/var/cache/pacman/pkg'{'.bak',}'/' && \
|
||||||
find '/var/cache/pacman/pkg.bak' -type d -empty -delete
|
find '/var/cache/pacman/pkg.bak' -type d -empty -delete
|
||||||
|
Reference in New Issue
Block a user