mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-23 12:38:11 +00:00
initial
This commit is contained in:
parent
1897f95464
commit
5ec4037fa3
69
roles/omv_backup/tasks/main.yml
Executable file
69
roles/omv_backup/tasks/main.yml
Executable 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
1
roles/omv_backup/vars/main.yml
Executable file
@ -0,0 +1 @@
|
||||
dest_folder: "/tmp/ans_repo"
|
12
roles/prevent_policy/tasks/main.yml
Executable file
12
roles/prevent_policy/tasks/main.yml
Executable 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 }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user