-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃 Add backup roles #33
base: main
Are you sure you want to change the base?
Conversation
|
||
- name: Backup OpenNMS | ||
hosts: core | ||
user: root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends if the Ansible user has enough permissions. For the copy jobs of the files it could work with ubuntu
. But maybe not for the PSQL dump.
Right now it is set to root
since I also don't have an ubuntu
user.
vars: | ||
timestamp: "{{ ansible_date_time.date }}_{{ ansible_date_time.hour }}{{ ansible_date_time.minute }}" | ||
|
||
# - name: Backup PostgreSQL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented because the PG dump is not working yet. But you can see the structure I am following here.
@@ -0,0 +1,4 @@ | |||
--- | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In best case we could define them globally instead of in each role.
- name: "Create a backup directory" | ||
file: | ||
path: "{{onms_backup_folder }}" | ||
mode: 0777 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess not the final permissions. But for now sufficient.
ansible.builtin.include_tasks: ubuntu_debian.yml | ||
when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu" | ||
|
||
- name: Run backups scripts for RedHat / CentOs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CentOS / Redhat is not tested yet.
ignore_errors: yes | ||
changed_when: false | ||
|
||
- name: Grep OpenNMS group ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The grep commands are redundant in CentOS and Ubuntu. Maybe we should move them to main.yaml
.
ignore_errors: yes | ||
changed_when: false | ||
|
||
- name: Create latest passwd file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be cool to have an handler that always does this latest
copy process. But I didn't find a solution for this right now. Also, we have those tasks in CentOS and Ubuntu tasks.
@indigo423 Let's sync about my approach before continuing. |
part of #32
@indigo423 see inline comments.