diff --git a/playbooks/generic.yml b/playbooks/generic.yml index 45df490a..baf904ad 100644 --- a/playbooks/generic.yml +++ b/playbooks/generic.yml @@ -4,7 +4,7 @@ become: true roles: - pkg_mgmt/pip - - apps/keybase + # - apps/keybase - apps/kubectl - apps/helm - apps/stern diff --git a/playbooks/huawei-lte-setband.yml b/playbooks/huawei-lte-setband.yml index 8b3766ff..a0e83c63 100644 --- a/playbooks/huawei-lte-setband.yml +++ b/playbooks/huawei-lte-setband.yml @@ -7,8 +7,26 @@ - servers/huawei-lte vars: huawei_dynamic_task: "set-net-mode.yml" - huawei_lteband: "80005" - # huawei_lteband: "5" # 1800+2100 + # huawei_lteband: "80000" # 800 + # huawei_lteband: "80" # 900 # huawei_lteband: "4" # 1800 # huawei_lteband: "1" # 2100 + # huawei_lteband: "40" # 2600 + # huawei_lteband: "80005" + # huawei_lteband: "45" # 1800+2100+2600 + huawei_lteband: "80045" # 800+1800+2100+2600 + # huawei_lteband: "80125" + # huawei_lteband: "125" # 900+1800+2100+2600 + # huawei_lteband: "5" # 1800+2100 # huawei_lteband: "7FFFFFFFFFFFFFFF" # all + +# 800 - 7.55/6.38 +# 900 - 3.32/4.57 +# 1800 - 10.77/1.83 +# 2100 - 17.81/1.76 +# 2600 - 14.61/0.00 + +# 45 - 37.12/1.40 +# 125 - 27.64/1.23 +# 80005 - 34.67/1.47 +# 80045 - ~40 diff --git a/roles/servers/apps/home-assistant/templates/config/ui-lovelace.yaml b/roles/servers/apps/home-assistant/templates/config/ui-lovelace.yaml index 1a6ae10a..34118bf5 100644 --- a/roles/servers/apps/home-assistant/templates/config/ui-lovelace.yaml +++ b/roles/servers/apps/home-assistant/templates/config/ui-lovelace.yaml @@ -426,6 +426,8 @@ views: name: Cleaning time - entity: sensor.roborock_s5_max_total_cleaning_time name: Total cleaning time + - type: picture + image_entity: image.roborock_s5_max_dol title: Roborock S5 Max - type: entities entities: diff --git a/roles/servers/apps/jenkins/defaults/main.yml b/roles/servers/apps/jenkins/defaults/main.yml index 401b7b85..3056f958 100644 --- a/roles/servers/apps/jenkins/defaults/main.yml +++ b/roles/servers/apps/jenkins/defaults/main.yml @@ -30,8 +30,11 @@ jjb_password: "{{ jenkins_users | selectattr('name','equalto',jjb_username) | ma jenkins_admin_username: "{{ jjb_username }}" jenkins_admin_password: "{{ jjb_password }}" -jenkins_cleanup: false +jenkins_cleanup: true jenkins_update: false -jenkins_ssh_private_key: "" +jenkins_ssh_private_keys: + - name: servers + value: | + "test" jenkins_git_crypt_key: "" diff --git a/roles/servers/apps/jenkins/templates/Dockerfile b/roles/servers/apps/jenkins/templates/Dockerfile index 60e2445f..b4554774 100644 --- a/roles/servers/apps/jenkins/templates/Dockerfile +++ b/roles/servers/apps/jenkins/templates/Dockerfile @@ -1,5 +1,5 @@ # https://hub.docker.com/r/jenkins/jenkins/tags -FROM jenkins/jenkins:slim-jdk11 +FROM jenkins/jenkins:slim-jdk21 USER root @@ -21,6 +21,7 @@ RUN apt-get update \ git \ libyaml-dev \ sshpass \ + && rm /usr/lib/python3.11/EXTERNALLY-MANAGED \ && pip3 install --no-cache-dir \ # https://pypi.org/project/jenkins-job-builder/ # jenkins-job-builder \ @@ -36,7 +37,42 @@ ARG DOCKER_GID=955 RUN groupadd -g ${DOCKER_GID} docker \ && usermod -a -G docker jenkins -WORKDIR /opt/jjb +WORKDIR /opt/ + +RUN git clone --single-branch --branch feature/pipeline_as_yaml https://github.com/mikeeq/jenkins-job-builder \ + && cd jenkins-job-builder \ + && pip3 install -r requirements.txt \ + && PBR_VERSION=9.9.9 python3 setup.py install + +# # https://github.com/jenkinsci/pipeline-as-yaml-plugin/pull/77 +# ARG MAVEN_VERSION=3.9.6 +# # ARG USER_HOME_DIR="/root" +# ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries + +# RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ +# && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ +# && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ +# && rm -f /tmp/apache-maven.tar.gz \ +# && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn + +# # ENV MAVEN_HOME /usr/share/maven +# # ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2" + +# RUN git clone --single-branch --branch feature/refresh-december-2023 https://github.com/jonesbusy/pipeline-as-yaml-plugin \ +# && cd pipeline-as-yaml-plugin \ +# && mvn package + +# mvn install +# mvn package -Dmaven.test.skip +# mvn package -DskipTests + +# /usr/share/jenkins/ref/plugins/ + +# /opt/pipeline-as-yaml-plugin/target +# -rw-r--r-- 1 root root 6064 Jan 2 16:14 pipeline-as-yaml-0.17-rc-SNAPSHOT.pom +# -rw-r--r-- 1 root root 197163 Jan 2 16:24 pipeline-as-yaml.hpi +# -rw-r--r-- 1 root root 100400 Jan 2 16:24 pipeline-as-yaml.jar + USER jenkins @@ -57,15 +93,9 @@ USER jenkins # RUN jenkins-plugin-cli --plugins "workflow-aggregator:590.v6a_d052e5a_a_b_5 rebuild:1.34 ansicolor:1.0.2 git:4.14.3 linenumbers:1.3 multiple-scms:0.8 pipeline-as-yaml:0.16-rc ws-cleanup:0.44" # linenumbers plugin fails to print json output in ansible, it's merging multiple lines as one -RUN jenkins-plugin-cli --plugins "blueocean workflow-aggregator rebuild ansicolor git multiple-scms pipeline-as-yaml ws-cleanup locale pipeline-multibranch-defaults basic-branch-build-strategies pipeline-stage-view configuration-as-code job-dsl dark-theme git-parameter" +# cloudbees-folder +# timestamper +# build-timeout +RUN jenkins-plugin-cli --plugins "blueocean workflow-aggregator rebuild ansicolor git multiple-scms pipeline-as-yaml:0.17-rc-SNAPSHOT:https://github.com/mikeeq/pipeline-as-yaml-plugin/releases/download/v0.17-rc-SNAPSHOT/pipeline-as-yaml.hpi ws-cleanup locale pipeline-multibranch-defaults basic-branch-build-strategies pipeline-stage-view configuration-as-code job-dsl dark-theme git-parameter conditional-buildstep run-condition theme-manager" # ❯ docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword - -USER root - -RUN git clone --single-branch --branch feature/pipeline_as_yaml https://github.com/mikeeq/jenkins-job-builder \ - && cd jenkins-job-builder \ - && pip3 install -r requirements.txt \ - && PBR_VERSION=9.9.9 python3 setup.py install - -USER jenkins diff --git a/roles/servers/apps/jenkins/templates/casc_configs/jenkins.yml b/roles/servers/apps/jenkins/templates/casc_configs/jenkins.yml index e7384e2d..9f948875 100644 --- a/roles/servers/apps/jenkins/templates/casc_configs/jenkins.yml +++ b/roles/servers/apps/jenkins/templates/casc_configs/jenkins.yml @@ -44,6 +44,8 @@ unclassified: ignoreAcceptLanguage: true location: adminAddress: "mikee@jenkins.local" + +appearance: themeManager: disableUserThemes: true - theme: "dark" + theme: "darkSystem" diff --git a/roles/servers/apps/jenkins/templates/docker-compose.yml b/roles/servers/apps/jenkins/templates/docker-compose.yml index 42dbd654..704345ba 100644 --- a/roles/servers/apps/jenkins/templates/docker-compose.yml +++ b/roles/servers/apps/jenkins/templates/docker-compose.yml @@ -28,7 +28,7 @@ services: environment: TZ: "Europe/Warsaw" CASC_JENKINS_CONFIG: "/var/jenkins_home/casc_configs" - JAVA_OPTS: "-Xmx256m" + JAVA_OPTS: "-Xmx256m -Djenkins.install.runSetupWizard=false" JAVA_ARGS: "-Xmx256m" # CSP - Content Security Policy, overriden to make git-parameter working # JAVA_ARGS: "-Xmx256m -Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=\"default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src data:;\"" @@ -42,3 +42,5 @@ services: options: max-size: "250m" # mkdir -p ./jenkins_home; chown -R 1000:1000 ./jenkins_home + +# ENV JAVA_OPTS "-Djenkins.install.runSetupWizard=false ${JAVA_OPTS:-}" diff --git a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_1800_2100.yml b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_1800_2100.yml deleted file mode 100644 index a3c9d793..00000000 --- a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_1800_2100.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -- job: - name: Huawei LTE band 1800+2100 - project-type: pipeline - sandbox: true - triggers: - - timed: '0 8 * * *' - parameters: - - string: - name: "BRANCH_ANSIBLE_OPS_WORKSTATION" - default: "main" - trim: true - description: "Branch name repo: ansible-ops-workstation" - - string: - name: "BRANCH_ANSIBLE_OPS_PRIVATE" - default: "main" - trim: true - description: "Branch name repo: ansible-ops-private" - - bool: - name: DYNAMIC_SQM_ENABLED - default: true - description: "Enable dynamic SQM on OpenWRT" - - choice: - name: HUAWEI_LTE_BAND - choices: - - "5" - - "7FFFFFFFFFFFFFFF" - - "80005" - - "80000" - - "4" - - "1" - description: "LTE Band: 1800+2100, all, 800+1800+2100, 800, 1800, 2100" - dsl-yaml: | - pipeline: - agent: - any: - options: - - ansiColor('xterm') - - disableConcurrentBuilds() - - skipDefaultCheckout() - stages: - - stage: "Checkout ansible-ops-workstation" - steps: - script: - - dir: "'ansible-ops-workstation'" - script: - - >- - git( - url: "git@github.com:mikeeq/ansible-ops-workstation.git", - branch: "$params.BRANCH_ANSIBLE_OPS_WORKSTATION" - ) - - stage: "Checkout ansible-ops-private" - steps: - script: - - dir: "'ansible-ops-private'" - script: - - >- - git( - url: "git@github.com:mikeeq/ansible-ops-private.git", - branch: "$params.BRANCH_ANSIBLE_OPS_PRIVATE" - ) - - stage: "Unlock git-crypt" - steps: - script: - - dir: "'ansible-ops-private'" - script: - - | - sh """#!/bin/bash - id - pwd - ls - git-crypt unlock ~jenkins/secrets/git_crypt_key - """ - - stage: "Ansible LTE Band set" - steps: - script: - - | - sh """#!/bin/bash - cd ansible-ops-workstation/playbooks - ansible-playbook -e huawei_lteband=$params.HUAWEI_LTE_BAND -i ../../ansible-ops-private/inventory/hosts.yml huawei-lte-setband.yml - """ - - stage: "Ansible SQM disable" - steps: - script: - - | - sh """#!/bin/bash - cd ansible-ops-workstation/playbooks - ansible-playbook -e dynamic_sqm_enabled=$params.DYNAMIC_SQM_ENABLED -i ../../ansible-ops-private/inventory/hosts.yml openwrt-sqm.yml - """ diff --git a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_day.yml b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_day.yml new file mode 100644 index 00000000..c2355c09 --- /dev/null +++ b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_day.yml @@ -0,0 +1,99 @@ +# --- +# - job: +# name: Huawei LTE band 1800+2100 +# project-type: pipeline +# sandbox: true +# # triggers: +# # - timed: '0 8 * * *' +# parameters: +# - string: +# name: "BRANCH_ANSIBLE_OPS_WORKSTATION" +# default: "main" +# trim: true +# description: "Branch name repo: ansible-ops-workstation" +# - string: +# name: "BRANCH_ANSIBLE_OPS_PRIVATE" +# default: "main" +# trim: true +# description: "Branch name repo: ansible-ops-private" +# - bool: +# name: DYNAMIC_SQM_ENABLED +# default: true +# description: "Enable dynamic SQM on OpenWRT" +# - bool: +# name: LOCAL_REPO_RUN +# default: false +# description: "Run from local copy of the repo, disable checkout" +# - choice: +# name: HUAWEI_LTE_BAND +# choices: +# - "5" +# - "7FFFFFFFFFFFFFFF" +# - "80005" +# - "80000" +# - "4" +# - "1" +# description: "LTE Band: 1800+2100, all, 800+1800+2100, 800, 1800, 2100" +# dsl-yaml: | +# pipeline: +# agent: +# any: +# options: +# - ansiColor('xterm') +# - disableConcurrentBuilds() +# - skipDefaultCheckout() +# stages: +# - stage: "Checkout ansible-ops-workstation" +# when: +# expression: +# - "params.LOCAL_REPO_RUN == false" +# steps: +# script: +# - dir: "'ansible-ops-workstation'" +# script: +# - >- +# git( +# url: "git@github.com:mikeeq/ansible-ops-workstation.git", +# branch: "$params.BRANCH_ANSIBLE_OPS_WORKSTATION" +# ) +# - stage: "Checkout ansible-ops-private" +# when: +# expression: +# - "params.LOCAL_REPO_RUN == false" +# steps: +# script: +# - dir: "'ansible-ops-private'" +# script: +# - >- +# git( +# url: "git@github.com:mikeeq/ansible-ops-private.git", +# branch: "$params.BRANCH_ANSIBLE_OPS_PRIVATE" +# ) +# - stage: "Unlock git-crypt" +# steps: +# script: +# - dir: "'ansible-ops-private'" +# script: +# - | +# sh """#!/bin/bash +# id +# pwd +# ls +# git-crypt unlock ~jenkins/secrets/git_crypt_key +# """ +# - stage: "Ansible LTE Band set" +# steps: +# script: +# - | +# sh """#!/bin/bash +# cd ansible-ops-workstation/playbooks +# ansible-playbook -e huawei_lteband=$params.HUAWEI_LTE_BAND -i ../../ansible-ops-private/inventory/hosts.yml huawei-lte-setband.yml +# """ +# - stage: "Ansible SQM disable" +# steps: +# script: +# - | +# sh """#!/bin/bash +# cd ansible-ops-workstation/playbooks +# ansible-playbook -e dynamic_sqm_enabled=$params.DYNAMIC_SQM_ENABLED -i ../../ansible-ops-private/inventory/hosts.yml openwrt-sqm.yml +# """ diff --git a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_800_1800_2100.yml b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_night.yml similarity index 84% rename from roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_800_1800_2100.yml rename to roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_night.yml index 7ec836e7..724d3ab3 100644 --- a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_800_1800_2100.yml +++ b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_lte_band_night.yml @@ -1,10 +1,10 @@ --- - job: - name: Huawei LTE band 800+1800+2100 + name: Huawei LTE band 800+1800+2100+2600 project-type: pipeline sandbox: true - triggers: - - timed: '0 23 * * *' + # triggers: + # - timed: '0 23 * * *' parameters: - string: name: "BRANCH_ANSIBLE_OPS_WORKSTATION" @@ -20,16 +20,21 @@ name: DYNAMIC_SQM_ENABLED default: false description: "Enable dynamic SQM on OpenWRT" + - bool: + name: LOCAL_REPO_RUN + default: false + description: "Run from local copy of the repo, disable checkout" - choice: name: HUAWEI_LTE_BAND choices: + - "80045" - "80005" - "7FFFFFFFFFFFFFFF" - "5" - "80000" - "4" - "1" - description: "LTE Band: 800+1800+2100, all, 1800+2100, 800, 1800, 2100" + description: "LTE Band: 800+1800+2100+2600, 800+1800+2100, all, 1800+2100, 800, 1800, 2100" dsl-yaml: | pipeline: agent: @@ -40,6 +45,9 @@ - skipDefaultCheckout() stages: - stage: "Checkout ansible-ops-workstation" + when: + expression: + - "params.LOCAL_REPO_RUN == false" steps: script: - dir: "'ansible-ops-workstation'" @@ -50,6 +58,9 @@ branch: "$params.BRANCH_ANSIBLE_OPS_WORKSTATION" ) - stage: "Checkout ansible-ops-private" + when: + expression: + - "params.LOCAL_REPO_RUN == false" steps: script: - dir: "'ansible-ops-private'" diff --git a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_restart.yml b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_restart.yml index c0cbf5af..6eaffc6d 100644 --- a/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_restart.yml +++ b/roles/servers/apps/jenkins/templates/jjb/jobs/pipeline_huawei_restart.yml @@ -3,8 +3,8 @@ name: Huawei LTE restart project-type: pipeline sandbox: true - triggers: - - timed: '0 4 * * *' + # triggers: + # - timed: '0 4 * * *' parameters: - string: name: "BRANCH_ANSIBLE_OPS_WORKSTATION" diff --git a/roles/servers/huawei-lte/tasks/main.yml b/roles/servers/huawei-lte/tasks/main.yml index 2bfa4a37..c3df7c1f 100644 --- a/roles/servers/huawei-lte/tasks/main.yml +++ b/roles/servers/huawei-lte/tasks/main.yml @@ -8,6 +8,7 @@ pip: name: "{{ item }}" state: present + ignore_errors: true loop: - xmltodict