Add basic roles

This commit is contained in:
paul 2020-08-10 22:53:13 +02:00
parent b1ebf09cb7
commit 9e76cd40aa
5 changed files with 93 additions and 0 deletions

13
playbook.yml Normal file
View file

@ -0,0 +1,13 @@
---
- hosts: all
gather_facts: false
roles:
- role: python-base
- hosts: all
roles:
- role: common
tags: ['common']
- role: docker
when: docker
tags: ['docker']

View file

@ -0,0 +1,12 @@
---
- name: Install goodies
apt: pkg={{ item }} state=present
with_items:
- apticron
- unattended-upgrades
- htop
- iftop
- iotop
- neovim
- tmux
- git

View file

@ -0,0 +1,7 @@
---
# Docker Compose options.
docker_old_compose_path: /usr/local/bin/docker-compose
# Information about the old repository entry.
docker_apt_release_channel: stable
docker_old_apt_repository: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"

View file

@ -0,0 +1,42 @@
---
- name: Ensure old versions of docker are not installed
package:
name: "{{ item }}"
state: absent
with_items:
- docker
- docker-engine
- docker-ce
- name: Delete old docker-compose version if it's present
file:
path: "{{ docker_old_compose_path }}"
state: absent
- name: old docker apt key is no longer present
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: absent
- name: ensure docker repository is disabled
apt_repository:
repo: "{{ docker_old_apt_repository }}"
state: absent
update_cache: yes
- name: Ensure docker is installed
package:
name: "{{ item }}"
state: present
with_items:
- docker.io
- docker-compose
- name: Ensure docker is started and enabled at boot
service:
name: docker
state: started
enabled: yes

View file

@ -0,0 +1,19 @@
---
# Some of the tasks below use 'raw', as more abstracted tasks such as 'apt'
# or 'shell' require python to be already installed. This can not be
# guaranteed at this point, so we will use raw until we installed all the
# necessary stuff.
# first update the apt cache.
- name: "repositories are up to date"
raw: "apt-get update"
changed_when: False
# install all requirements for ansible
- name: "python is installed"
raw: "apt-get --yes install python python-apt"
changed_when: False
# At this point we can use the extra functionality from the installed
# libraries and no longer need to use 'raw'.
# ----- below this line, everything is allowed :) -----