From 8cb5d6da6652a0f6953c16df8864ed1131c2619b Mon Sep 17 00:00:00 2001 From: Mark Heiges Date: Fri, 4 Dec 2015 16:54:18 -0500 Subject: [PATCH] add tasks to use NFS for file attachment storage on production server --- bootstrap.yml | 2 ++ config.yml | 4 +++ .../easyredmine/tasks/attachments_storage.yml | 26 +++++++++++++++++++ roles/easyredmine/tasks/main.yml | 12 +++++---- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 roles/easyredmine/tasks/attachments_storage.yml diff --git a/bootstrap.yml b/bootstrap.yml index 5228bf8..93b3fc7 100644 --- a/bootstrap.yml +++ b/bootstrap.yml @@ -7,8 +7,10 @@ tasks: + # match uid with NFS server - name: Create user of Redmine installation user: name='{{ redmine_owner }}' + uid=1303 state=present ssh_key_file=.ssh/id_rsa diff --git a/config.yml b/config.yml index 3ee0526..ec7c854 100644 --- a/config.yml +++ b/config.yml @@ -29,6 +29,10 @@ smtp_password: smtppassword smtp_authentication: plain smtp_enable_starttls: true ruby_version: 2.1.3 +is_production_vm: False +nfs_domain: gacrc.uga.edu # Domain /etc/idmapd.conf on NFS server +redmine_files_nfs_mount: '' # /mnt/redminefiles +redmine_files_nfs_source: '' # 171.26.20.75:/srv/easyredmine _redmine_db_import_file: /tmp/redmine_dump.sql _redmine_db_import_success: /tmp/redmine_db_import_success _redmine_install_wrapper: '/home/{{ redmine_owner }}/install_wrapper' diff --git a/roles/easyredmine/tasks/attachments_storage.yml b/roles/easyredmine/tasks/attachments_storage.yml new file mode 100644 index 0000000..1035add --- /dev/null +++ b/roles/easyredmine/tasks/attachments_storage.yml @@ -0,0 +1,26 @@ +# Tasks to do only on the production server. + +# Setup NFS mounts where file attachments will be stored. +# This is so files are backed up on the NFS host; when hosting +# redmine on a VM without a backup client. +# +# Be sure the UID for the redmine user matches with the +# NFS server + +- file: path='{{ redmine_files_nfs_mount }}' + state=directory + sudo: yes + +- mount: name='{{ redmine_files_nfs_mount }}' + src='{{ redmine_files_nfs_source }}' + fstype=nfs + opts=rsize=32768,wsize=32768,tcp,hard,nointr + state=mounted + sudo: yes + +- name: set attachments_storage_path in configuration.yml + lineinfile: > + dest='{{ redmine_root_dir }}/config/configuration.yml' + regexp='\s*attachments_storage_path:' + line=' attachments_storage_path: {{ redmine_files_nfs_mount }}' + notify: restart nginx \ No newline at end of file diff --git a/roles/easyredmine/tasks/main.yml b/roles/easyredmine/tasks/main.yml index 01debcd..fc8ae36 100644 --- a/roles/easyredmine/tasks/main.yml +++ b/roles/easyredmine/tasks/main.yml @@ -1,13 +1,15 @@ --- -- include: system.yml +- include: system.yml tags=system -- include: firewall.yml +- include: firewall.yml tags=firewall -- include: database.yml +- include: database.yml tags=database when: do_database_management == True -- include: redmine.yml +- include: redmine.yml tags=redmine -- include: nginx.yml +- include: nginx.yml tags=nginx +- include: attachments_storage.yml tags=attachments_storage + when: is_production_vm == True