add first playbooks

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-03-18 16:44:43 +01:00
parent b8678698a1
commit 8fc5149369
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 89 additions and 0 deletions

21
ansible/bootstrap.yml Normal file
View File

@ -0,0 +1,21 @@
---
#
# This playbook configures most basic things about the hosts:
#
# - Admin and Additional users
# - Disables root login
# - Installs Common packages
# - Starts Consul client agent
#
# This is run on every newly provisioned host.
#
- name: Bootstrap Python support for Ansible
gather_facts: False
hosts: all
roles:
- infra-role-bootstrap/raw
- name: Bootstrap admin users and Consul
hosts: all
roles:
- infra-role-bootstrap

42
ansible/cleanup.yml Normal file
View File

@ -0,0 +1,42 @@
- name: Cleanup to regain disk space
hosts: all
tasks:
- name: Save available space
set_fact:
free_before: '{{ ansible_mounts | selectattr("mount", "equalto", "/") | map(attribute="size_available") | first }}'
- name: Clean apt packages
apt:
autoremove: true
purge: true
- name: Uninstall snapd
apt:
name: snapd
state: absent
- name: Remove snapd files
file:
path: '/var/lib/snapd'
state: absent
- name: Remove logs older than 1 day
command: journalctl --vacuum-time=1d
- name: Remove log gzipped archives
shell: 'rm -f /var/log/*.gz /var/log/docker/*/*.gz'
- name: Remove old backups
shell: 'rm -f /var/tmp/backups/*/*'
- name: Gather space info
setup:
gather_subset: 'hardware'
- name: Save available space
set_fact:
free_after: '{{ ansible_mounts | selectattr("mount", "equalto", "/") | map(attribute="size_available") | first }}'
- name: Show space recovered
debug:
msg: '~ {{ ((free_after|int - free_before|int)/(1024*1024)) | round | int }} MB'

14
ansible/main.yml Normal file
View File

@ -0,0 +1,14 @@
---
- name: Configure faucet proxy
hosts: faucet-master
roles:
- role: origin-cert
tags: origin-cert
- role: faucet-proxy
tags: faucet-proxy
- name: Configure faucet miners
hosts: faucet-miners
roles:
- role: geth-miner
tags: geth-miner

12
ansible/upgrade.yml Normal file
View File

@ -0,0 +1,12 @@
- name: Update and upgrade apt packages
gather_facts: false
hosts: all
tasks:
- name: Upgrade packages
apt:
upgrade: yes
update_cache: yes
cache_valid_time: 86400 #One day
- name: Remove unused packages
apt:
autoremove: yes