Compare commits

..

3 Commits

Author SHA1 Message Date
jaydee
5ec4037fa3 initial 2024-12-12 22:08:32 +01:00
jaydee
1897f95464 initial 2024-12-12 20:25:44 +01:00
jaydee
55341537cf initial 2024-12-12 18:56:23 +01:00
5 changed files with 95 additions and 7 deletions

View File

@ -1,9 +1,15 @@
--- ---
- hosts: desktop - hosts: desktop
roles: roles:
- common - role: common
- wake_on_lan tags: common
- timeshift - role: wake_on_lan
- zabbix-agent tags: wake_on_lan
- autofs_client - role: timeshift
- ldap_client tags: timeshift
- role: zabbix-agent
tags: zabbix-agent
- role: autofs_client
tags: autofs_client
- role: ldap_client
tags: ldap_client

69
roles/omv_backup/tasks/main.yml Executable file
View File

@ -0,0 +1,69 @@
- block:
- name: include vault
ansible.builtin.include_vars:
file: jaydee.yml
- name: Delete content & directory
ansible.builtin.file:
state: absent
path: "{{ dest_folder }}"
- name: GIT pull
tags:
- git_pull
git:
repo: "https://{{ git_user | urlencode }}:{{ git_password_mqtt | urlencode }}@gitlab.sectorq.eu/jaydee/omv_backup.git"
dest: "{{ dest_folder }}"
update: yes
clone: yes
version: main
- debug:
msg: "{{ inventory_hostname }}"
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /myapps
state: directory
mode: '0755'
owner: root
group: root
- name: Upload script
ansible.builtin.copy:
src: "{{ dest_folder }}/omv_backup.py"
dest: /myapps/omv_backup.py
remote_src: true
mode: '0755'
owner: root
group: root
when: inventory_hostname != 'nas.home.lan'
- name: Upload requirements
ansible.builtin.copy:
src: "{{ dest_folder }}/requirements.txt"
dest: /myapps/requirements.txt
remote_src: true
when: inventory_hostname != 'nas.home.lan'
- name: Install venv
ansible.builtin.apt:
name:
- python3-virtualenv
- name: Install specified python requirements in indicated (virtualenv)
ansible.builtin.pip:
requirements: /myapps/requirements.txt
virtualenv: /myapps/venv
- name: 'Ensure an old job is no longer present. Removes any job that is prefixed by "#Ansible: an old job" from the crontab'
ansible.builtin.cron:
name: "omv_backup"
state: absent
- name: Ensure a job that runs at 2 and 5 exists. Creates an entry like "0 5,2 * * ls -alh > /dev/null"
ansible.builtin.cron:
name: "omv_backup"
minute: "0"
hour: "8"
job: "/myapps/venv/bin/python3 /myapps/omv_backup.py -b > /dev/null 2>&1 &"
become: true

1
roles/omv_backup/vars/main.yml Executable file
View File

@ -0,0 +1 @@
dest_folder: "/tmp/ans_repo"

View File

@ -0,0 +1,12 @@
- block:
- name: Creating a file with content
copy:
dest: "/etc/polkit-1/rules.d/50_disable_pol.rules"
content: |
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.NetworkManager.wifi.scan") {
return polkit.Result.YES;
}
});
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"

View File

@ -1,4 +1,4 @@
--- ---
- hosts: datacenter - hosts: datacenter
roles: roles:
- vnc_server - omv_backup