Skip to content

Commit

Permalink
Automatic regen with all existing roles
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Arrotin <[email protected]>
  • Loading branch information
arrfab committed Feb 8, 2022
1 parent 1849665 commit e425fbc
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 9 deletions.
13 changes: 5 additions & 8 deletions adhoc-kojid-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
become: True
gather_facts: False

pre_tasks:
- name: removing versionlock plugin
yum:
name: "*"
state: latest
update_cache: True
tasks:
- name: kojid is running
service:
name: kojid
state: restarted

roles:
- kojid

106 changes: 106 additions & 0 deletions adhoc-ocp-create-pv.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
# This playbook is to create a persistent volume for openshift CI namespace
# The node on which we'll run this should have the exported NFS volume mounted locally
# using variables from inventory:
# ocp_nfs_server: (like node.domain)
# ocp_nfs_export: ocp-staging


- hosts: "ocp-ci-management"
become: true
become_user: "{{ ocp_service_account }}"
vars_prompt:
- name: "ocp_project"
prompt: "Existing project/namespace in ocp we'll deploy jenkins to/for (has to exist before !) "
private: no
- name: "pv_name"
prompt: "Reason for PV (computed into uuid) "
private: no
- name: "pv_size"
prompt: "Persistent Volume size (example 10Gi) "
private: no


tasks:
- name: Generate a UUID
set_fact:
pv_uuid: "{{ (ocp_project + pv_claimref|default('noclaimref', true)) + pv_name | to_uuid }}"
tags:
- pv
- nfs

- name: UUID Generated
debug:
var: pv_uuid
tags:
- pv
- nfs

- name: Make a pv name
set_fact:
pv_name: "pv-{{ pv_size | lower }}-{{ pv_uuid }}"
tags:
- pv
- nfs

- name: UUID Generated
debug:
var: pv_name
tags:
- pv
- nfs

- name: See if the PV already exists
command:
cmd: "bin/oc get pv/{{ pv_name }}"
chdir: "/home/{{ ocp_service_account }}"
register: results
changed_when: false
failed_when:
- results.rc == 0
tags:
- pv

- block:
- name: Ensuring we have local mount point
file:
path: /mnt/ocp_store
state: directory

- name: Ensuring nfs export is mounted on mgmt station
mount:
fstype: nfs
src: "{{ ocp_nfs_server }}:{{ ocp_nfs_export }}"
path: /mnt/ocp_store
state: mounted

- name: make directories for each PV
file:
path: "/mnt/ocp_store/{{ pv_name }}"
owner: nobody
group: nobody
mode: 0777
state: directory
become_user: root
tags:
- pv
- nfs

- name: create json files for PV
template:
src: "templates/openshift-pv-storage/persistent-volume.json.j2"
dest: "/home/{{ ocp_service_account }}/pv_configs/{{ pv_name }}.json"
register: pv_init
tags:
- pv

- name: apply the transformation
command:
cmd: "bin/oc create -f pv_configs/{{ pv_name }}.json"
chdir: "/home/{{ ocp_service_account }}"
when: pv_init is changed
tags:
- pv



3 changes: 3 additions & 0 deletions requirements-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
- src: https://github.com/CentOS/ansible-role-certbot
name: certbot
version: staging
- src: https://github.com/CentOS/ansible-role-debuginfod
name: debuginfod
version: staging
- src: https://github.com/CentOS/ansible-role-distgit-lookaside
name: distgit-lookaside
version: staging
Expand Down
2 changes: 2 additions & 0 deletions requirements-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
name: centos-backup
- src: https://github.com/CentOS/ansible-role-certbot
name: certbot
- src: https://github.com/CentOS/ansible-role-debuginfod
name: debuginfod
- src: https://github.com/CentOS/ansible-role-distgit-lookaside
name: distgit-lookaside
- src: https://github.com/CentOS/ansible-role-duffy
Expand Down
3 changes: 3 additions & 0 deletions requirements-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
- src: https://github.com/CentOS/ansible-role-certbot
name: certbot
version: staging
- src: https://github.com/CentOS/ansible-role-debuginfod
name: debuginfod
version: staging
- src: https://github.com/CentOS/ansible-role-distgit-lookaside
name: distgit-lookaside
version: staging
Expand Down
1 change: 1 addition & 0 deletions role-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- import_playbook: role-centbot.yml
- import_playbook: role-centos-backup.yml
- import_playbook: role-certbot.yml
- import_playbook: role-debuginfod.yml
- import_playbook: role-distgit-lookaside.yml
- import_playbook: role-duffy.yml
- import_playbook: role-fedmsg.yml
Expand Down
24 changes: 24 additions & 0 deletions role-debuginfod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- hosts: hostgroup-role-debuginfod
become: True
pre_tasks:
- name: Checking if no-ansible file is there
stat:
path: /etc/no-ansible
register: no_ansible

- name: Verifying if we can run ansible or not
assert:
that:
- "not no_ansible.stat.exists"
msg: "/etc/no-ansible file exists so skipping ansible run on this node"

roles:
- debuginfod

post_tasks:
- name: Touching ansible-run (monitored by Zabbix)
file:
path: /var/log/ansible.run
state: touch

8 changes: 7 additions & 1 deletion templates/convert-stream-8
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
logfile="/var/log/centos-convert-stream.log"
rpm -q centos-stream-repos 2>&1 >/dev/null
if [ "$?" -ne "0" ] ; then
dnf swap -y -d 0 -q centos-linux-repos centos-stream-repos >> $logfile && dnf distro-sync -y -q -d 0 >> $logfile 2>&1
dnf swap -y -d 0 -q centos-linux-repos centos-stream-repos >> $logfile
if [ "$?" -ne "0" ] ;then
rpm -e --nodeps centos-linux-repos >> $logfile 2>&1
rpm -Uvh http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-stream-repos-8-4.el8.noarch.rpm http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-4.el8.noarch.rpm >> $logfile 2>&1
fi
dnf distro-sync -y -q -d 0 >> $logfile 2>&1
fi
if [ "$?" -ne "0" ] ;then
echo "Error converting to Stream 8" >> $logfile
exit 1
Expand Down
2 changes: 2 additions & 0 deletions templates/openshift/jenkins-ci-workspace.env.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DUFFY_API_KEY="{{ duffy_api_key }}"
DUFFY_SSH_KEY="{{ duffy_ssh_key }}"
2 changes: 2 additions & 0 deletions templates/pxeboot.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Merging CI and previous setup so different variables, let's merge
{% if centos_dist is defined %}
{% set centos_version = centos_dist %}
{% set arch = centos_arch %}
{% endif %}
{% if pxe_boot_serial is defined and pxe_boot_serial %}
# Let's setup for Serial console for CI and seamicro (no vga at all)
SERIAL 0 9600
Expand Down

0 comments on commit e425fbc

Please sign in to comment.