Skip to content

Commit 0f05f30

Browse files
authored
Merge pull request #16 from onaio/configure-settings-template-path
Configure the source of the local settings path.
2 parents 100e5c7 + 43cdd4c commit 0f05f30

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

defaults/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ django_system_user_home: "/home/{{ django_system_user }}"
77
django_git_url:
88
django_git_version: "master"
99
django_git_key:
10+
django_git_key_ssh_file:
1011
django_git_key_filename: "id_ed25519"
1112
django_remove_git_key: True
13+
django_copy_key_from_file: false
1214

1315
# system-wide dependencies
1416
django_python_source_version: "3.6"
@@ -64,6 +66,9 @@ django_static_path: "/var/www/static/"
6466
django_media_path: "/var/www/media/"
6567
django_settings_module:
6668

69+
# template settings path
70+
django_settings_template_path: "../templates/local_settings.py.j2"
71+
6772
## Django settings
6873
django_settings:
6974
BASE_DIR: "os.path.dirname(os.path.dirname(__file__))"

tasks/install.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
- "{{ django_media_path }}"
5050
- "{{ django_system_user_home }}/.ssh"
5151

52-
- name: Copy git key
52+
- name: Copy git key from string
5353
copy:
5454
content: "{{ django_git_key }}"
5555
dest: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
@@ -60,6 +60,17 @@
6060
- django_git_key is defined
6161
- django_git_key is not none
6262

63+
- name: Copy git key from file
64+
copy:
65+
src: "{{ django_git_key }}"
66+
dest: "{{ django_system_user_home }}/.ssh/{{ django_git_key_filename }}"
67+
owner: "{{ django_system_user }}"
68+
mode: 0600
69+
no_log: False
70+
when:
71+
- django_git_key_ssh_file is defined
72+
- django_git_key_ssh_file is not none
73+
6374
- name: Git clone with key
6475
git:
6576
accept_hostkey: "yes"
@@ -146,7 +157,7 @@
146157

147158
- name: Copy local settings from template
148159
template:
149-
src: local_settings.py.j2
160+
src: "{{ django_settings_template_path }}"
150161
dest: "{{ django_local_settings_path }}"
151162
owner: "{{ django_system_user }}"
152163
group: "{{ django_system_group }}"

tests/test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
django_git_version: "master"
3030
django_celery_app: "picha"
3131
django_python_source_version: "2.7"
32-
django_python_version: "python2.7"
32+
django_python_version: "python3.6"
3333
django_enable_celery: True
3434
django_local_settings_path: "{{ django_checkout_path }}/picha/local_settings.py"
3535
django_settings_module: "picha.settings"
3636
django_wsgi_module: "picha.wsgi:application"
3737
django_init_commands:
3838
- migrate --noinput
3939
django_pip_packages:
40-
- celery
40+
- 'celery==3.1.24'
4141
- uwsgi
4242
- 'redis==2.10.6'
4343
- 'django==1.11'
@@ -49,4 +49,4 @@
4949
gather_facts: True
5050
become: True
5151
roles:
52-
- role: ../..
52+
- role: ../..

0 commit comments

Comments
 (0)