mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-11-04 01:19:32 +01:00 
			
		
		
		
	Dont symlink when using distro packages
This commit is contained in:
		
							parent
							
								
									033a5a6362
								
							
						
					
					
						commit
						4428bbf4a7
					
				@ -12,7 +12,7 @@ Main features:
 | 
			
		||||
- Provision new remote [BorgBase.com](https://www.borgbase.com) repo for storing backups (optional)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Example Playbook with root as backup user
 | 
			
		||||
## Example Playbook with root as backup user and Cron timer
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
- hosts: webservers
 | 
			
		||||
@ -20,7 +20,7 @@ Main features:
 | 
			
		||||
  - role: m3nu.ansible_role_borgbackup
 | 
			
		||||
    borg_encryption_passphrase: CHANGEME
 | 
			
		||||
    borg_repository: m5vz9gp4@m5vz9gp4.repo.borgbase.com:repo
 | 
			
		||||
    borgmatic_timer: systemd
 | 
			
		||||
    borgmatic_timer: cron
 | 
			
		||||
    borg_source_directories:
 | 
			
		||||
      - /srv/www
 | 
			
		||||
      - /var/lib/automysqlbackup
 | 
			
		||||
@ -40,7 +40,7 @@ Main features:
 | 
			
		||||
        port: 5433
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Example Playbook with service user
 | 
			
		||||
## Example Playbook with service user and Systemd timer
 | 
			
		||||
`` Attention: `` The following implementation leads to problems.
 | 
			
		||||
If you already use this role and use the user: "root" or the SSH key id_ed25519!
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,40 +0,0 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Create links to the Borgmatic and Borg binarys
 | 
			
		||||
  tags:
 | 
			
		||||
    - install_backup
 | 
			
		||||
  block:
 | 
			
		||||
    - name: Create borgmatic command in /usr/local/bin
 | 
			
		||||
      ansible.builtin.copy:
 | 
			
		||||
        content: |
 | 
			
		||||
          #!/bin/bash
 | 
			
		||||
          . "{{ borg_venv_path }}"/bin/activate
 | 
			
		||||
          borgmatic "$@"
 | 
			
		||||
        dest: /usr/local/bin/borgmatic
 | 
			
		||||
        mode: "0755"
 | 
			
		||||
        owner: "{{ borgbackup_user }}"
 | 
			
		||||
        group: "{{ borgbackup_group }}"
 | 
			
		||||
 | 
			
		||||
    - name: Create borg command in /usr/local/bin
 | 
			
		||||
      ansible.builtin.copy:
 | 
			
		||||
        content: |
 | 
			
		||||
          #!/bin/bash
 | 
			
		||||
          . "{{ borg_venv_path }}"/bin/activate
 | 
			
		||||
          borg "$@"
 | 
			
		||||
        dest: /usr/local/bin/borg
 | 
			
		||||
        mode: "0755"
 | 
			
		||||
        owner: "{{ borgbackup_user }}"
 | 
			
		||||
        group: "{{ borgbackup_group }}"
 | 
			
		||||
 | 
			
		||||
- name: Install helper scripts
 | 
			
		||||
  tags:
 | 
			
		||||
    - never
 | 
			
		||||
    - backup_install_helper
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
    owner: "{{ item.owner }}"
 | 
			
		||||
    group: "{{ item.group }}"
 | 
			
		||||
    mode: "{{ item.mode }}"
 | 
			
		||||
  with_items:
 | 
			
		||||
    - { src: "docker.sh", dest: "/usr/local/bin/docker.sh", owner: "{{ borgbackup_user }}", group: "{{ borgbackup_group }}", mode: "0770" }
 | 
			
		||||
...
 | 
			
		||||
							
								
								
									
										14
									
								
								tasks/04_helper_scripts.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								tasks/04_helper_scripts.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install helper scripts
 | 
			
		||||
  tags:
 | 
			
		||||
    - never
 | 
			
		||||
    - backup_install_helper
 | 
			
		||||
  ansible.builtin.copy:
 | 
			
		||||
    src: "{{ item.src }}"
 | 
			
		||||
    dest: "{{ item.dest }}"
 | 
			
		||||
    owner: "{{ item.owner }}"
 | 
			
		||||
    group: "{{ item.group }}"
 | 
			
		||||
    mode: "{{ item.mode }}"
 | 
			
		||||
  with_items:
 | 
			
		||||
    - { src: "docker.sh", dest: "/usr/local/bin/docker.sh", owner: "{{ borgbackup_user }}", group: "{{ borgbackup_group }}", mode: "0770" }
 | 
			
		||||
...
 | 
			
		||||
@ -35,7 +35,7 @@
 | 
			
		||||
            - borgmatic.service
 | 
			
		||||
 | 
			
		||||
        # bug: Need own section without masked else the timer are skipped
 | 
			
		||||
        - name: Set  borgmatic timers to stopped - fresh installed
 | 
			
		||||
        - name: Set borgmatic timers to stopped - fresh installed
 | 
			
		||||
          ansible.builtin.systemd:
 | 
			
		||||
            name: "{{ item }}"
 | 
			
		||||
            state: stopped
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
- name: Install borgbackup by pip
 | 
			
		||||
- name: Install Borg and Borgmatic via pip
 | 
			
		||||
  tags:
 | 
			
		||||
    - install_backup
 | 
			
		||||
  block:
 | 
			
		||||
@ -30,4 +30,32 @@
 | 
			
		||||
        virtualenv: "{{ borg_venv_path }}"
 | 
			
		||||
      when: borg_python_packages is defined
 | 
			
		||||
      loop: "{{ borg_python_packages }}"
 | 
			
		||||
 | 
			
		||||
- name: Create links to Borgmatic and Borg binarys
 | 
			
		||||
  tags:
 | 
			
		||||
    - install_backup
 | 
			
		||||
  block:
 | 
			
		||||
    - name: Create borgmatic command in /usr/local/bin
 | 
			
		||||
      ansible.builtin.copy:
 | 
			
		||||
        content: |
 | 
			
		||||
          #!/bin/bash
 | 
			
		||||
          . "{{ borg_venv_path }}"/bin/activate
 | 
			
		||||
          borgmatic "$@"
 | 
			
		||||
        dest: /usr/local/bin/borgmatic
 | 
			
		||||
        mode: "0755"
 | 
			
		||||
        owner: "{{ borgbackup_user }}"
 | 
			
		||||
        group: "{{ borgbackup_group }}"
 | 
			
		||||
 | 
			
		||||
    - name: Create borg command in /usr/local/bin
 | 
			
		||||
      ansible.builtin.copy:
 | 
			
		||||
        content: |
 | 
			
		||||
          #!/bin/bash
 | 
			
		||||
          . "{{ borg_venv_path }}"/bin/activate
 | 
			
		||||
          borg "$@"
 | 
			
		||||
        dest: /usr/local/bin/borg
 | 
			
		||||
        mode: "0755"
 | 
			
		||||
        owner: "{{ borgbackup_user }}"
 | 
			
		||||
        group: "{{ borgbackup_group }}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
...
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user