Add rsync support

Allow the user to use rsync for conf.d files.

Change-Id: Ibb7ae3c01aeb803d5652a64a55106c0bcd92e016
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-02-16 14:35:28 -05:00
parent cfe589d4a5
commit 462c9980d4
2 changed files with 29 additions and 11 deletions

View File

@ -12,7 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
---
nginx_config_include_files: []
nginx_file_include_dir_dest: /etc/nginx/conf.d
nginx_file_include_dir_group: "{{ ansible_user }}"
nginx_file_include_dir_mode: "0755"
nginx_file_include_dir_owner: "{{ ansible_user }}"
nginx_file_include_dir_src: ""
nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf
nginx_file_nginx_conf_src: etc/nginx/nginx.conf

View File

@ -12,17 +12,31 @@
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Copy nginx custom configuration files.
copy:
dest: "{{ nginx_config_include_dir }}"
force: true
src: "{{ nginx_config_include_files }}"
notify:
- Restart nginx
- Validate nginx
- name: Copy nginx configuration file.
copy:
dest: "{{ nginx_file_nginx_conf_dest }}"
src: "{{ nginx_file_nginx_conf_src }}"
notify: Restart nginx
notify:
- Validate nginx
- Restart nginx
- name: Create custom configuration directory.
become: yes
file:
dest: "{{ nginx_file_include_dir_dest }}"
group: "{{ nginx_file_include_dir_group }}"
mode: "{{ nginx_file_include_dir_mode }}"
owner: "{{ nginx_file_include_dir_owner }}"
state: directory
- name: Rsync nginx configuration.
become: no
synchronize:
delete: yes
dest: "{{ nginx_file_include_dir_dest }}"
perms: yes
src: "{{ nginx_file_include_dir_src }}"
when: nginx_file_include_dir_src != ""
notify:
- Validate nginx
- Restart nginx