mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-04-13 09:42:01 +00:00
Adding files for common setup on app. Finishing up dynamic inventory.
This commit is contained in:
parent
d3ce8ab87c
commit
dccb87bd26
16 changed files with 191 additions and 87 deletions
|
@ -1,8 +1,10 @@
|
||||||
[defaults]
|
[defaults]
|
||||||
# host_key_checking = False
|
# host_key_checking = False
|
||||||
|
remote_user = nb
|
||||||
retry_files_enabled = False
|
retry_files_enabled = False
|
||||||
inventory = /srv/newsblur/ansible/inventories/digital_ocean.ini, /srv/newsblur/ansible/inventories/digital_ocean.yml
|
inventory = /srv/newsblur/ansible/inventories/digital_ocean.ini, /srv/newsblur/ansible/inventories/digital_ocean.yml
|
||||||
private_key_file = /srv/secrets-newsblur/keys/docker.pem
|
private_key_file = /srv/secrets-newsblur/keys/docker.key
|
||||||
|
# private_key_file = /srv/secrets-newsblur/keys/newsblur.key
|
||||||
|
|
||||||
[inventory]
|
[inventory]
|
||||||
enable_plugins = ini, constructed
|
enable_plugins = ini, constructed
|
|
@ -17,5 +17,5 @@ sys_packages: [
|
||||||
'libssl-doc',
|
'libssl-doc',
|
||||||
'build-essential',
|
'build-essential',
|
||||||
'ntp',
|
'ntp',
|
||||||
'htop'
|
'htop'
|
||||||
]
|
]
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token"
|
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.token"
|
||||||
TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.readprod.token"
|
# TOKEN_FILE = "/srv/secrets-newsblur/keys/digital_ocean.readprod.token"
|
||||||
|
|
||||||
with open(TOKEN_FILE) as f:
|
with open(TOKEN_FILE) as f:
|
||||||
token = f.read().strip()
|
token = f.read().strip()
|
||||||
|
|
|
@ -3,10 +3,10 @@ strict: False
|
||||||
|
|
||||||
groups:
|
groups:
|
||||||
web: inventory_hostname.startswith('app') or inventory_hostname.startswith('node') or inventory_hostname.startswith('work') or inventory_hostname.startswith('push')
|
web: inventory_hostname.startswith('app') or inventory_hostname.startswith('node') or inventory_hostname.startswith('work') or inventory_hostname.startswith('push')
|
||||||
app: inventory_hostname.startswith('app') or inventory_hostname.startswith('push')
|
app: (inventory_hostname.startswith('app') or inventory_hostname.startswith('push')) and inventory_hostname != 'app'
|
||||||
# work: inventory_hostname.startswith('work')
|
# work: inventory_hostname.startswith('work')
|
||||||
node: inventory_hostname.startswith('node')
|
node: inventory_hostname.startswith('node') and inventory_hostname != 'node'
|
||||||
# debug: inventory_hostname.startswith('debug')
|
# debug: inventory_hostname.startswith('debug')
|
||||||
db: inventory_hostname.startswith('db')
|
db: inventory_hostname.startswith('db')
|
||||||
task: inventory_hostname.startswith('task')
|
task: inventory_hostname.startswith('task') and inventory_hostname != 'task'
|
||||||
search: inventory_hostname.startswith('search')
|
search: inventory_hostname.startswith('search')
|
||||||
|
|
37
ansible/roles/base/files/motd.app.txt
Normal file
37
ansible/roles/base/files/motd.app.txt
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
bold=`echo "\033[1m"`
|
||||||
|
regular=`echo "\033[0m"`
|
||||||
|
black=`echo "\033[30;40m"`
|
||||||
|
red=`echo "\033[31;40m"`
|
||||||
|
green=`echo "\033[32;40m"`
|
||||||
|
yellow=`echo "\033[33;40m"`
|
||||||
|
blue=`echo "\033[34;40m"`
|
||||||
|
magenta=`echo "\033[35;40m"`
|
||||||
|
cyan=`echo "\033[36;40m"`
|
||||||
|
white=`echo "\033[37;40m"`
|
||||||
|
|
||||||
|
cat <<EOMOTD
|
||||||
|
$bold
|
||||||
|
$cyan^^ $yellow@@@@@@@@@
|
||||||
|
$cyan^^ ^^ $yellow@@@@@@@@@@@@@@@
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@ $cyan^^
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@@@
|
||||||
|
$bold$blue~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ $regular$yellow&&&&&&&&&&&&&&&&&&&&$bold$blue ~~~~~~~ ~~~~~~~~~~~ ~~~
|
||||||
|
$bold$blue~ ~~ ~ ~ $regular$yellow~~~~~~~~~~~~~~~~~~~~$bold$blue ~ ~~ ~~ ~
|
||||||
|
$bold$blue ~ ~~ ~~ ~~ ~~ $regular$yellow~~~~~~~~~~~~~ ~~~~$bold$blue ~ ~~~ ~ ~~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~~ ~ ~ $regular$yellow~~~~~~ ~~ ~~~$bold$blue ~~ ~ ~~ ~~ ~
|
||||||
|
$bold$blue~ ~ ~ ~ ~ $regular$yellow~~ ~~~~~~$bold$blue ~ ~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~ ~ ~ ~~ ~ ~
|
||||||
|
$green
|
||||||
|
888b | 888~~\ 888
|
||||||
|
|Y88b | e88~~8e Y88b e / d88~\ 888 | 888 888 888 888-~\
|
||||||
|
| Y88b | d888 88b Y88b d8b / C888 888 _/ 888 888 888 888
|
||||||
|
| Y88b | 8888__888 Y888/Y88b/ Y88b 888 \ 888 888 888 888
|
||||||
|
| Y88b| Y888 , Y8/ Y8/ 888D 888 | 888 888 888 888
|
||||||
|
| Y888 "88___/ Y Y \_88P 888__/ 888 "88_-888 888
|
||||||
|
|
||||||
|
$red App Server
|
||||||
|
$regular$white
|
||||||
|
EOMOTD
|
||||||
|
|
39
ansible/roles/base/files/motd.db.txt
Normal file
39
ansible/roles/base/files/motd.db.txt
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
bold=`echo "\033[1m"`
|
||||||
|
regular=`echo "\033[0m"`
|
||||||
|
black=`echo "\033[30;40m"`
|
||||||
|
red=`echo "\033[31;40m"`
|
||||||
|
green=`echo "\033[32;40m"`
|
||||||
|
yellow=`echo "\033[33;40m"`
|
||||||
|
blue=`echo "\033[34;40m"`
|
||||||
|
magenta=`echo "\033[35;40m"`
|
||||||
|
cyan=`echo "\033[36;40m"`
|
||||||
|
white=`echo "\033[37;40m"`
|
||||||
|
|
||||||
|
cat <<EOMOTD
|
||||||
|
$bold
|
||||||
|
$cyan^^ $yellow@@@@@@@@@
|
||||||
|
$cyan^^ ^^ $yellow@@@@@@@@@@@@@@@
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@ $cyan^^
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@@@
|
||||||
|
$bold$blue~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ $regular$yellow&&&&&&&&&&&&&&&&&&&&$bold$blue ~~~~~~~ ~~~~~~~~~~~ ~~~
|
||||||
|
$bold$blue~ ~~ ~ ~ $regular$yellow~~~~~~~~~~~~~~~~~~~~$bold$blue ~ ~~ ~~ ~
|
||||||
|
$bold$blue ~ ~~ ~~ ~~ ~~ $regular$yellow~~~~~~~~~~~~~ ~~~~$bold$blue ~ ~~~ ~ ~~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~~ ~ ~ $regular$yellow~~~~~~ ~~ ~~~$bold$blue ~~ ~ ~~ ~~ ~
|
||||||
|
$bold$blue~ ~ ~ ~ ~ $regular$yellow~~ ~~~~~~$bold$blue ~ ~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~ ~ ~ ~~ ~ ~
|
||||||
|
$green
|
||||||
|
888b | 888~~\ 888
|
||||||
|
|Y88b | e88~~8e Y88b e / d88~\ 888 | 888 888 888 888-~\
|
||||||
|
| Y88b | d888 88b Y88b d8b / C888 888 _/ 888 888 888 888
|
||||||
|
| Y88b | 8888__888 Y888/Y88b/ Y88b 888 \ 888 888 888 888
|
||||||
|
| Y88b| Y888 , Y8/ Y8/ 888D 888 | 888 888 888 888
|
||||||
|
| Y888 "88___/ Y Y \_88P 888__/ 888 "88_-888 888
|
||||||
|
|
||||||
|
$red DB Server
|
||||||
|
|
||||||
|
$regular$white
|
||||||
|
|
||||||
|
EOMOTD
|
||||||
|
|
39
ansible/roles/base/files/motd.task.txt
Normal file
39
ansible/roles/base/files/motd.task.txt
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
bold=`echo "\033[1m"`
|
||||||
|
regular=`echo "\033[0m"`
|
||||||
|
black=`echo "\033[30;40m"`
|
||||||
|
red=`echo "\033[31;40m"`
|
||||||
|
green=`echo "\033[32;40m"`
|
||||||
|
yellow=`echo "\033[33;40m"`
|
||||||
|
blue=`echo "\033[34;40m"`
|
||||||
|
magenta=`echo "\033[35;40m"`
|
||||||
|
cyan=`echo "\033[36;40m"`
|
||||||
|
white=`echo "\033[37;40m"`
|
||||||
|
|
||||||
|
cat <<EOMOTD
|
||||||
|
$bold
|
||||||
|
$cyan^^ $yellow@@@@@@@@@
|
||||||
|
$cyan^^ ^^ $yellow@@@@@@@@@@@@@@@
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@ $cyan^^
|
||||||
|
$yellow@@@@@@@@@@@@@@@@@@@@
|
||||||
|
$bold$blue~~~~ ~~ ~~~~~ ~~~~~~~~ ~~ $regular$yellow&&&&&&&&&&&&&&&&&&&&$bold$blue ~~~~~~~ ~~~~~~~~~~~ ~~~
|
||||||
|
$bold$blue~ ~~ ~ ~ $regular$yellow~~~~~~~~~~~~~~~~~~~~$bold$blue ~ ~~ ~~ ~
|
||||||
|
$bold$blue ~ ~~ ~~ ~~ ~~ $regular$yellow~~~~~~~~~~~~~ ~~~~$bold$blue ~ ~~~ ~ ~~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~~ ~ ~ $regular$yellow~~~~~~ ~~ ~~~$bold$blue ~~ ~ ~~ ~~ ~
|
||||||
|
$bold$blue~ ~ ~ ~ ~ $regular$yellow~~ ~~~~~~$bold$blue ~ ~~ ~ $bold$blue~~
|
||||||
|
$bold$blue ~ ~ ~ ~ ~~ ~ ~
|
||||||
|
$green
|
||||||
|
888b | 888~~\ 888
|
||||||
|
|Y88b | e88~~8e Y88b e / d88~\ 888 | 888 888 888 888-~\
|
||||||
|
| Y88b | d888 88b Y88b d8b / C888 888 _/ 888 888 888 888
|
||||||
|
| Y88b | 8888__888 Y888/Y88b/ Y88b 888 \ 888 888 888 888
|
||||||
|
| Y88b| Y888 , Y8/ Y8/ 888D 888 | 888 888 888 888
|
||||||
|
| Y888 "88___/ Y Y \_88P 888__/ 888 "88_-888 888
|
||||||
|
|
||||||
|
$red Task Server
|
||||||
|
|
||||||
|
$regular$white
|
||||||
|
|
||||||
|
EOMOTD
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
bold=`echo "\033[1m"`
|
|
||||||
regular=`echo "\033[0m"`
|
|
||||||
black=`echo "\033[30;40m"`
|
|
||||||
red=`echo "\033[31;40m"`
|
|
||||||
green=`echo "\033[32;40m"`
|
|
||||||
yellow=`echo "\033[33;40m"`
|
|
||||||
blue=`echo "\033[34;40m"`
|
|
||||||
magenta=`echo "\033[35;40m"`
|
|
||||||
cyan=`echo "\033[36;40m"`
|
|
||||||
white=`echo "\033[37;40m"`
|
|
||||||
|
|
||||||
cat <<EOMOTD
|
|
||||||
$bold
|
|
||||||
$yellow^^
|
|
||||||
^^ $red.. ..
|
|
||||||
[] []
|
|
||||||
.:[]:_ $yellow^^$red ,:[]:.
|
|
||||||
.: :[]: :-. ,-: :[]: :.
|
|
||||||
.: : :[]: : :'._ ,.': : :[]: : :.
|
|
||||||
.: : : :[]: : : : :-._ _,-: : : : :[]: : : :.
|
|
||||||
_..: : : : :[]: : : : : : :-._________.-: : : : : : :[]: : : : :-._
|
|
||||||
_:_:_:_:_:_:[]:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:[]:_:_:_:_:_:_
|
|
||||||
!!!!!!!!!!!![]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![]!!!!!!!!!!!!!
|
|
||||||
^^^^^^^^^^^^[]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[]^^^^^^^^^^^^^
|
|
||||||
[] []
|
|
||||||
[] []
|
|
||||||
[] []
|
|
||||||
$blue ~~^-~^_~^~$red/ \\$blue~^-~^~_~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^$red/ \\$blue~^-~_~^-~~-
|
|
||||||
$blue ~ _~~- ~^-^~-^~~- ^~_^-^~~_ -~^_ -~_-~~^- _~~_~-^_ ~^-^~~-_^-~ ~^
|
|
||||||
$blue ~ ^- _~~_- ~~ _ ~ ^~ - ~~^ _ - ^~- ~ _ ~~^ - ~_ - ~^_~
|
|
||||||
$blue ~- ^_ ~^ - ^~ _ - ~^~ _ _~^~- _ ~~^ - _ ~ - _ ~~^ -
|
|
||||||
$blue ~^ -_ ~^^ -_ ~ _ - _ ~^~- _~ -_ ~- _ ~^ _ - ~ ^-
|
|
||||||
$blue ~^~ - _ ^ - ~~~ _ - _ ~-^ ~ __- ~_ - ~ ~^_-
|
|
||||||
$blue ~ ~- ^~ - ~^ - ~ ^~ - ~~ ^~ - ~
|
|
||||||
|
|
||||||
$green ████████╗██╗ ██╗██████╗ ███╗ ██╗ ████████╗ ██████╗ ██╗ ██╗ ██████╗██╗ ██╗
|
|
||||||
$green ╚══██╔══╝██║ ██║██╔══██╗████╗ ██║ ╚══██╔══╝██╔═══██╗██║ ██║██╔════╝██║ ██║
|
|
||||||
$green ██║ ██║ ██║██████╔╝██╔██╗ ██║ ██║ ██║ ██║██║ ██║██║ ███████║
|
|
||||||
$green ██║ ██║ ██║██╔══██╗██║╚██╗██║ ██║ ██║ ██║██║ ██║██║ ██╔══██║
|
|
||||||
$green ██║ ╚██████╔╝██║ ██║██║ ╚████║ ██║ ╚██████╔╝╚██████╔╝╚██████╗██║ ██║
|
|
||||||
$green ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝
|
|
||||||
|
|
||||||
$cyan App Server
|
|
||||||
$regular$white
|
|
||||||
|
|
||||||
EOMOTD
|
|
||||||
|
|
|
@ -1,25 +1,19 @@
|
||||||
. /etc/profile
|
|
||||||
|
|
||||||
# Path to your oh-my-zsh configuration.
|
|
||||||
plugins=(git osx ruby gem github pip rails)
|
|
||||||
export ZSH=$HOME/.oh-my-zsh
|
export ZSH=$HOME/.oh-my-zsh
|
||||||
|
export CLICOLOR='1'
|
||||||
# Set to the name theme to load.
|
|
||||||
# Look in ~/.oh-my-zsh/themes/
|
|
||||||
export ZSH_THEME="risto"
|
export ZSH_THEME="risto"
|
||||||
|
export DISABLE_AUTO_UPDATE=true
|
||||||
|
|
||||||
export DISABLE_AUTO_UPDATE="true"
|
export WORKON_HOME=/srv/newsblur/venv
|
||||||
|
export PROJECT_HOME=/srv/newsblur
|
||||||
|
# source /usr/local/bin/virtualenvwrapper.sh
|
||||||
|
|
||||||
# Set to this to use case-sensitive completion
|
plugins=(git github pip)
|
||||||
export CASE_SENSITIVE="true"
|
|
||||||
export LC_COLLATE='C'
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
|
||||||
export DISABLE_AUTO_UPDATE="true"
|
|
||||||
export PYTHONSTARTUP=$HOME/.pystartup
|
export PYTHONSTARTUP=$HOME/.pystartup
|
||||||
export LSCOLORS='gxgxcxdxBxegedabagacad'
|
export LSCOLORS='gxgxcxdxBxegedabagacad'
|
||||||
|
export GOROOT=/srv/code/go
|
||||||
|
export GOPATH=/srv/code/go
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
|
||||||
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
||||||
setopt COMPLETE_IN_WORD
|
setopt COMPLETE_IN_WORD
|
||||||
|
@ -48,8 +42,11 @@ alias ls='ls -pFa --color'
|
||||||
alias cd..='cd ..'
|
alias cd..='cd ..'
|
||||||
|
|
||||||
alias smtp='python -m smtpd -n -c DebuggingServer 127.0.0.1:1025'
|
alias smtp='python -m smtpd -n -c DebuggingServer 127.0.0.1:1025'
|
||||||
alias tltt='echo "----------------\n"; tail -f /var/log/turntouch-web/turntouch-web.log'
|
alias tlnb='echo "----------------\n"; tail -f logs/newsblur.log'
|
||||||
alias sshtt=/srv/turntouch-web/scripts/ssh.sh
|
alias sshnb='ssh sclay@app10.newsblur.com'
|
||||||
alias cdtw=/srv/turntouch-web
|
alias sp='~/newsblur/manage.py shell_plus --use-pythonrc'
|
||||||
|
alias cdsg='cd ~/staging'
|
||||||
|
alias cdnb='cd ~/newsblur'
|
||||||
|
alias sshdo=/srv/newsblur/utils/ssh.sh
|
||||||
|
|
||||||
cd /srv/turntouch-web
|
cd /srv/newsblur
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
user: name=nb shell=/usr/bin/zsh
|
user: name=nb shell=/usr/bin/zsh
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: Cloning oh-my-zsh
|
- name: Cloning oh-my-zsh
|
||||||
git:
|
git:
|
||||||
repo=https://github.com/robbyrussell/oh-my-zsh
|
repo=https://github.com/robbyrussell/oh-my-zsh
|
||||||
dest=~/.oh-my-zsh
|
dest=~/.oh-my-zsh
|
||||||
|
@ -25,9 +25,9 @@
|
||||||
- name: Copy toprc
|
- name: Copy toprc
|
||||||
copy: src=toprc.txt dest=~/.toprc
|
copy: src=toprc.txt dest=~/.toprc
|
||||||
|
|
||||||
- name: Copy motd
|
- name: "Copy motd for {{ motd_role }}"
|
||||||
become: yes
|
become: yes
|
||||||
copy: src=motd.txt dest=/etc/update-motd.d/52-nb-motd mode=0755
|
copy: "src=motd.{{ motd_role }}.txt dest=/etc/update-motd.d/52-nb-motd mode=0755"
|
||||||
|
|
||||||
- include: ufw.yml
|
- include: ufw.yml
|
||||||
become: yes
|
become: yes
|
||||||
|
|
6
ansible/roles/etchosts/tasks/main.yml
Normal file
6
ansible/roles/etchosts/tasks/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
- name: "Build hosts file"
|
||||||
|
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
|
||||||
|
become: yes
|
||||||
|
when: hostvars[item].ansible_default_ipv4.address is defined
|
||||||
|
with_items: groups['all']
|
|
@ -3,11 +3,13 @@
|
||||||
remote_user: nb
|
remote_user: nb
|
||||||
vars:
|
vars:
|
||||||
- update_apt_cache: yes
|
- update_apt_cache: yes
|
||||||
|
- motd_role: app
|
||||||
vars_files:
|
vars_files:
|
||||||
- env_vars/base.yml
|
- env_vars/base.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
# - base
|
- base
|
||||||
# - docker
|
- docker
|
||||||
- nginx
|
|
||||||
- web
|
- web
|
||||||
|
- nginx
|
||||||
|
- {role: etchosts, tags: 'etchosts'}
|
||||||
|
|
|
@ -9,16 +9,47 @@
|
||||||
- env_vars/droplet.yml
|
- env_vars/droplet.yml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: Defined role or name
|
||||||
|
fail:
|
||||||
|
msg: Please define a role for your new droplet
|
||||||
|
when: role is not defined and name is not defined
|
||||||
|
|
||||||
|
- name: Setting name from role using inventory
|
||||||
|
set_fact:
|
||||||
|
name: "{{ role }}"
|
||||||
|
when: role is defined
|
||||||
|
|
||||||
|
- name: Setting role from name
|
||||||
|
set_fact:
|
||||||
|
role: "{{ name | regex_replace('\\d+', '') }}"
|
||||||
|
when: role is not defined
|
||||||
|
|
||||||
|
- fail:
|
||||||
|
msg: Please define a name for your new droplet
|
||||||
|
when: name is not defined
|
||||||
|
|
||||||
- name: Create a new droplet
|
- name: Create a new droplet
|
||||||
|
vars:
|
||||||
|
token: "{{ lookup('file', '/srv/secrets-newsblur/keys/digital_ocean.token') | trim }}"
|
||||||
community.digitalocean.digital_ocean_droplet:
|
community.digitalocean.digital_ocean_droplet:
|
||||||
state: present
|
state: present
|
||||||
name: app01
|
name: "{{ name }}"
|
||||||
size: "{{ droplet_size }}"
|
size: "{{ droplet_size }}"
|
||||||
region: "{{ droplet_region }}"
|
region: "{{ droplet_region }}"
|
||||||
image: "{{ droplet_image }}"
|
image: "{{ droplet_image }}"
|
||||||
wait_timeout: 500
|
wait_timeout: 500
|
||||||
ssh_keys: [ "{{ droplet_ssh_key_id }}" ]
|
ssh_keys: [ "{{ droplet_ssh_key_id }}" ]
|
||||||
register: new_box
|
unique_name: true
|
||||||
|
oauth_token: "{{ token }}"
|
||||||
|
register: created_droplet
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
msg: "ID is {{ new_box.data.droplet.id }}, IP is {{ new_box.data.ip_address }}"
|
msg: "ID is {{ created_droplet.data.droplet.id }}, IP is {{ created_droplet.data.ip_address }}"
|
||||||
|
|
||||||
|
- name: "Add to dyanmic inventory under {{ role }}"
|
||||||
|
add_host:
|
||||||
|
name: '{{ created_droplet.data.ip_address }}'
|
||||||
|
group: '{{ role }}'
|
||||||
|
|
||||||
|
- name: Setup user on new machine
|
||||||
|
include_playbook: setup_root.yml
|
||||||
|
|
|
@ -5,9 +5,9 @@ export DISABLE_AUTO_UPDATE=true
|
||||||
|
|
||||||
export WORKON_HOME=/srv/newsblur/venv
|
export WORKON_HOME=/srv/newsblur/venv
|
||||||
export PROJECT_HOME=/srv/newsblur
|
export PROJECT_HOME=/srv/newsblur
|
||||||
source /usr/local/bin/virtualenvwrapper.sh
|
# source /usr/local/bin/virtualenvwrapper.sh
|
||||||
|
|
||||||
plugins=(git github pip virtualenvwrapper)
|
plugins=(git github pip)
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
export PYTHONSTARTUP=$HOME/.pystartup
|
export PYTHONSTARTUP=$HOME/.pystartup
|
||||||
|
|
|
@ -8,7 +8,7 @@ sys.path.append('/srv/newsblur')
|
||||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'newsblur_web.settings'
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'newsblur_web.settings'
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
doapi = digitalocean.Manager(token=settings.DO_TOKEN_LOG)
|
doapi = digitalocean.Manager(token=settings.DO_TOKEN_SSH)
|
||||||
droplets = doapi.get_all_droplets()
|
droplets = doapi.get_all_droplets()
|
||||||
for droplet in droplets:
|
for droplet in droplets:
|
||||||
if sys.argv[1] == droplet.name:
|
if sys.argv[1] == droplet.name:
|
||||||
|
|
|
@ -20,4 +20,4 @@ WHITE='\033[01;37m'
|
||||||
|
|
||||||
ipaddr=`python /srv/newsblur/utils/hostname_ssh.py $1`
|
ipaddr=`python /srv/newsblur/utils/hostname_ssh.py $1`
|
||||||
printf "\n ${BLUE}---> ${LBLUE}Connecting to ${LGREEN}$1${BLUE} / ${LRED}$ipaddr${BLUE} <--- ${RESTORE}\n\n"
|
printf "\n ${BLUE}---> ${LBLUE}Connecting to ${LGREEN}$1${BLUE} / ${LRED}$ipaddr${BLUE} <--- ${RESTORE}\n\n"
|
||||||
ssh -l sclay -i /srv/secrets-newsblur/keys/newsblur.key $ipaddr
|
ssh -l nb -i /srv/secrets-newsblur/keys/docker.key $ipaddr
|
||||||
|
|
Loading…
Add table
Reference in a new issue