Skip to content

Commit

Permalink
Changes to use Debian OS instead of CentOS 7
Browse files Browse the repository at this point in the history
Changes to use Debian OS for the training VM infrastructure
instead of CentOS 7.
  • Loading branch information
skoranda committed Sep 17, 2021
1 parent a2abb02 commit 3aa0b42
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 64 deletions.
7 changes: 7 additions & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ training_node_user: centos
training_node_device_name: /dev/sda1
training_node_volume_type: gp2
training_node_volume_size: 20

# Docker version
docker_ce_package_version: "5:20.10.5~3-0~debian-buster"
docker_ce_cli_package_version: "5:20.10.5~3-0~debian-buster"
containerd_io_package_version: "1.4.3-1"


14 changes: 7 additions & 7 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: Run yum update to get latest packages
yum:
name: '*'
state: latest
- name: Safe update of packages
ansible.builtin.apt:
upgrade: safe
update_cache: yes

- name: Install convenience packages
yum:
name:
ansible.builtin.apt:
pkg:
- bash-completion
- bind-utils
- bind9-dnsutils
- screen
- vim
state: present
Expand Down
4 changes: 2 additions & 2 deletions roles/common/tasks/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
lineinfile:
dest: /etc/sudoers
state: present
regexp: '^%wheel'
line: '%wheel ALL=(ALL) NOPASSWD: ALL'
regexp: '^%sudo'
line: '%sudo ALL=(ALL) NOPASSWD: ALL'
validate: 'visudo -cf %s'

- name: Trainers unix group
Expand Down
77 changes: 26 additions & 51 deletions roles/swarm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,32 @@
notify:
- reload systemd-journald

- name: Install docker-ce required/recommended packages
yum:
name:
- yum-utils
- device-mapper-persistent-data
- lvm2
- name: Add Docker CE repository key
apt_key:
url: https://download.docker.com/linux/debian/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present

# Off for (at minimum) preventing shibboleth unix domain socket creation
- name: Put SELinux in permissive mode, logging actions that would be blocked.
selinux:
policy: targeted
state: permissive

- name: Add Docker repo
get_url:
url: https://download.docker.com/linux/centos/docker-ce.repo
dest: /etc/yum.repos.d/docker-ce.repo
become: yes
- name: Add Docker CE repository
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable

- name: Install Docker
package:
name: docker-ce
apt:
name: "{{ packages }}"
update_cache: yes
state: present
become: yes
vars:
packages:
- "docker-ce={{ docker_ce_package_version }}"
- "docker-ce-cli={{ docker_ce_cli_package_version }}"
- "containerd.io={{ containerd_io_package_version }}"

- name: Start Docker service
service:
- name: Enable Docker service
systemd:
name: docker
state: started
enabled: yes
become: yes
masked: no

- name: Configure Docker daemon
copy:
Expand All @@ -56,7 +50,6 @@
systemd:
name: docker
state: started
enabled: yes

- name: Add users to Docker group
user:
Expand All @@ -67,35 +60,17 @@
- skoranda
- satkinson

- name: Install bash completion
yum:
name:
- bash-completion
state: present

- name: Configure bash completion for Docker
get_url:
url: https://raw.githubusercontent.com/docker/compose/1.24.1/contrib/completion/bash/docker-compose
dest: /etc/bash_completion.d/docker-compose
mode: '0644'

# Pip installed docker module in python is required for ansible docker_secret action
# on Centos 7
- name: Install epel on swarm node
yum:
name:
- epel-release
state: present
- name: Install Python3 pip
apt:
name: python3-pip
update_cache: no

- name: Install pip on swarm node
yum:
name:
- python2-pip
- name: Install Python3 docker module
pip:
executable: /usr/bin/pip3
name: docker
state: present

- name: Pip install docker python module
command: pip install docker

- name: Initialize single node swarm
community.docker.docker_swarm:
state: present
8 changes: 4 additions & 4 deletions roles/training/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
groups: docker
append: yes

- name: Add training user to wheel group
- name: Add training user to sudo group
user:
name: training
groups: wheel
groups: sudo
append: yes

- name: Install convenience packages
yum:
name:
ansible.builtin.apt:
pkg:
- emacs
- nano
state: present
Expand Down

0 comments on commit 3aa0b42

Please sign in to comment.