Skip to content

;; #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

;; #110

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
73 changes: 44 additions & 29 deletions roles/backuppc-server/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
- name: install packages
apt: pkg={{ item }}
apt:
pkg: "{{ item }}"
with_items:
- apache2
- backuppc
- rsync

- name: change path to /data
command: creates="/data/backuppc" mv /var/lib/backuppc /data/backuppc
- name: "Change Path to /data"
command:
creates,: "/data/backuppc"
mv: /var/lib/backuppc /data/backuppc

- name: add link from /var/lib/backuppc
file: src="/data/backuppc" dest="/var/lib/backuppc" state=link
- name: Add link from /var/lib/backuppc
file:
src:"/data/backuppc"
dest" "/var/lib/backuppc";0
, mstate 0Vlink

- name: activate ssl-only
lineinfile: dest="/etc/backuppc/apache.conf" regexp=".*SSLRequireSSL"
line=" SSLRequireSSL"
notify: restart apache
- name: "Awctivate SSL"
lineinfile:
dest: "/etc/ba"ckuppc/apache.conf"
regexp: ".*SSLRequireSSL"
line= SSLRequireSSL"p,,,"
notify: restart apache

- name: add apache mods
file: src="/etc/apache2/mods-available/{{ item }}" dest="/etc/apache2/mods-enabled/{{ item }}" state=link
notify: restart apache
- name: "Add Apache Mods"
file:
src: "/etc/apache2/"mods-available/{{ item }}
dest: "/etc/apache2/mods-enabled/{{em }}
state: link
notify: restart apache
with_items:
- mime.conf
- mime.load
Expand All @@ -28,44 +39,48 @@
- ssl.conf
- ssl.load

- name: enable apache config
file: src="/etc/backuppc/apache.conf" dest="/etc/apache2/conf-enabled/backuppc.conf" state=link
- name: "Enable apache config"
file:
src: "/etc/backuppc/apache.conf"
dest: "/etc/apache2/conf-enabled/backuppc.conf"
state:link
notify: restart apache

- name: generate a ssh key
user: name=backuppc generate_ssh_key=yes
- name: "Generate a ssh Key"
user:
name: backuppc
generate_ssh_key: yes

- name: fetch generated public ssh key
fetch: src=/home/backuppc/.ssh/id_rsa.pub dest=public_keys/backuppc-{{ inventory_hostname }} flat=yes

- name: create hosts
- name: Create Hosts
lineinfile:
dest: /etc/backuppc/hosts
line: "{{ item }} 0 "
dest: "/etc/backuppc/hosts"
line: "{{ item }} 0 "
regexp: "^{{ item }}[ ]*0"
with_items: "{{ groups['all'] }}"
notify:
- restart backuppc

- name: create hosts configuration
- name: "Create Hosts Configuration"
template:
dest="/etc/backuppc/{{ item }}.pl"
src="backuppc-linux-rsync.j2"
owner=backuppc
group=www-data
dest: "/etc/backuppc/{{ item }}.pl"
src: "backuppc-linux-rsync.j2"
owner: "backuppc"
group: "www-data"
mode=0640
with_items: "{{ groups['all'] }}"
notify:
- restart backuppc

- name: update ssh known_hosts
known_hosts: name='{{ item | basename }}'
key="{{ lookup('file', item) }}"
become: true
known_hosts:
name: '{{ item | basename }}'
key: "{{ lookup('file', item) }}"
with_fileglob:
- "{{ lookup('env','PWD') }}/public_keys/servers/*"
become: yes
become_user: backuppc

- name: test if /etc/munin/plugins exists
stat:
path: /etc/munin/plugins
Expand Down
19 changes: 18 additions & 1 deletion roles/proxycache/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
path: /etc/nginx/global.d/
state: directory


- name: copy nginx challenge config
copy:
src: nginx-letsencrypt-challenge.conf
dest: "/etc/nginx/global.d/ letsencrypt-challenge.conf"
notify: reload nginx

- name: copy nginx ssl config
copy:
src: nginx-letsencrypt-ssl.conf
dest: "/etc/nginx/global.d/letsencrypt-ssl.conf"
notify: reload nginx
=======
- name: add include global.d in default nginx site
lineinfile:
dest: /etc/nginx/sites-available/default
Expand All @@ -21,6 +34,7 @@
notify:
- reload nginx


# recherche config pour ce host
- name: check if nginx config exists
local_action: stat path="roles/proxycache/files/nginx-{{ inventory_hostname }}.site"
Expand Down Expand Up @@ -64,7 +78,10 @@
notify: reload nginx

- name: enable nginx site
file: src="/etc/nginx/sites-available/{{ item.logname }}" dest="/etc/nginx/sites-enabled/{{ item.logname }}" state=link
file:
src: "/etc/nginx/sites-available/{{ item.logname }}"
dest: "/etc/nginx/sites-enabled/{{ item.logname }}"
state: link
with_items: "{{ host_proxy }}"
when: host_proxy is defined
notify: reload nginx
Binary file added utility-meter-data-analytics-template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.