mirror of
				https://github.com/borgbase/ansible-role-borgbackup.git
				synced 2025-10-25 11:24:41 +02:00 
			
		
		
		
	Removed: borgmatic_initialization_repo
This commit is contained in:
		
							parent
							
								
									64674c93ad
								
							
						
					
					
						commit
						6376bbf2fb
					
				| @ -1,7 +1,5 @@ | ||||
| --- | ||||
| # In this Play an ssh key pair is created for login to the backup server and secure data transfer. | ||||
| # If you select: "borgmatic_initialization_repo: true", | ||||
| # the key will automaticly be added to the authorized_keys on the target system. | ||||
| # We do not want the possibly existing key to be used/distributed,  | ||||
| # so a backup-specific (backup/backup.pub) one is created. | ||||
| - name: Create ssh-key (if neeeded) for {{ borgbackup_user }}  | ||||
| @ -36,23 +34,7 @@ | ||||
|         src: "{{ backup_user_info.home }}/.ssh/backup.pub" | ||||
|       register: backup_local_ssh_key | ||||
| 
 | ||||
|     - name: Set authorized key taken from file | ||||
|       when: | ||||
|         - borgmatic_initialization_repo is defined and borgmatic_initialization_repo | ||||
|       ansible.posix.authorized_key: | ||||
|         # example: | ||||
|         #   borg_repository: m5vz9gp4@m5vz9gp4.repo.borgbase.com:repo | ||||
|         #   have three parts: "username"@"FQDN":"path/to/store/backup", specific: | ||||
|         #     a) user: m5vz9gp4 | ||||
|         #     b) fqdn: m5vz9gp4.repo.borgbase.co | ||||
|         #     c) dir: repo | ||||
|         user: "{{ borg_repository | regex_search('(.*)@', '\\1') | first }}" # part a) | ||||
|         state: present | ||||
|         key: "{{ backup_local_ssh_key['content'] | b64decode }}" | ||||
|       delegate_to: "{{ borg_repository | regex_search('@(.*):', '\\1') | first }}" # part b) | ||||
| 
 | ||||
|     - name: Print key if the borgmatic_initialization_repo is false | ||||
|       when: borgmatic_initialization_repo is not defined or not borgmatic_initialization_repo | ||||
|     - name: Print key | ||||
|       ansible.builtin.debug: | ||||
|         msg: "The generated key is: {{ backup_local_ssh_key['content'] | b64decode }}" | ||||
| ... | ||||
|  | ||||
| @ -1,9 +0,0 @@ | ||||
| --- | ||||
| - name: Init repository | ||||
|   when: | ||||
|     - borgmatic_initialization_repo is defined and borgmatic_initialization_repo | ||||
|   tags: | ||||
|     - install_backup | ||||
|   ansible.builtin.command: | ||||
|     cmd: "su - {{ borgbackup_user }} -c '/usr/local/bin/borgmatic rcreate --encryption keyfile --append-only'" | ||||
| ... | ||||
| @ -20,11 +20,11 @@ | ||||
|     - name: Populate service facts | ||||
|       ansible.builtin.service_facts: | ||||
| 
 | ||||
|     - name: Restart borgmatic services | ||||
|     - name: Stop borgmatic services | ||||
|       ansible.builtin.systemd: | ||||
|         name: "{{ item }}" | ||||
|         state: started | ||||
|         enabled: true | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         masked: false | ||||
|         daemon_reload: true | ||||
|       when: "item in services" | ||||
| @ -32,12 +32,17 @@ | ||||
|         - backup.service | ||||
|      | ||||
|     # bug: Need own section without masked else the timer are skipped | ||||
|     - name: Restart borgmatic timers | ||||
|     - name: Stop borgmatic timers | ||||
|       ansible.builtin.systemd: | ||||
|         name: "{{ item }}" | ||||
|         state: started | ||||
|         enabled: true | ||||
|         state: stopped | ||||
|         enabled: false | ||||
|         daemon_reload: true | ||||
|       with_items: | ||||
|         - "backup.timer" | ||||
| 
 | ||||
|     - name: Show hints | ||||
|       when: "'backup_init_repo' not in ansible_run_tags" | ||||
|       ansible.builtin.debug: | ||||
|         msg: "Attention: Since the repo was not initialized automatically, the systemd service (backup.service) and the timer (backup.timer) are not activated." | ||||
| ... | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user