Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

extract nginx role in line with #39 #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.pass
.env
env

roles/nginx/
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@ Interested in becoming a member? Get your invite here: http://pythondevelopers.h

## Get Started

Ensure you have a `.pass` file in the root of your project, populated with the ansible password.
1. Ensure you have a `.pass` file in the root of the repository, populated with the ansible password for the any variables your playbook depends on
2. Download/install ansible-galaxy provided roles before you run any playbooks

```bash
$ ansible-galaxy install -r requirements.yml
```

### Configure/Deploy PySlackers website

$ ansible-playbook website.yml
```bash
$ ansible-playbook website.yml
```

### Configure/Deploy SirBot

TODO!

$ ansible-playbook sirbot.yml
```bash
$ ansible-playbook sirbot.yml
```

### Run the deployment for the specific app you want to deploy

Expand All @@ -28,13 +35,17 @@ TODO!

Run the deployment.

$ ansible-playbook -i <inventory> deploy.yml --tags <app>
```bash
$ ansible-playbook -i <inventory> deploy.yml --tags <app>
```

## Testing

Tests are run via Travis CI's `.travis.yml`. Unit tests can be manually via docker with:

$ docker run -t -i -v ${PWD}:/data geerlingguy/docker-ubuntu1604-ansible /data/run_tests.sh
```bash
$ docker run -t -i -v ${PWD}:/data geerlingguy/docker-ubuntu1604-ansible /data/run_tests.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also provide the command for testing on debian 9

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is just a reformatting of what is already there to be explicit with the language. As the roles break out of here, I think this loses value and each role is responsible for its own testing

```

Ensure that you have placed the Ansible vault password into `.pass` beforehand.

Expand Down
3 changes: 2 additions & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[defaults]
ansible_managed = This file is managed by Ansible, manual edits will be lost
inventory = environments/inventory
pipelining = True
retry_files_enabled = False
roles_path = ./roles/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

vault_password_file = .pass
pipelining = True
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- src: https://github.com/pyslackers/ansible-role-nginx.git
version: master
name: nginx
3 changes: 0 additions & 3 deletions roles/nginx/defaults/main.yml

This file was deleted.

20 changes: 0 additions & 20 deletions roles/nginx/handlers/main.yml

This file was deleted.

15 changes: 0 additions & 15 deletions roles/nginx/tasks/http.yml

This file was deleted.

19 changes: 0 additions & 19 deletions roles/nginx/tasks/main.yml

This file was deleted.

35 changes: 0 additions & 35 deletions roles/nginx/tasks/ssl.yml

This file was deleted.

98 changes: 0 additions & 98 deletions roles/nginx/templates/etc/nginx/sites-available/site-available.j2

This file was deleted.

11 changes: 7 additions & 4 deletions sirbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
repo: https://github.com/pyslackers/sirbot-pythondev.git
version: prod
username: "{{ sirbot_user }}"
domains:
- "{{ sirbot_domain }}"
service_name: sirbot
site_port: "{{ sirbot_port }}"
exec_start: "/home/{{ username }}/.pyvenv/bin/sirbot -c {{ sirbot_config }}"
work_dir: "/home/{{ username }}/"
post_install: "/home/{{ username }}/.pyvenv/bin/sirbot -c {{ sirbot_config }} --update"
Expand All @@ -19,7 +16,13 @@
- "SIRBOT_GITHUB_SECRET={{ SIRBOT_GITHUB_SECRET }}"
roles:
- user
- nginx
- role: nginx
sites:
sirbot:
domains:
- "{{ sirbot_domain }}"
port: "{{ sirbot_port }}"
ssl: true
- sirbot
- role: system_service
when: systemd_enabled == true
12 changes: 8 additions & 4 deletions website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
- name: deploy pyslackers website
hosts: website
vars:
domains:
- "{{ website_domain }}"
- "www.{{ website_domain }}"
repo: https://github.com/pyslackers/website-old.git
service_name: pyslackers-website
site_port: "{{ website_port }}"
Expand All @@ -19,7 +16,14 @@
- "SECRET_KEY={{ SECRET_KEY }}"
roles:
- user
- nginx
- role: nginx
sites:
website:
domains:
- www.pyslackers.com
- pyslackers.com
port: "{{ website_port }}"
ssl: true
- pythonapp
- role: system_service
when: systemd_enabled
Expand Down