Add common Ansible role

This commit is contained in:
Joakim Soderlund 2017-05-27 21:44:37 +02:00
parent 47a85ddd70
commit c3dd45ed82
5 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,36 @@
---
#
# Installs upgrades and configures package manager.
#
- name: Upgrade packages
apt:
update_cache: yes
upgrade: dist
register: result
- name: Update GRUB
command: update-grub
environment:
UCF_FORCE_CONFFNEW: YES
when: result | changed
- name: Install Debian utilities
apt:
name: "{{ item }}"
state: present
with_items:
- debconf-utils
- unattended-upgrades
- name: Enable unattended upgrades
debconf:
name: unattended-upgrades
question: unattended-upgrades/enable_auto_updates
vtype: boolean
value: "true"
register: result
- name: Reconfigure unattended upgrades
command: dpkg-reconfigure -f noninteractive unattended-upgrades
when: result | changed

View file

@ -0,0 +1,13 @@
---
#
# Common tasks.
#
- name: Configure packages
include: apt.yml
- name: Configure time
include: time.yml
- name: Configure utilities
include: util.yml

View file

@ -0,0 +1,26 @@
---
#
# Configures time and synchronization.
#
- name: Set timezone to Etc/UTC
file:
src: /usr/share/zoneinfo/Etc/UTC
dest: /etc/timezone
force: yes
state: link
register: result
- name: Reconfigure tzdata
command: dpkg-reconfigure -f noninterractive tzdata
when: result | changed
- name: Install NTP daemon
apt:
name: ntp
state: present
- name: Start NTP daemon
service:
name: ntp
state: started

View file

@ -0,0 +1,15 @@
---
#
# Installs common utilities.
#
- name: Install utilities
apt:
name: "{{ item }}"
state: present
with_items:
- bmon
- htop
- iotop
- screen
- vim

9
operations/tracker.yml Normal file
View file

@ -0,0 +1,9 @@
---
#
# Configures trackers.
#
- name: Tracker
hosts: trackers
roles:
- common