FQCN and simple builder

This commit is contained in:
Louis Abel 2023-08-18 14:23:40 -07:00
parent 2acf41e6b8
commit d1850f1ca9
Signed by: label
GPG key ID: 3331F061D1D9990E
5 changed files with 120 additions and 54 deletions

View file

@ -0,0 +1,66 @@
---
# Basic system configuration. All hardening should also be imported here.
# Use --extra-vars="host=..." and specify a hostname in the inventory or
# provide an ansible host group name. You can also just use "all" if you
# want to ensure all systems are up to date on the configuration.
- name: Setup a simple builder system with mock
hosts: "{{ host }}"
become: true
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- name: Import handleers
ansible.builtin.import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
ansible.builtin.stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
ansible.builtin.assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
tasks:
- name: Install EPEL repository
ansible.builtin.dnf:
name: epel-release
state: present
tags:
- packages
- name: Enable the CRB repository
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
value: 1
owner: root
group: root
mode: '0644'
when: ansible_distribution_major_version|int >= '9'
- name: Install required builder packages
ansible.builtin.dnf:
name:
- bzip2
- glibc-all-langpacks
- htop
- mock
- rpm-build
state: latest
update_cache: false
post_tasks:
- name: Touching run file that ansible has ran here
ansible.builtin.file:
path: /var/log/ansible.run
state: touch
mode: '0644'
owner: root
group: root
...

View file

@ -11,29 +11,29 @@
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- import_tasks: handlers/main.yml
- ansible.builtin.import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
stat:
ansible.builtin.stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
ansible.builtin.assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
- name: Check for keytabs - kojid
stat:
ansible.builtin.stat:
path: /etc/kojid.keytab
register: kojid_keytab_check
changed_when: "1 != 1"
- name: Verify keytab
assert:
ansible.builtin.assert:
that:
- "kojid_keytab_check.stat.exists"
success_msg: "It is likely we have all keytabs"
@ -42,7 +42,7 @@
# EPEL and PowerTools are required for ipsilon to function
# I also couldn't find an ansible built-in to do this
- name: Enable the PowerTools repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/Rocky-PowerTools.repo
section: powertools
option: enabled
@ -53,7 +53,7 @@
when: ansible_distribution_major_version == '8'
- name: Enable the CRB repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
@ -64,14 +64,14 @@
when: ansible_distribution_major_version|int >= '9'
- name: Enable the EPEL repository
yum:
ansible.builtin.dnf:
name: epel-release
state: present
tags:
- packages
- name: Install rocky-tools copr
yum_repository:
ansible.builtin.yum_repository:
name: copr:copr.fedorainfracloud.org:nalika:rockylinux-tool
description: Copr repo for rockylinux-tools owned by nalika
file: copr_repos
@ -90,7 +90,7 @@
post_tasks:
- name: "Setup shared filesystem mount"
import_tasks: tasks/koji_efs.yml
ansible.builtin.import_tasks: tasks/koji_efs.yml
- name: Touching run file that ansible has ran here
file:

View file

@ -11,29 +11,29 @@
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- import_tasks: handlers/main.yml
- ansible.builtin.import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
stat:
ansible.builtin.stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
ansible.builtin.assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
- name: Check for keytabs - kojid
stat:
ansible.builtin.stat:
path: /etc/kojid.keytab
register: kojid_keytab_check
changed_when: "1 != 1"
- name: Verify keytab
assert:
ansible.builtin.assert:
that:
- "kojid_keytab_check.stat.exists"
success_msg: "It is likely we have all keytabs"
@ -42,7 +42,7 @@
# EPEL and PowerTools are required for ipsilon to function
# I also couldn't find an ansible built-in to do this
- name: Enable the PowerTools repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/Rocky-PowerTools.repo
section: powertools
option: enabled
@ -53,7 +53,7 @@
when: ansible_distribution_major_version == '8'
- name: Enable the CRB repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
@ -64,14 +64,14 @@
when: ansible_distribution_major_version|int >= '9'
- name: Enable the EPEL repository
yum:
ansible.builtin.dnf:
name: epel-release
state: present
tags:
- packages
- name: Install rocky-tools copr
yum_repository:
ansible.builtin.yum_repository:
name: copr:copr.fedorainfracloud.org:nalika:rockylinux-tool
description: Copr repo for rockylinux-tools owned by nalika
file: copr_repos
@ -90,7 +90,7 @@
post_tasks:
- name: "Setup shared filesystem mount"
import_tasks: tasks/koji_efs.yml
ansible.builtin.import_tasks: tasks/koji_efs.yml
- name: Touching run file that ansible has ran here
file:

View file

