feat: implement new role layout
This commit is contained in:
parent
b752424086
commit
879be825f9
6 changed files with 6 additions and 134 deletions
|
|
@ -2,25 +2,16 @@
|
|||
|
||||
# gitLab ci stages
|
||||
stages:
|
||||
|
||||
# deployment
|
||||
- "gitleaks"
|
||||
- "linting"
|
||||
- "testing"
|
||||
- "deployment"
|
||||
|
||||
|
||||
# include jobs
|
||||
include:
|
||||
|
||||
# deployment
|
||||
# code plumbing
|
||||
- local: ".gitlab/gitleaks.yaml"
|
||||
- local: ".gitlab/deployment.yaml"
|
||||
|
||||
# linting
|
||||
- component: "$CI_SERVER_FQDN/components/ansible/linting@v3.0.3"
|
||||
- component: "$CI_SERVER_FQDN/components/markdownlint/markdownlint@1.0.0"
|
||||
- component: "$CI_SERVER_FQDN/components/yamllint/yamllint@1.0.2"
|
||||
|
||||
# testing
|
||||
- component: "$CI_SERVER_FQDN/components/ansible/testing@v3.0.3"
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
# deploy ansible/roles/common code
|
||||
deployment:
|
||||
stage: "deployment"
|
||||
image:
|
||||
name: "registry.gitlab.simoncor.net/oci/ssh-client:v25.06.03"
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
rules:
|
||||
|
||||
# run only on push to default branch
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
- when: "never"
|
||||
|
||||
# prepare ssh
|
||||
before_script:
|
||||
|
||||
# prepare ssh
|
||||
- |
|
||||
# prepare ssh
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
echo "$SSH_CONFIG" > ~/.ssh/config
|
||||
echo "$SSH_DEPLOYMENT_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
|
||||
# deployment commands
|
||||
script:
|
||||
|
||||
- |
|
||||
# install ansible roles dependancies
|
||||
ssh $SSH_DEPLOYMENT_USER@$ANSIBLE_SERVER \
|
||||
"sudo /usr/local/bin/ansible-galaxy install -r /etc/ansible/roles/requirements.yaml --force"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
|
||||
- name: "converge"
|
||||
hosts: "all"
|
||||
become: true
|
||||
gather_facts: true
|
||||
roles:
|
||||
- role: "siempie.atuin"
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
---
|
||||
|
||||
dependency:
|
||||
name: "galaxy"
|
||||
|
||||
driver:
|
||||
name: "docker"
|
||||
|
||||
provisioner:
|
||||
name: "ansible"
|
||||
env:
|
||||
MOLECULE_TESTING: "true"
|
||||
|
||||
verifier:
|
||||
name: "ansible"
|
||||
|
||||
platforms:
|
||||
|
||||
# debian 12
|
||||
- name: "debian-12"
|
||||
image: "geerlingguy/docker-debian12-ansible:latest"
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/lib/systemd/systemd"
|
||||
|
||||
# ubuntu 22
|
||||
- name: "ubuntu-22"
|
||||
image: "geerlingguy/docker-ubuntu2204-ansible:latest"
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/lib/systemd/systemd"
|
||||
|
||||
# ubuntu 24
|
||||
- name: "ubuntu-24"
|
||||
image: "geerlingguy/docker-ubuntu2404-ansible:latest"
|
||||
pre_build_image: true
|
||||
privileged: true
|
||||
volumes:
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:rw"
|
||||
command: "/lib/systemd/systemd"
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
|
||||
# verify
|
||||
- name: "verify"
|
||||
hosts: "all"
|
||||
become: true
|
||||
gather_facts: true
|
||||
vars:
|
||||
# renovate: datasource=github-releases depName=atuinsh/atuin versioning=pep440
|
||||
atuin_version: "18.10.0"
|
||||
atuin_binary_path: "/usr/local/bin/atuin"
|
||||
|
||||
tasks:
|
||||
|
||||
# check if atuin binary is installed
|
||||
- name: "check if atuin binary exists"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ atuin_binary_path }}"
|
||||
register: "atuin_binary_stat"
|
||||
|
||||
- name: "fail if atuin binary does not exist"
|
||||
ansible.builtin.fail:
|
||||
msg: "Atuin binary not found at {{ atuin_binary_path }}"
|
||||
when: "not atuin_binary_stat.stat.exists"
|
||||
|
||||
# check atuin version
|
||||
- name: "check current atuin version"
|
||||
ansible.builtin.command: "{{ atuin_binary_path }} -V"
|
||||
register: "atuin_version_check"
|
||||
changed_when: false
|
||||
failed_when: "atuin_version_check.rc != 0"
|
||||
|
||||
- name: "assert atuin version matches expected"
|
||||
ansible.builtin.assert:
|
||||
that: "'{{ atuin_version }}' in atuin_version_check.stdout"
|
||||
fail_msg: "Atuin version ({{ atuin_version_check.stdout }}) does not match ({{ atuin_version }})"
|
||||
success_msg: "Atuin version matches expected ({{ atuin_version }})"
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
- name: "install and configure Atuin Server"
|
||||
hosts: "all"
|
||||
become: true
|
||||
pre_tasks:
|
||||
tasks:
|
||||
|
||||
# due to semaphore bug we need to do this ourselves
|
||||
- name: "force-update requirements"
|
||||
|
|
@ -15,5 +15,7 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
roles:
|
||||
- role: "atuin"
|
||||
# execute the role
|
||||
- name: "execute role: atuin"
|
||||
ansible.builtin.include_role:
|
||||
name: "atuin"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue