Skip to content

Commit

Permalink
Use roles from collection, add ubuntu 22.04 and various fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
amolofos committed Dec 18, 2022
1 parent 12f435a commit 6d3c665
Show file tree
Hide file tree
Showing 124 changed files with 485 additions and 2,227 deletions.
2 changes: 2 additions & 0 deletions ansible/.ansible-lint → .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ warn_list:
- skip_this_tag
- git-latest
- experimental # experimental is included in the implicit list
- yaml[commas]
- yaml[line-length]
# - role-name

# Offline mode disables installation of requirements.yml
Expand Down
37 changes: 31 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ on:

jobs:

test:
name: Test on docker
test_end_to_end:
name: Test on various OSes

runs-on: ubuntu-latest

runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
os: ["ubuntu-20.04", 'ubuntu-22.04']
python: ["python3.7", "python3.8", "python3.9", "python3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -37,5 +40,27 @@ jobs:
GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Build
run: ./docker-entrypoint.sh
echo "REPOSITORY=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
- name: Build docker image
run: >
docker build \
-t automation:${{ matrix.os }} \
-f docker/Dockerfile.${{ matrix.os }} \
.
- name: End to end test using locally checkedout code
run: >
docker run automation:${{ matrix.os }} \
-e GIT_BRANCH=$GIT_BRANCH \
-e REPOSITORY=$REPOSITORY \
-e PYTHON_VERSION=${{ matrix.python }}
- name: End to end test with code fetch from remote
run: >
docker run automation:${{ matrix.os }} \
-e GIT_BRANCH=$GIT_BRANCH \
-e REPOSITORY=$REPOSITORY \
-e PYTHON_VERSION=${{ matrix.python }} \
rm -f "/opt/automated-workstation/app/scripts/add-cronjob-debian.sh";
/opt/docker/docker-entrypoint.sh
2 changes: 2 additions & 0 deletions ansible/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Ansible
.ansibleFactsCacheDir/*
*.retry
14 changes: 14 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

extends: default

rules:
braces:
max-spaces-inside: -1

commas:
# Disable check for space after commas so that we can align our values visually.
max-spaces-after: -1

line-length:
max: 160
1 change: 0 additions & 1 deletion Dockerfile

This file was deleted.

78 changes: 0 additions & 78 deletions Dockerfile.fullBuild

This file was deleted.

63 changes: 0 additions & 63 deletions Dockerfile.noIntegrationTests

This file was deleted.

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
run:
./scripts/one-time-debian.sh
./scripts/scheduled-debian.sh

lint:
. ./.venv/bin/activate
ansible-lint -c .ansible-lint

prepare_env:
python3.9 -m venv .venv && \
. ./.venv/bin/activate && \
pip install --upgrade \
pip \
ansible \
ansible-lint \
yamllint
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Overview

This is an effort to provide scripts to setup my workstation in an automated, reproducible way.
This is an effort to provide scripts to setup my workstation in an automated, reproducible way. The scripts are meant to be generic and parameterised based on the provided group_vars.

## Status
[![ubuntu-ci status](https://github.com/amolofos/automated-workstation-setup/workflows/ubuntu-ci/badge.svg)](https://github.com/amolofos/automated-workstation-setup/actions)
Expand Down
9 changes: 0 additions & 9 deletions ansible/00-add-cronjob.yml

This file was deleted.

15 changes: 0 additions & 15 deletions ansible/01-provision-all.yml

This file was deleted.

7 changes: 4 additions & 3 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ gathering = smart
#inject_facts_as_vars = True

# Paths to search for collections, colon separated
# collections_paths = ~/.ansible/collections:/usr/share/ansible/collections
#collections_paths = ~/.ansible/collections:/usr/share/ansible/collections
collections_paths = ./collections:~/.ansible/collections

# Paths to search for roles, colon separated
#roles_path = ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
roles_path = ./roles
roles_path = ./roles:~/.ansible/roles

# Host key checking is enabled by default
#host_key_checking = True
Expand All @@ -86,7 +87,7 @@ roles_path = ./roles
#
# Enable callback plugins, they can output to stdout but cannot be 'stdout' type.
#callback_whitelist = timer, mail
callback_whitelist = profile_tasks
callbacks_enabled = profile_tasks

# Determine whether includes in tasks and handlers are "static" by
# default. As of 2.0, includes are dynamic by default. Setting these
Expand Down
10 changes: 9 additions & 1 deletion ansible/group_vars/all/software-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ software:
- python3.9-dev
- python3.9-distutils
- python3.9-venv
- python3.10
- python3.10-dev
- python3.10-distutils
- python3.10-venv
- python3-apt
- python3-pip
media:
Expand All @@ -189,7 +193,7 @@ software:
- xmltodict
- yamllint

# Each command should output "Changed" to stdout so the task reports it as changed.
# Each command should output "Changed" to stdout so the task reports it as changed. yaml[line-length]
custom:
# Should we create a role to install the latest go version?
- "if [ ! -d /usr/local/go ] || [ \"`/usr/local/go/bin/go version | grep go1.17 | wc -l`\" -eq 0 ]; then sudo rm -rf /usr/local/go && wget --quiet https://dl.google.com/go/go1.17.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local; echo Changed; fi"
Expand All @@ -211,6 +215,10 @@ software:
path: "/usr/bin/python3.8"
link: "/usr/bin/python"
priority: 1000
- name: "python"
path: "/usr/bin/python3.9"
link: "/usr/bin/python"
priority: 1000
- name: "vi"
path: "/usr/bin/nvim"
link: "/bin/vi"
Expand Down
2 changes: 1 addition & 1 deletion ansible/inventory/workstation/workstation_inventory
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
localhost ansible_host=127.0.0.1 ansible_connection=local

[workstation:vars]
ansible_python_interpreter=/usr/bin/python3.8
ansible_python_interpreter=/usr/bin/python3
10 changes: 10 additions & 0 deletions ansible/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

collections:

- community.docker

- name: amolofos.ansible_collection_workstation
type: git
source: "https://github.com/amolofos/ansible_collection_workstation.git"
version: "feature/re-structure"
18 changes: 0 additions & 18 deletions ansible/roles/admin_cronjob/defaults/main.yml

This file was deleted.

26 changes: 0 additions & 26 deletions ansible/roles/admin_cronjob/tasks/debian.yml

This file was deleted.

5 changes: 0 additions & 5 deletions ansible/roles/admin_cronjob/tasks/main.yml

This file was deleted.

Loading

0 comments on commit 6d3c665

Please sign in to comment.