@ -11,47 +11,47 @@
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- import_tasks: handlers/main.yml
- ansible.builtin.import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
stat:
ansible.builtin.stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
ansible.builtin.assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
- name: Check for keytabs - web
stat:
ansible.builtin.stat:
path: /etc/keytabs/koji-web.keytab
register: koji_keytab
changed_when: "1 != 1"
- name: Check for keytabs - kojira
stat:
ansible.builtin.stat:
path: /etc/keytabs/kojira.keytab
register: kojira_keytab
changed_when: "1 != 1"
- name: Check for keytabs - gc
stat:
ansible.builtin.stat:
path: /etc/keytabs/koji-gc.keytab
register: gc_keytab
changed_when: "1 != 1"
- name: Check for keytabs - host
stat:
ansible.builtin.stat:
path: /etc/keytabs/host.keytab
register: host_keytab
changed_when: "1 != 1"
- name: Verify keytab
assert:
ansible.builtin.assert:
that:
- "koji_keytab.stat.exists"
- "kojira_keytab.stat.exists"
@ -63,7 +63,7 @@
# EPEL and PowerTools are required for ipsilon to function
# I also couldn't find an ansible built-in to do this
- name: Enable the PowerTools repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/Rocky-PowerTools.repo
section: powertools
option: enabled
@ -74,7 +74,7 @@
when: ansible_distribution_major_version == '8'
- name: Enable the CRB repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
@ -85,14 +85,14 @@
when: ansible_distribution_major_version|int >= '9'
- name: Enable the EPEL repository
yum:
ansible.builtin.dnf:
name: epel-release
state: present
tags:
- packages
- name: Install rocky-tools copr
yum_repository:
ansible.builtin.yum_repository:
name: copr:copr.fedorainfracloud.org:nalika:rockylinux-tool
description: Copr repo for rockylinux-tools owned by nalika
file: copr_repos
@ -123,7 +123,7 @@
post_tasks:
- name: "Setup shared filesystem mount"
import_tasks: tasks/koji_efs.yml
ansible.builtin.import_tasks: tasks/koji_efs.yml
- name: Touching run file that ansible has ran here
file:

View file

@ -11,47 +11,47 @@
# This is to try to avoid the handler issue in pre/post tasks
handlers:
- import_tasks: handlers/main.yml
- ansible.builtin.import_tasks: handlers/main.yml
pre_tasks:
- name: Check if ansible cannot be run here
stat:
ansible.builtin.stat:
path: /etc/no-ansible
register: no_ansible
- name: Verify if we can run ansible
assert:
ansible.builtin.assert:
that:
- "not no_ansible.stat.exists"
success_msg: "We are able to run on this node"
fail_msg: "/etc/no-ansible exists - skipping run on this node"
- name: Check for keytabs - web
stat:
ansible.builtin.stat:
path: /etc/keytabs/koji-web.keytab
register: koji_keytab
changed_when: "1 != 1"
- name: Check for keytabs - kojira
stat:
ansible.builtin.stat:
path: /etc/keytabs/kojira.keytab
register: kojira_keytab
changed_when: "1 != 1"
- name: Check for keytabs - gc
stat:
ansible.builtin.stat:
path: /etc/keytabs/koji-gc.keytab
register: gc_keytab
changed_when: "1 != 1"
- name: Check for keytabs - host
stat:
ansible.builtin.stat:
path: /etc/keytabs/host.keytab
register: host_keytab
changed_when: "1 != 1"
- name: Verify keytab
assert:
ansible.builtin.assert:
that:
- "koji_keytab.stat.exists"
- "kojira_keytab.stat.exists"
@ -63,7 +63,7 @@
# EPEL and PowerTools are required for ipsilon to function
# I also couldn't find an ansible built-in to do this
- name: Enable the PowerTools repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/Rocky-PowerTools.repo
section: powertools
option: enabled
@ -74,7 +74,7 @@
when: ansible_distribution_major_version == '8'
- name: Enable the CRB repository
ini_file:
community.general.ini_file:
dest: /etc/yum.repos.d/rocky.repo
section: crb
option: enabled
@ -85,14 +85,14 @@
when: ansible_distribution_major_version|int >= '9'
- name: Enable the EPEL repository
yum:
ansible.builtin.dnf:
name: epel-release
state: present
tags:
- packages
- name: Install rocky-tools copr
yum_repository:
ansible.builtin.yum_repository:
name: copr:copr.fedorainfracloud.org:nalika:rockylinux-tool
description: Copr repo for rockylinux-tools owned by nalika
file: copr_repos
@ -123,7 +123,7 @@
post_tasks:
- name: "Setup shared filesystem mount"
import_tasks: tasks/koji_efs.yml
ansible.builtin.import_tasks: tasks/koji_efs.yml
- name: Touching run file that ansible has ran here
file: