Use "all" directory for groups
This commit is contained in:
parent
4b8aaf3e95
commit
523b5cd49f
16 changed files with 13 additions and 13 deletions
67
tasks/personal/all/mpd.yml
Normal file
67
tasks/personal/all/mpd.yml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
- name: Copy systemd configuration files
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: '0644'
|
||||
loop:
|
||||
- src: 'templates/personal/all/mpd/service.j2'
|
||||
dest: '{{ xdg_config_dir }}/systemd/user/mpd.service'
|
||||
|
||||
- src: 'templates/personal/all/mpd/socket.j2'
|
||||
dest: '{{ xdg_config_dir }}/systemd/user/mpd.socket'
|
||||
notify:
|
||||
- stop mpd service
|
||||
- restart mpd socket
|
||||
|
||||
- name: Create mpd files
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.path }}'
|
||||
state: '{{ item.state }}'
|
||||
mode: '0755'
|
||||
loop:
|
||||
- path: '{{ mpd_configuration_dir }}'
|
||||
state: 'directory'
|
||||
- path: '{{ ncmpc_configuration_dir }}'
|
||||
state: 'directory'
|
||||
- path: '{{ ncmpcpp_configuration_dir }}'
|
||||
state: 'directory'
|
||||
- path: '{{ mpd_configuration_dir }}/playlists'
|
||||
state: 'directory'
|
||||
- path: '{{ mpd_configuration_dir }}/state'
|
||||
state: 'touch'
|
||||
|
||||
- name: Remove previous mpd files
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.path }}'
|
||||
state: '{{ item.state }}'
|
||||
mode: '0755'
|
||||
loop:
|
||||
- path: '{{ mpd_configuration_dir }}/log'
|
||||
state: 'absent'
|
||||
- path: '{{ mpd_configuration_dir }}/database'
|
||||
state: 'absent'
|
||||
- path: '{{ mpd_configuration_dir }}/sticker.sql'
|
||||
state: 'absent'
|
||||
- path: '{{ ncmpc_configuration_dir }}'
|
||||
state: 'absent'
|
||||
|
||||
- name: Copy configuration files
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: '0755'
|
||||
loop:
|
||||
- src: 'templates/personal/all/mpd/mpd.conf.j2'
|
||||
dest: '{{ mpd_configuration_dir }}/mpd.conf'
|
||||
- src: 'templates/personal/all/mpd/ncmpcpp/config.j2'
|
||||
dest: '{{ ncmpcpp_configuration_dir }}/config'
|
||||
- src: 'templates/personal/all/mpd/ncmpcpp/bindings.j2'
|
||||
dest: '{{ ncmpcpp_configuration_dir }}/bindings'
|
||||
notify:
|
||||
- stop mpd service
|
||||
|
||||
# TODO: install https://aur.archlinux.org/mpd-mpris-bin.git from AUR
|
||||
# Use mpc to control local mpd server.
|
||||
# Use $ mpc add http://{{ mpd_remote_address }}:{{ mpd_remote_stream_port }}
|
||||
# to add the HTTP stream to the playlist.
|
||||
# Use nmcpc to control remote mpd server.
|
||||
16
tasks/personal/all/mpv.yml
Normal file
16
tasks/personal/all/mpv.yml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
- name: Create configuration directory
|
||||
ansible.builtin.file:
|
||||
path: '{{ ansible_env.HOME }}/.config/mpv'
|
||||
state: directory
|
||||
mode: '0700'
|
||||
|
||||
- name: Copy configuration files
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
mode: '0644'
|
||||
loop:
|
||||
- src: 'templates/personal/all/mpv/input.j2'
|
||||
dest: '{{ ansible_env.HOME }}/.config/mpv/input.conf'
|
||||
- src: 'templates/personal/all/mpv/config.j2'
|
||||
dest: '{{ ansible_env.HOME }}/.config/mpv/mpv.conf'
|
||||
18
tasks/personal/all/syncthing.yml
Normal file
18
tasks/personal/all/syncthing.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
- name: Create configuration dir
|
||||
ansible.builtin.file:
|
||||
path: '{{ xdg_config_dir }}/syncthing'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Stop syncthing service
|
||||
ansible.builtin.systemd:
|
||||
name: syncthing
|
||||
scope: user
|
||||
state: stopped
|
||||
|
||||
- name: Copy configuration file
|
||||
ansible.builtin.template:
|
||||
src: 'templates/syncthing.j2'
|
||||
dest: '{{ xdg_config_dir }}/syncthing/config.xml'
|
||||
mode: '0640'
|
||||
notify: start syncthing
|
||||
112
tasks/personal/all/wireguard.yml
Normal file
112
tasks/personal/all/wireguard.yml
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
# Note: Only compatible with personal group
|
||||
|
||||
- name: Create Wireguard directories
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
owner: root
|
||||
group: systemd-network
|
||||
mode: '0750'
|
||||
state: directory
|
||||
recurse: true
|
||||
loop:
|
||||
- '{{ vpn_config_dir }}'
|
||||
- '{{ vpn_default.private_key_path | dirname }}'
|
||||
- '{{ vpn_default.public_key_path | dirname }}'
|
||||
- '{{ vpn_media.private_key_path | dirname }}'
|
||||
- '{{ vpn_media.public_key_path | dirname }}'
|
||||
notify:
|
||||
- restart systemd-networkd
|
||||
- restart systemd-resolved
|
||||
|
||||
- name: Copy Wireguard credentials
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
owner: root
|
||||
group: systemd-network
|
||||
mode: '0640'
|
||||
loop:
|
||||
- dest: '{{ vpn_default.public_key_path }}'
|
||||
src: 'files/personal/{{ ansible_hostname }}/wireguard/default/{{ ansible_hostname }}.pub'
|
||||
|
||||
- dest: '{{ vpn_default.private_key_path }}'
|
||||
src: 'files/personal/{{ ansible_hostname }}/wireguard/default/{{ ansible_hostname }}.key'
|
||||
|
||||
- dest: '{{ vpn_media.public_key_path }}'
|
||||
src: 'files/personal/{{ ansible_hostname }}/wireguard/media/{{ ansible_hostname }}.pub'
|
||||
|
||||
- dest: '{{ vpn_media.private_key_path }}'
|
||||
src: 'files/personal/{{ ansible_hostname }}/wireguard/media/{{ ansible_hostname }}.key'
|
||||
notify:
|
||||
- restart systemd-networkd
|
||||
- restart systemd-resolved
|
||||
|
||||
- name: Copy Wireguard preshared keys
|
||||
become: true
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.preshared_key_source_path }}'
|
||||
dest: '{{ item.preshared_key_path }}'
|
||||
owner: root
|
||||
group: systemd-network
|
||||
mode: '0640'
|
||||
loop: '{{ vpn_default.peers + vpn_media.peers }}'
|
||||
notify:
|
||||
- restart systemd-networkd
|
||||
- restart systemd-resolved
|
||||
|
||||
- name: Desktop configuration
|
||||
notify:
|
||||
- restart systemd-networkd
|
||||
- restart systemd-resolved
|
||||
when: ansible_hostname == 'desktop'
|
||||
block:
|
||||
- name: Setup network configuration
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
owner: root
|
||||
group: systemd-network
|
||||
mode: '0640'
|
||||
loop:
|
||||
- src: 'templates/personal/desktop/network/wg0.network.j2'
|
||||
dest: '/etc/systemd/network/40-wg0.network'
|
||||
|
||||
- src: 'templates/personal/desktop/network/wg0.netdev.j2'
|
||||
dest: '/etc/systemd/network/40-wg0.netdev'
|
||||
|
||||
- src: 'templates/personal/desktop/network/wg1.network.j2'
|
||||
dest: '/etc/systemd/network/40-wg1.network'
|
||||
|
||||
- src: 'templates/personal/desktop/network/wg1.netdev.j2'
|
||||
dest: '/etc/systemd/network/40-wg1.netdev'
|
||||
|
||||
- name: XPS configuration
|
||||
notify:
|
||||
- restart systemd-networkd
|
||||
- restart systemd-resolved
|
||||
- restart iwd
|
||||
when: ansible_hostname == 'xps'
|
||||
block:
|
||||
- name: Setup network configuration
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: '{{ item.src }}'
|
||||
dest: '{{ item.dest }}'
|
||||
owner: root
|
||||
group: systemd-network
|
||||
mode: '0640'
|
||||
loop:
|
||||
- src: 'templates/personal/xps/network/wg0.network.j2'
|
||||
dest: '/etc/systemd/network/40-wg0.network'
|
||||
|
||||
- src: 'templates/personal/xps/network/wg0.netdev.j2'
|
||||
dest: '/etc/systemd/network/40-wg0.netdev'
|
||||
|
||||
- src: 'templates/personal/xps/network/wg1.network.j2'
|
||||
dest: '/etc/systemd/network/40-wg1.network'
|
||||
|
||||
- src: 'templates/personal/xps/network/wg1.netdev.j2'
|
||||
dest: '/etc/systemd/network/40-wg1.netdev'
|
||||
Loading…
Add table
Add a link
Reference in a new issue