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 eaa11bff68
3 changed files with 34 additions and 13 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

View File

@ -12,8 +12,11 @@ commands = python setup.py build_sphinx
[testenv:functional]
commands =
ansible-playbook -i tests/inventory tests/test.yaml
passenv = HOME
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER}
passenv =
HOME
USER
setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1