mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Working on inventories.
This commit is contained in:
parent
1901561fa0
commit
94d900aedc
15 changed files with 46 additions and 14 deletions
|
@ -7,6 +7,7 @@ private_key_file = /srv/secrets-newsblur/keys/docker.key
|
|||
publickey = /srv/secrets-newsblur/keys/docker.key.pub
|
||||
# private_key_file = /srv/secrets-newsblur/keys/newsblur.key
|
||||
remote_tmp = ~/.ansible/tmp
|
||||
forks = 20
|
||||
|
||||
[inventory]
|
||||
enable_plugins = ini, constructed
|
||||
|
|
|
@ -20,6 +20,8 @@ ansible_inventory_cmd = f'do-ansible-inventory -t {api_token} --out /srv/newsblu
|
|||
subprocess.call(ansible_inventory_cmd,
|
||||
shell=True)
|
||||
|
||||
exit() # Too many requests if we run the below code
|
||||
|
||||
do = digitalocean.Manager(token=api_token)
|
||||
droplets = do.get_all_droplets()
|
||||
|
||||
|
@ -27,6 +29,7 @@ print("\n ---> Checking droplets: %s\n" % (' '.join([d.name for d in droplets]))
|
|||
|
||||
|
||||
def check_droplets_created():
|
||||
i = 0
|
||||
droplets = do.get_all_droplets()
|
||||
|
||||
for instance in droplets:
|
||||
|
|
|
@ -9,5 +9,7 @@ groups:
|
|||
# debug: inventory_hostname.startswith('debug')
|
||||
db: inventory_hostname.startswith('db')
|
||||
task: inventory_hostname.startswith('task') and inventory_hostname != 'task'
|
||||
search: inventory_hostname.startswith('search')
|
||||
dbredis: inventory_hostname.startswith('db-redis')
|
||||
search: inventory_hostname.startswith('elasticsearch')
|
||||
db_redis: inventory_hostname.startswith('db-redis')
|
||||
db_postgres: inventory_hostname.startswith('db-postgres')
|
||||
db_mongo: inventory_hostname.startswith('db-mongo')
|
||||
|
|
17
ansible/roles/haproxy/tasks/main.yml
Normal file
17
ansible/roles/haproxy/tasks/main.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
- name: Start HAProxcy docker container
|
||||
become: yes
|
||||
docker_container:
|
||||
name: haproxy
|
||||
image: haproxy:latest
|
||||
env:
|
||||
DOCKERBUILD: "True"
|
||||
state: started
|
||||
ports:
|
||||
- "80:80"
|
||||
restart_policy: unless-stopped
|
||||
container_default_behavior: compatibility
|
||||
expose:
|
||||
- "80"
|
||||
volumes:
|
||||
- /srv/newsblur/docker/haproxy:/usr/local/etc/haproxy
|
|
@ -14,6 +14,4 @@
|
|||
- "80"
|
||||
volumes:
|
||||
- /srv/newsblur/docker/nginx:/etc/nginx/conf.d
|
||||
volumes_from:
|
||||
- newsblur_web
|
||||
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
---
|
||||
- name: Pull newsblur_web github
|
||||
- name: Ensure repo directory
|
||||
become: yes
|
||||
file:
|
||||
path: /srv/newsblur
|
||||
state: directory
|
||||
owner: "{{ ansible_effective_user_id|int }}"
|
||||
group: "{{ ansible_effective_group_id|int }}"
|
||||
recurse: yes
|
||||
|
||||
- name: Pull newsblur_web github
|
||||
git:
|
||||
repo: https://github.com/samuelclay/NewsBlur.git
|
||||
dest: /srv/newsblur/
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
- base
|
||||
- docker
|
||||
- web
|
||||
- nginx
|
||||
- {role: 'nginx', tags: 'nginx'}
|
||||
- consul-client
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Setup elasticsearch container
|
||||
hosts: search-elasticsearch
|
||||
hosts: search
|
||||
remote_user: nb
|
||||
vars:
|
||||
- update_apt_cache: yes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Set up mongo db container
|
||||
hosts: db-mongo
|
||||
hosts: db_mongo
|
||||
remote_user: nb
|
||||
vars:
|
||||
- update_apt_cache: yes
|
||||
|
@ -13,4 +13,4 @@
|
|||
- docker
|
||||
- repo
|
||||
- mongo
|
||||
- consul-client
|
||||
- consul-client
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
|
||||
- name: Set up task containers
|
||||
hosts: db-postgres
|
||||
hosts: db_postgres
|
||||
remote_user: nb
|
||||
become: true
|
||||
vars_files:
|
||||
|
@ -14,4 +14,4 @@
|
|||
- docker
|
||||
- repo
|
||||
- postgres
|
||||
- consul-client
|
||||
- consul-client
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Set up redis containers
|
||||
hosts: db-redis
|
||||
hosts: db_redis
|
||||
remote_user: nb
|
||||
become: true
|
||||
vars:
|
||||
|
@ -13,4 +13,4 @@
|
|||
- docker
|
||||
- repo
|
||||
- redis
|
||||
- consul-client
|
||||
- consul-client
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
strategy: free
|
||||
remote_user: root
|
||||
vars_files:
|
||||
- env_vars/base.yml
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
roles:
|
||||
- base
|
||||
- docker
|
||||
- repo
|
||||
- {role: 'repo', tags: 'repo'}
|
||||
- monitor
|
||||
- consul-client
|
||||
- {role: 'haproxy', tags: 'haproxy'}
|
||||
|
|
|
@ -36,6 +36,7 @@ resource "digitalocean_droplet" "www" {
|
|||
}
|
||||
|
||||
resource "digitalocean_droplet" "app-django" {
|
||||
count = 2
|
||||
image = var.droplet_os
|
||||
name = "app-django"
|
||||
region = var.droplet_region
|
||||
|
|
Loading…
Add table
Reference in a new issue