Skip to content
Snippets Groups Projects
Commit f2c35ec6 authored by enricostano's avatar enricostano
Browse files

:package:

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 147 additions and 0 deletions
*.retry
---
- hosts: coopdevs.org
remote_user: ubuntu
become: yes
roles:
- common
- http-server
- coopdevs.org
# Network configuration
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDd7rIoyQTYu9+H0qBpajZRp2rbj27MRdhGNizjw2kxywa4ss+Req5k9sDtxwOd8ptEyLSfS4ToJdba+aXtUhE/hi/1nuZZdj1aYget9zXVncStU5p5yfMXELc8onTE5OyKdhisAbmUG6UcwjJnmvpBd3F8DTpDlAcw425xJYljVmsb8zDOjsxQ3aikYHo452lmXikOip7ejuif71zmAJ7rsSvS8IQGLXOmUXHm8ycchdkPdB9eAPJuiaPhkhta7MILPzqr1HMIRBEE5Hy6RR88LRqfaRgg0YCqwTGFyp8WzuMiu+xDP75KOU+v3fxaVRu5SLvvdNtPsxG5UjQpzBal enrico@archlap
---
- name: Create sites directory
file: path=/opt/sites state=directory group=coopdevs owner=ubuntu mode=2775
- name: Create Git bare repositories directory
file: path=/home/ubuntu/repos state=directory group=coopdevs owner=ubuntu mode=2775
---
- name: Create `coopdevs` group
group:
name: coopdevs
state: present
---
- name: Install Bundler gem
gem:
name: bundler
state: latest
user_install: no
- name: Install Jekyll gem
gem:
name: jekyll
state: latest
user_install: no
---
- name: Install common packages
apt:
name: '{{ item }}'
state: present
update_cache: yes
with_items:
- 'build-essential'
- 'ca-certificates'
- 'git'
---
- include: groups.yml
- include: users.yml
- include: ssh_keys.yml
- include: install_packages.yml
- include: ruby.yml
- include: install_gems.yml
- include: secrets.yml
---
- name: Add BrightBox ruby ppa
apt_repository: repo=ppa:brightbox/ruby-ng state=present
- name: Install BrightBox ruby 2.3 package
apt:
name: "{{item}}"
state: present
with_items:
- 'software-properties-common'
- 'ruby2.3'
- 'ruby2.3-dev'
---
- name: Write coopdevs.org secrets
template:
src: secret_coopdevs.j2
dest: /etc/default/coopdevs
group: coopdevs
mode: 0640
---
- name: Add SSH keys to `ubuntu` user
authorized_key:
user: ubuntu
key: '{{ item }}'
with_file:
- public_keys/enrico
---
- name: Write bash_profile for `ubuntu` user
template:
src: bash_profile
dest: /home/ubuntu/.bash_profile
group: ubuntu
mode: 0644
- name: Add `ubuntu` user to `coopdevs` group
user:
name: ubuntu
groups: coopdevs
group: ubuntu
shell: /bin/bash
append: yes
. /etc/default/coopdevs
export SECRET_KEY_BASE=kaka
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name coopdevs.org www.coopdevs.org;
root /opt/sites/coopdevs;
index index.html;
expires 1d;
}
#!/bin/bash -l
GIT_REPO=$HOME/repos/coopdevs.github.io.git
TMP_GIT_CLONE=$HOME/tmp/git/coopdevs.github.io
PUBLIC_WWW=/opt/sites/coopdevs
git clone $GIT_REPO $TMP_GIT_CLONE
jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
---
- name: Reload NGINX
service:
name: nginx
state: reloaded
---
- name: Create site directory
file: path=/opt/sites/coopdevs state=directory group=coopdevs owner=ubuntu mode=2775
---
- include: file_system.yml
- name: Clone coopdevs Git bare repository
git:
repo: https://github.com/coopdevs/coopdevs.github.io
dest: /home/ubuntu/repos/coopdevs.github.io.git
bare: yes
- name: Copy Git hook
copy:
src: roles/coopdevs.org/files/post-receive
dest: /home/ubuntu/repos/coopdevs.github.io.git/hooks/post-receive
mode: 'u+x'
- name: Write coopdevs NGINX configuration
copy:
src: roles/coopdevs.org/files/coopdevs.conf
dest: /etc/nginx/sites-enabled/coopdevs.conf
notify: Reload NGINX
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment