summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Belanger <pabelanger@redhat.com>2016-02-16 14:35:28 -0500
committerPaul Belanger <pabelanger@redhat.com>2016-02-16 15:59:25 -0500
commiteaa11bff680ebf92ae1dc7239c69b8ae8436cc06 (patch)
tree6d406e0c56642dc7d10cbf6b348666138cb8cd7c
parentcfe589d4a58023f79337fe86de2c9984c3537d50 (diff)
Add rsync support
Allow the user to use rsync for conf.d files. Change-Id: Ibb7ae3c01aeb803d5652a64a55106c0bcd92e016 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
Notes
Notes (review): Code-Review+2: Paul Belanger <pabelanger@redhat.com> Workflow+1: Paul Belanger <pabelanger@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 17 Feb 2016 17:34:00 +0000 Reviewed-on: https://review.openstack.org/280897 Project: openstack/ansible-role-nginx Branch: refs/heads/master
-rw-r--r--defaults/main.yaml6
-rw-r--r--tasks/config.yaml34
-rw-r--r--tox.ini7
3 files changed, 34 insertions, 13 deletions
diff --git a/defaults/main.yaml b/defaults/main.yaml
index bdd1b63..b2ba697 100644
--- a/defaults/main.yaml
+++ b/defaults/main.yaml
@@ -12,7 +12,11 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14--- 14---
15nginx_config_include_files: [] 15nginx_file_include_dir_dest: /etc/nginx/conf.d
16nginx_file_include_dir_group: "{{ ansible_user }}"
17nginx_file_include_dir_mode: "0755"
18nginx_file_include_dir_owner: "{{ ansible_user }}"
19nginx_file_include_dir_src: ""
16 20
17nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf 21nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf
18nginx_file_nginx_conf_src: etc/nginx/nginx.conf 22nginx_file_nginx_conf_src: etc/nginx/nginx.conf
diff --git a/tasks/config.yaml b/tasks/config.yaml
index 29e349e..47f97ef 100644
--- a/tasks/config.yaml
+++ b/tasks/config.yaml
@@ -12,17 +12,31 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14--- 14---
15- name: Copy nginx custom configuration files.
16 copy:
17 dest: "{{ nginx_config_include_dir }}"
18 force: true
19 src: "{{ nginx_config_include_files }}"
20 notify:
21 - Restart nginx
22 - Validate nginx
23
24- name: Copy nginx configuration file. 15- name: Copy nginx configuration file.
25 copy: 16 copy:
26 dest: "{{ nginx_file_nginx_conf_dest }}" 17 dest: "{{ nginx_file_nginx_conf_dest }}"
27 src: "{{ nginx_file_nginx_conf_src }}" 18 src: "{{ nginx_file_nginx_conf_src }}"
28 notify: Restart nginx 19 notify:
20 - Validate nginx
21 - Restart nginx
22
23- name: Create custom configuration directory.
24 become: yes
25 file:
26 dest: "{{ nginx_file_include_dir_dest }}"
27 group: "{{ nginx_file_include_dir_group }}"
28 mode: "{{ nginx_file_include_dir_mode }}"
29 owner: "{{ nginx_file_include_dir_owner }}"
30 state: directory
31
32- name: Rsync nginx configuration.
33 become: no
34 synchronize:
35 delete: yes
36 dest: "{{ nginx_file_include_dir_dest }}"
37 perms: yes
38 src: "{{ nginx_file_include_dir_src }}"
39 when: nginx_file_include_dir_src != ""
40 notify:
41 - Validate nginx
42 - Restart nginx
diff --git a/tox.ini b/tox.ini
index c3add41..a340d4a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -12,8 +12,11 @@ commands = python setup.py build_sphinx
12 12
13[testenv:functional] 13[testenv:functional]
14commands = 14commands =
15 ansible-playbook -i tests/inventory tests/test.yaml 15 # NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
16passenv = HOME 16 ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER}
17passenv =
18 HOME
19 USER
17setenv = 20setenv =
18 ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg 21 ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
19 PYTHONUNBUFFERED = 1 22 PYTHONUNBUFFERED = 1