From 02007578239c48c1684e9da9d70497331ae607f8 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Thu, 12 Jan 2023 15:52:46 +0100 Subject: [PATCH] Automatic regen for new roles Signed-off-by: Fabian Arrotin --- adhoc-node-pdns-modify.yml | 2 +- adhoc-ocp-deploy-jenkins-for-ci-tenant.yml | 4 ++++ requirements-ci.yml | 3 +++ requirements-dev.yml | 3 +++ requirements-production.yml | 3 +++ requirements-staging.yml | 3 +++ role-all.yml | 1 + role-gitlab-runner.yml | 24 ++++++++++++++++++++++ templates/ansible-hostvars.j2 | 10 ++++++--- 9 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 role-gitlab-runner.yml diff --git a/adhoc-node-pdns-modify.yml b/adhoc-node-pdns-modify.yml index 29080e7..fbc2baf 100755 --- a/adhoc-node-pdns-modify.yml +++ b/adhoc-node-pdns-modify.yml @@ -18,7 +18,7 @@ shell: cmd: /var/lib/centos-infra/host-modify -a "{{ pdns_action }}" -n "{{ target }}" chdir: /var/lib/centos-infra - delegate_to: "{{ zabbix_api_srv }}" + delegate_to: "{{ pdns_db_host }}" - name: Reloading directly powerdns zone on pdns nodes command: diff --git a/adhoc-ocp-deploy-jenkins-for-ci-tenant.yml b/adhoc-ocp-deploy-jenkins-for-ci-tenant.yml index ce0c5f1..7db01f9 100644 --- a/adhoc-ocp-deploy-jenkins-for-ci-tenant.yml +++ b/adhoc-ocp-deploy-jenkins-for-ci-tenant.yml @@ -23,10 +23,14 @@ tasks: - set_fact: mgmt_hosts: "{{ ocp_groups[ocp_env] }}" + tags: + - vars - add_host: name: "{{ item }}" groups: ocp_target_host with_items: "{{ groups[mgmt_hosts] }}" + tags: + - vars - hosts: ocp_target_host become: true diff --git a/requirements-ci.yml b/requirements-ci.yml index b5106dd..c598d61 100644 --- a/requirements-ci.yml +++ b/requirements-ci.yml @@ -47,6 +47,9 @@ roles: - src: https://github.com/CentOS/ansible-role-gitea name: gitea version: master + - src: https://github.com/CentOS/ansible-role-gitlab-runner + name: gitlab-runner + version: master - src: https://github.com/CentOS/ansible-role-haproxy name: haproxy version: master diff --git a/requirements-dev.yml b/requirements-dev.yml index 579b906..4f4af95 100644 --- a/requirements-dev.yml +++ b/requirements-dev.yml @@ -47,6 +47,9 @@ roles: - src: https://github.com/CentOS/ansible-role-gitea name: gitea version: staging + - src: https://github.com/CentOS/ansible-role-gitlab-runner + name: gitlab-runner + version: staging - src: https://github.com/CentOS/ansible-role-haproxy name: haproxy version: staging diff --git a/requirements-production.yml b/requirements-production.yml index b5106dd..c598d61 100644 --- a/requirements-production.yml +++ b/requirements-production.yml @@ -47,6 +47,9 @@ roles: - src: https://github.com/CentOS/ansible-role-gitea name: gitea version: master + - src: https://github.com/CentOS/ansible-role-gitlab-runner + name: gitlab-runner + version: master - src: https://github.com/CentOS/ansible-role-haproxy name: haproxy version: master diff --git a/requirements-staging.yml b/requirements-staging.yml index 579b906..4f4af95 100644 --- a/requirements-staging.yml +++ b/requirements-staging.yml @@ -47,6 +47,9 @@ roles: - src: https://github.com/CentOS/ansible-role-gitea name: gitea version: staging + - src: https://github.com/CentOS/ansible-role-gitlab-runner + name: gitlab-runner + version: staging - src: https://github.com/CentOS/ansible-role-haproxy name: haproxy version: staging diff --git a/role-all.yml b/role-all.yml index 4a1f188..f11ec8a 100644 --- a/role-all.yml +++ b/role-all.yml @@ -14,6 +14,7 @@ - import_playbook: role-fedora-messaging-client.yml - import_playbook: role-geoip2.yml - import_playbook: role-gitea.yml +- import_playbook: role-gitlab-runner.yml - import_playbook: role-haproxy.yml - import_playbook: role-httpd.yml - import_playbook: role-httpd-compose.yml diff --git a/role-gitlab-runner.yml b/role-gitlab-runner.yml new file mode 100644 index 0000000..14acee0 --- /dev/null +++ b/role-gitlab-runner.yml @@ -0,0 +1,24 @@ +--- +- hosts: hostgroup-role-gitlab-runner + 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: + - gitlab-runner + + post_tasks: + - name: Touching ansible-run (monitored by Zabbix) + file: + path: /var/log/ansible.run + state: touch + diff --git a/templates/ansible-hostvars.j2 b/templates/ansible-hostvars.j2 index b38c5f1..1dfbd88 100644 --- a/templates/ansible-hostvars.j2 +++ b/templates/ansible-hostvars.j2 @@ -17,12 +17,16 @@ macaddress: {{ ansible_default_ipv4.macaddress | default('')}} dns: {% for ns in ansible_dns.nameservers %} - {{ ns }} -{% endfor %} +{%- endfor %} hardware_vendor: {{ ansible_system_vendor }} product_name: {{ ansible_product_name }} serial_number: {{ ansible_product_serial }} +{% if ansible_bios_vendor == 'Amazon EC2' %} +aws_ec2_instance_id: +aws_ec2_region: +{% else %} root_password: sponsor_name: @@ -33,6 +37,6 @@ sponsor_portal: - user: - password: sponsor_contacts: [] +{% endif %} + -aws_ec2_instance_id: -aws_ec2_region: