diff --git a/.dummy_component/code/component_playbook.yaml b/.dummy_component/code/component_playbook.yaml index 264f822c..d87e6465 100644 --- a/.dummy_component/code/component_playbook.yaml +++ b/.dummy_component/code/component_playbook.yaml @@ -86,7 +86,16 @@ ansible.builtin.add_host: hostname: "new_host" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" # While not used by the Jenkins, we included the configuration of a .ssh/config per TN in the Jenkins VM for debugging purposes. diff --git a/.dummy_component/code/one/iac/dummy_component.tf.j2 b/.dummy_component/code/one/iac/dummy_component.tf.j2 index ababca31..13ee00d1 100644 --- a/.dummy_component/code/one/iac/dummy_component.tf.j2 +++ b/.dummy_component/code/one/iac/dummy_component.tf.j2 @@ -12,7 +12,7 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" } {# ### Disabled the possibility to modify VM's size due to a problem with Terraform's OpenNebula Provider diff --git a/.global/cac/load_variables.yaml b/.global/cac/load_variables.yaml index 64a2119f..e73d8664 100644 --- a/.global/cac/load_variables.yaml +++ b/.global/cac/load_variables.yaml @@ -16,3 +16,7 @@ - name: Load public component-specific variables from input file ansible.builtin.include_vars: file: "{{ workspace }}/{{ component_type }}/variables/input_file.yaml" + +- name: Set Jenkins SSH public key from local file + ansible.builtin.set_fact: + jenkins_ssh_public_key: "{{ lookup('file', '/var/lib/jenkins/.ssh/id_ed25519.pub') }}" diff --git a/.global/cac/s3_download.yaml b/.global/cac/s3_download.yaml index 942c5132..9e41d19d 100644 --- a/.global/cac/s3_download.yaml +++ b/.global/cac/s3_download.yaml @@ -1,3 +1,12 @@ +- name: Ensure S3 bucket exists + amazon.aws.s3_bucket: + name: "{{ site_s3_server.bucket }}" + state: present + endpoint_url: "{{ site_s3_server.endpoint }}" + access_key: "{{ lookup('ansible.builtin.env', 'AWS_ACCESS_KEY_ID') }}" + secret_key: "{{ lookup('ansible.builtin.env', 'AWS_SECRET_ACCESS_KEY') }}" + validate_certs: false + - name: Get list of files from S3 object storage amazon.aws.s3_object: endpoint_url: "{{ site_s3_server.endpoint }}" diff --git a/.global/cac/tn_destroy.yaml b/.global/cac/tn_destroy.yaml index 028c8e8f..a084f2f8 100644 --- a/.global/cac/tn_destroy.yaml +++ b/.global/cac/tn_destroy.yaml @@ -32,6 +32,43 @@ state: "present" force_init: true ignore_errors: true + register: first_apply_result + + # The OpenNebula terraform provider can hard-error on refresh/plan when an + # opennebula_virtual_network_address_range's AR was already removed from OpenNebula + # (e.g. destroyed as a side effect of the first, ignored apply above) but the AR + # resource itself is still tracked in state. Drop just those stale AR entries so the + # retry below can proceed instead of failing again with "AR not found". + - name: Dump current terraform state as JSON to detect stale Address Ranges + ansible.builtin.command: + cmd: terraform show -json + chdir: "{{ workspace }}/.terraform/" + register: tf_state_dump + changed_when: false + + # Matches both observed OpenNebula provider error phrasings for a stale AR: + # "Virtual network (ID:X): AR (ID:Y) not found" + # "Virtual network (ID:X): AR (ID:Y): OpenNebula error [INTERNAL]: [one.vn.free_ar] Address Range does not exist" + - name: Identify OpenNebula Virtual Network IDs reported as having a missing Address Range + ansible.builtin.set_fact: + stale_ar_vnet_ids: "{{ (first_apply_result.msg | default('')) | regex_findall('Virtual network \\(ID:(\\d+)\\): AR \\(ID:\\d+\\)') }}" + + # virtual_network_id may be tracked as an int or a string depending on provider + # version, while stale_ar_vnet_ids (from regex_findall) is always a list of strings; + # cast explicitly per-item in the `when` below so the comparison isn't silently + # type-mismatched (a selectattr('..., 'in', ...) pipeline can't cast inline). + - name: Remove stale Address Range entries from terraform state so the retry can proceed + ansible.builtin.command: + cmd: "terraform state rm {{ item.address }}" + chdir: "{{ workspace }}/.terraform/" + loop: "{{ (tf_state_dump.stdout | from_json)['values']['root_module']['resources'] | default([]) }}" + loop_control: + label: "{{ item.address }}" + when: >- + stale_ar_vnet_ids | length > 0 and + item.type == 'opennebula_virtual_network_address_range' and + (item['values']['virtual_network_id'] | string) in stale_ar_vnet_ids + ignore_errors: true - name: Run 'terraform apply' a second time. Command should now succeed community.general.terraform: diff --git a/elcm/code/component_playbook.yaml b/elcm/code/component_playbook.yaml index 4b0066e3..c3d95523 100644 --- a/elcm/code/component_playbook.yaml +++ b/elcm/code/component_playbook.yaml @@ -70,7 +70,16 @@ ansible.builtin.add_host: hostname: "elcm" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -87,7 +96,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/elcm/code/one/iac/elcm.tf.j2 b/elcm/code/one/iac/elcm.tf.j2 index 12ab2f27..ae2cbf26 100644 --- a/elcm/code/one/iac/elcm.tf.j2 +++ b/elcm/code/one/iac/elcm.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_ELCM_PORTAL_ENABLE = "YES" ONEAPP_ELCM_INFLUXDB_ENABLE = "YES" ONEAPP_ELCM_INFLUXDB_HOST = "{{ influxdb_configuration.host }}" diff --git a/grafana/code/component_playbook.yaml b/grafana/code/component_playbook.yaml index 35a47e69..5752fbf7 100644 --- a/grafana/code/component_playbook.yaml +++ b/grafana/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "grafana" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -67,7 +76,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/grafana/code/one/iac/grafana.tf.j2 b/grafana/code/one/iac/grafana.tf.j2 index 8e206c74..e531a41d 100644 --- a/grafana/code/one/iac/grafana.tf.j2 +++ b/grafana/code/one/iac/grafana.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_GRAFANA_VERSION = "{{ one_grafana_version }}" ONEAPP_GRAFANA_ADMIN_PASSWORD = "{{ one_grafana_password }}" } diff --git a/influxdb/code/component_playbook.yaml b/influxdb/code/component_playbook.yaml index a92eb3a1..b534ef4e 100644 --- a/influxdb/code/component_playbook.yaml +++ b/influxdb/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "influxdb" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -67,7 +76,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/influxdb/code/one/iac/influxdb.tf.j2 b/influxdb/code/one/iac/influxdb.tf.j2 index 719341b5..935ef03d 100644 --- a/influxdb/code/one/iac/influxdb.tf.j2 +++ b/influxdb/code/one/iac/influxdb.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_INFLUXDB_VERSION = "{{ one_influxdb_version }}" ONEAPP_INFLUXDB_USER = "{{ one_influxdb_user }}" ONEAPP_INFLUXDB_PASSWORD = "{{ one_influxdb_password }}" diff --git a/int_p4_sw/code/component_playbook.yaml b/int_p4_sw/code/component_playbook.yaml index 5e5decec..ad6affa1 100644 --- a/int_p4_sw/code/component_playbook.yaml +++ b/int_p4_sw/code/component_playbook.yaml @@ -56,7 +56,16 @@ ansible.builtin.add_host: hostname: "int_p4_switch_{{ item.key }}" ansible_host: "{{ item.value[switch_first_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" loop: "{{ switch_ips | dict2items }}" @@ -65,7 +74,16 @@ ansible.builtin.add_host: hostname: "int_p4_collector" ansible_host: "{{ collector_ips[collector_first_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -81,7 +99,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/int_p4_sw/code/one/iac/int_collector_p4_sw.tf.j2 b/int_p4_sw/code/one/iac/int_collector_p4_sw.tf.j2 index 6685114c..a0c1062b 100644 --- a/int_p4_sw/code/one/iac/int_collector_p4_sw.tf.j2 +++ b/int_p4_sw/code/one/iac/int_collector_p4_sw.tf.j2 @@ -10,7 +10,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}_collector" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {# ### Disabled the possibility to modify VM's size due to a problem with Terraform's OpenNebula Provider diff --git a/int_p4_sw/code/one/iac/int_switch_p4_sw.tf.j2 b/int_p4_sw/code/one/iac/int_switch_p4_sw.tf.j2 index 550bbb84..6011e350 100644 --- a/int_p4_sw/code/one/iac/int_switch_p4_sw.tf.j2 +++ b/int_p4_sw/code/one/iac/int_switch_p4_sw.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}_{{ switch_index }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {% for network in switch_config.networks %} diff --git a/ixc_endpoint/code/component_playbook.yaml b/ixc_endpoint/code/component_playbook.yaml index 9c263941..68135947 100644 --- a/ixc_endpoint/code/component_playbook.yaml +++ b/ixc_endpoint/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "endpoint" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add the bastion to Ansible Inventory @@ -73,7 +82,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/ixc_endpoint/code/one/iac/ixc_endpoint.tf.j2 b/ixc_endpoint/code/one/iac/ixc_endpoint.tf.j2 index 613a80a6..1e810119 100644 --- a/ixc_endpoint/code/one/iac/ixc_endpoint.tf.j2 +++ b/ixc_endpoint/code/one/iac/ixc_endpoint.tf.j2 @@ -9,7 +9,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_IXCHARIOT_ENDPOINT_RS_ADDRESS = "{{ one_ixc_endpoint_rs }}" } diff --git a/ks8500_runner/code/component_playbook.yaml b/ks8500_runner/code/component_playbook.yaml index 2ba5c717..271a4274 100644 --- a/ks8500_runner/code/component_playbook.yaml +++ b/ks8500_runner/code/component_playbook.yaml @@ -40,7 +40,16 @@ ansible.builtin.add_host: hostname: "ks8500runner" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add tn_bastion to Ansible Inventory @@ -80,7 +89,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Load enviromental variables from different sources ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml" diff --git a/ks8500_runner/code/one/iac/ks8500_runner.tf.j2 b/ks8500_runner/code/one/iac/ks8500_runner.tf.j2 index 3d1612c2..0348800f 100644 --- a/ks8500_runner/code/one/iac/ks8500_runner.tf.j2 +++ b/ks8500_runner/code/one/iac/ks8500_runner.tf.j2 @@ -13,9 +13,9 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { SET_HOSTNAME: "$NAME" USERNAME: "jenkins" PASSWORD: "keysight" - SSH_PUBLIC_KEY: "$USER[SSH_PUBLIC_KEY]" - # install apt install python3 -y; growpart /dev/vda 1; resize2fs /dev/vda1 - START_SCRIPT_BASE64: "IyEvYmluL2Jhc2gKZ3Jvd3BhcnQgL2Rldi92ZGEgMQpyZXNpemUyZnMgL2Rldi92ZGExCmFwdCBpbnN0YWxsIHB5dGhvbjMgLXk=" + SSH_PUBLIC_KEY: "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot; then growpart + resize2fs + apt install python3 + START_SCRIPT_BASE64: "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCmdyb3dwYXJ0IC9kZXYvdmRhIDEKcmVzaXplMmZzIC9kZXYvdmRhMQphcHQgaW5zdGFsbCBweXRob24zIC15Cg==" } # Ignore changes in the disk argument due to limitations in the OpenNebula Terraform provider (#598) diff --git a/loadcore_agent/code/component_playbook.yaml b/loadcore_agent/code/component_playbook.yaml index 20507494..5e60e25f 100644 --- a/loadcore_agent/code/component_playbook.yaml +++ b/loadcore_agent/code/component_playbook.yaml @@ -53,7 +53,16 @@ ansible.builtin.add_host: hostname: "loadcore_agent" ansible_host: "{{ ips[access_vnet_id][0] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add tn_bastion to Ansible Inventory @@ -76,7 +85,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Load enviromental variables from different sources ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml" diff --git a/loadcore_agent/code/one/iac/loadcore_agent.tf.j2 b/loadcore_agent/code/one/iac/loadcore_agent.tf.j2 index 550ad193..0a21c769 100644 --- a/loadcore_agent/code/one/iac/loadcore_agent.tf.j2 +++ b/loadcore_agent/code/one/iac/loadcore_agent.tf.j2 @@ -12,8 +12,9 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" - START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKZ3Jvd3BhcnQgL2Rldi92ZGEgMQpyZXNpemUyZnMgL2Rldi92ZGEx" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot; then growpart + resize2fs + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCmdyb3dwYXJ0IC9kZXYvdmRhIDEKcmVzaXplMmZzIC9kZXYvdmRhMQo=" } # Ignore changes in the disk argument due to limitations in the OpenNebula Terraform provider (#598) diff --git a/mongodb/code/component_playbook.yaml b/mongodb/code/component_playbook.yaml index 201e255f..6ba8b2e1 100644 --- a/mongodb/code/component_playbook.yaml +++ b/mongodb/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "mongodb" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -64,7 +73,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/mongodb/code/one/iac/mongodb.tf.j2 b/mongodb/code/one/iac/mongodb.tf.j2 index 4b001df2..682ef9be 100644 --- a/mongodb/code/one/iac/mongodb.tf.j2 +++ b/mongodb/code/one/iac/mongodb.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_MONGODB_VERSION = "{{ one_mongodb_version }}" ONEAPP_MONGODB_USER = "{{ one_mongodb_user }}" ONEAPP_MONGODB_PASSWORD = "{{ one_mongodb_password }}" diff --git a/monitoring/code/component_playbook.yaml b/monitoring/code/component_playbook.yaml index 853b63fa..7463760b 100644 --- a/monitoring/code/component_playbook.yaml +++ b/monitoring/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "monitoring" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -64,7 +73,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/monitoring/code/one/iac/monitoring.tf.j2 b/monitoring/code/one/iac/monitoring.tf.j2 index d87e650d..cf6b9dcc 100644 --- a/monitoring/code/one/iac/monitoring.tf.j2 +++ b/monitoring/code/one/iac/monitoring.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_INFLUXDB_VERSION = "{{ one_influxdb_version }}" ONEAPP_INFLUXDB_USER = "{{ one_influxdb_user }}" ONEAPP_INFLUXDB_PASSWORD = "{{ one_influxdb_password }}" diff --git a/oneKE/code/component_playbook.yaml b/oneKE/code/component_playbook.yaml index e839927c..6e0be3cb 100644 --- a/oneKE/code/component_playbook.yaml +++ b/oneKE/code/component_playbook.yaml @@ -61,12 +61,20 @@ # For some weird reason, idempotency with this tool gives rc=255, but syntax errors give rc=0... - name: Resize the disk reserved for Longhorn in the storage VMs - ansible.builtin.shell: > - /usr/bin/onevm - disk-resize {{ item }} 1 30G - --user {{ lookup('ansible.builtin.env', 'OPENNEBULA_USERNAME') }} - --password {{ lookup('ansible.builtin.env', 'OPENNEBULA_PASSWORD') }} - --endpoint {{ lookup('ansible.builtin.env', 'OPENNEBULA_ENDPOINT') }} + ansible.builtin.shell: | + ruby - "{{ item }}" <<'RUBY' + require 'opennebula' + + auth = "#{ENV.fetch('OPENNEBULA_USERNAME')}:#{ENV.fetch('OPENNEBULA_PASSWORD')}" + client = OpenNebula::Client.new(auth, ENV.fetch('OPENNEBULA_ENDPOINT')) + vm = OpenNebula::VirtualMachine.new_with_id(Integer(ARGV.fetch(0)), client) + rc = vm.disk_resize(1, 30 * 1024) + + if OpenNebula.is_error?(rc) + warn rc.message + exit 255 + end + RUBY register: disk_resize failed_when: > (disk_resize.rc != 0 and 'must be larger' not in disk_resize.stderr) or @@ -101,7 +109,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/open5gcore_vm/code/component_playbook.yaml b/open5gcore_vm/code/component_playbook.yaml index e56ce7e9..6c39e0fa 100644 --- a/open5gcore_vm/code/component_playbook.yaml +++ b/open5gcore_vm/code/component_playbook.yaml @@ -80,7 +80,16 @@ ansible.builtin.add_host: hostname: "open5gcore_vm" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -94,7 +103,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Load enviromental variables from different sources ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml" diff --git a/open5gcore_vm/code/one/iac/open5gcore_vm.tf.j2 b/open5gcore_vm/code/one/iac/open5gcore_vm.tf.j2 index 0f1f1edc..8ecf83db 100644 --- a/open5gcore_vm/code/one/iac/open5gcore_vm.tf.j2 +++ b/open5gcore_vm/code/one/iac/open5gcore_vm.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {# ### Disabled the possibility to modify VM's size due to a problem with Terraform's OpenNebula Provider diff --git a/open5gs_vm/.tnlcm/public.yaml b/open5gs_vm/.tnlcm/public.yaml index 2395dd11..51adf384 100644 --- a/open5gs_vm/.tnlcm/public.yaml +++ b/open5gs_vm/.tnlcm/public.yaml @@ -19,7 +19,7 @@ metadata: short_description: Deploys a Open5GS as a standalone Virtual Machine long_description: | Deploys a Open5GS over a general-purpose Virtual Machine based on Ubuntu 22.04 lTS. - The automation is installing Open5GS version 2.7.6 and MongoDB on it. + The automation is installing Open5GS version 2.8.0 and MongoDB on it. Through variable "one_open5gs_vm_size", five different types of instances can be deployed - **extra_large**: 32 GiB of memory, 8 vCPU and 100GiB of storage - **large**: 16 GiB of memory, 4 vCPU and 50GiB of storage diff --git a/open5gs_vm/README.md b/open5gs_vm/README.md index 67fb264f..b69f4f83 100644 --- a/open5gs_vm/README.md +++ b/open5gs_vm/README.md @@ -2,7 +2,7 @@ The **open5gs_vm** 6G-Library component deploys a 5G SA Core inside an Ubuntu VM using scripts. Current versions: -- Open5GS v2.7.6 +- Open5GS v2.8.0 > [!NOTE] > The VM needs a CPU architecture with the vmx instructions set. @@ -54,7 +54,7 @@ Deploys a Open5GS as a standalone Virtual Machine ## Long Description Deploys a Open5GS over a general-purpose Virtual Machine based on Ubuntu 22.04 LTS. -The automation installs Open5GS version 2.7.6 and MongoDB on it. +The automation installs Open5GS version 2.8.0 and MongoDB on it. Through variable `one_open5gs_vm_size`, five different types of instances can be deployed: - **extra_large**: 32 GiB of memory, 8 vCPU and 100GiB of storage diff --git a/open5gs_vm/code/component_playbook.yaml b/open5gs_vm/code/component_playbook.yaml index d7601569..45b1a39f 100644 --- a/open5gs_vm/code/component_playbook.yaml +++ b/open5gs_vm/code/component_playbook.yaml @@ -69,7 +69,17 @@ ansible.builtin.add_host: hostname: "open5gs_vm" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -S none + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -83,14 +93,74 @@ hosts: "open5gs_vm" gather_facts: false tasks: + - name: Remove stale SSH ControlMaster socket left by previous builds + ansible.builtin.file: + path: "/tmp/ansible-ssh-{{ ansible_host }}-22-{{ ansible_user }}" + state: absent + delegate_to: localhost + vars: + ansible_connection: local + - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 1800 + + - name: Mask apt automation to prevent sshd restarts during configuration + ansible.builtin.shell: | + systemctl mask --now \ + unattended-upgrades \ + apt-daily.service \ + apt-daily-upgrade.service \ + apt-daily.timer \ + apt-daily-upgrade.timer \ + 2>/dev/null || true + echo '$nrconf{restart} = "l";' > /etc/needrestart/conf.d/00-ansible.conf 2>/dev/null || true + printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d + fuser -k /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock 2>/dev/null || true + sleep 2 + dpkg --configure -a 2>/dev/null || true + rm -f /usr/sbin/policy-rc.d + become: true + ignore_unreachable: true + ignore_errors: true + + - name: Wait for SSH to stabilize after stopping unattended-upgrades + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 300 - name: Load enviromental variables from different sources ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml" + - name: Wait for SSH to stabilize before first remote task + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 600 + ignore_unreachable: true + ignore_errors: true + + - name: Confirm SSH is stable before first remote task + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 300 + + - name: Wait for cloud-init to complete so sshd is no longer restarted + ansible.builtin.command: + cmd: cloud-init status --wait + changed_when: false + ignore_unreachable: true + ignore_errors: true + + - name: Wait for SSH to stabilize after cloud-init + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 300 + - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: user: jenkins diff --git a/open5gs_vm/code/one/cac/02_install/install_open5gs.yml b/open5gs_vm/code/one/cac/02_install/install_open5gs.yml index 0e1638dc..4ed69af5 100644 --- a/open5gs_vm/code/one/cac/02_install/install_open5gs.yml +++ b/open5gs_vm/code/one/cac/02_install/install_open5gs.yml @@ -2,6 +2,41 @@ - name: Run every task as root user become: true block: + - name: Release dpkg lock and suppress apt automation for the install + ansible.builtin.shell: | + systemctl mask --now \ + unattended-upgrades \ + apt-daily.service \ + apt-daily-upgrade.service \ + apt-daily.timer \ + apt-daily-upgrade.timer \ + 2>/dev/null || true + echo '$nrconf{restart} = "l";' > /etc/needrestart/conf.d/00-ansible.conf 2>/dev/null || true + printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d && chmod +x /usr/sbin/policy-rc.d + fuser -k /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock /var/cache/apt/archives/lock 2>/dev/null || true + sleep 2 + dpkg --configure -a 2>/dev/null || true + rm -f /usr/sbin/policy-rc.d + changed_when: false + failed_when: false + ignore_unreachable: true + + - name: Wait for SSH to recover after dpkg configure + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 600 + become: false + ignore_unreachable: true + ignore_errors: true + + - name: Confirm SSH is stable after dpkg configure + ansible.builtin.wait_for_connection: + connect_timeout: 5 + delay: 5 + timeout: 300 + become: false + - name: Render netplan aliases ansible.builtin.template: src: "{{ workspace }}/{{ component_type }}/code/{{ site_hypervisor }}/cac/02_install/templates/99-netplan-aliases.yaml.j2" @@ -16,6 +51,13 @@ changed_when: false when: netplan_changed.changed + - name: Wait for SSH to recover after netplan apply + ansible.builtin.wait_for_connection: + connect_timeout: 5 + timeout: 120 + become: false + when: netplan_changed.changed + - name: Install MongoDB 6 block: - name: Import MongoDB 6 public key @@ -41,9 +83,10 @@ repo: 'ppa:open5gs/latest' state: present - - name: Install Open5GS 2.7.6~* + - name: Install Open5GS 2.8.0~* ansible.builtin.apt: - name: open5gs=2.7.6~* + name: open5gs=2.8.0~* + update_cache: yes state: present when: not one_open5gs_vm_use_nightly diff --git a/open5gs_vm/code/one/iac/open5gs_vm.tf.j2 b/open5gs_vm/code/one/iac/open5gs_vm.tf.j2 index aad0dc56..d04e95eb 100644 --- a/open5gs_vm/code/one/iac/open5gs_vm.tf.j2 +++ b/open5gs_vm/code/one/iac/open5gs_vm.tf.j2 @@ -8,11 +8,14 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { memory = {{ one_open5gs_vm_memory }} context = { - NETWORK = "YES" - NETCFG_TYPE = "interfaces" - SET_HOSTNAME = "$NAME" - USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + NETWORK = "YES" + NETCFG_TYPE = "interfaces" + SET_HOSTNAME = "$NAME" + USERNAME = "jenkins" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {# ### Disabled the possibility to modify VM's size due to a problem with Terraform's OpenNebula Provider diff --git a/open5gs_vm/result_templates/ok_result.md.j2 b/open5gs_vm/result_templates/ok_result.md.j2 index 2817b028..d53190c3 100644 --- a/open5gs_vm/result_templates/ok_result.md.j2 +++ b/open5gs_vm/result_templates/ok_result.md.j2 @@ -25,7 +25,7 @@ Deployed Open5GS includes the following 5G Core components: If you need detailed information about Open5GS you can visit the official documentation: https://open5gs.org/open5gs/docs/guide/01-quickstart/ Current versions: -- Open5GS `v2.7.6` +- Open5GS `v2.8.0` - Ubuntu 22.04 ## Important information diff --git a/opensand_gw/code/component_playbook.yaml b/opensand_gw/code/component_playbook.yaml index 135fc867..1e0a2997 100644 --- a/opensand_gw/code/component_playbook.yaml +++ b/opensand_gw/code/component_playbook.yaml @@ -40,7 +40,16 @@ ansible.builtin.add_host: hostname: "opensand_gw" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -54,7 +63,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user diff --git a/opensand_gw/code/one/iac/opensand_gw.tf.j2 b/opensand_gw/code/one/iac/opensand_gw.tf.j2 index fb8ab4f9..0db173a8 100644 --- a/opensand_gw/code/one/iac/opensand_gw.tf.j2 +++ b/opensand_gw/code/one/iac/opensand_gw.tf.j2 @@ -14,7 +14,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } diff --git a/opensand_sat/code/component_playbook.yaml b/opensand_sat/code/component_playbook.yaml index b937d1c1..2395e0e4 100644 --- a/opensand_sat/code/component_playbook.yaml +++ b/opensand_sat/code/component_playbook.yaml @@ -40,7 +40,16 @@ ansible.builtin.add_host: hostname: opensand_sat ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -54,7 +63,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/opensand_sat/code/one/iac/opensand_sat.tf.j2 b/opensand_sat/code/one/iac/opensand_sat.tf.j2 index ee2e7089..615282ef 100644 --- a/opensand_sat/code/one/iac/opensand_sat.tf.j2 +++ b/opensand_sat/code/one/iac/opensand_sat.tf.j2 @@ -14,7 +14,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } diff --git a/opensand_st/code/component_playbook.yaml b/opensand_st/code/component_playbook.yaml index 1df534b6..9fba22ef 100644 --- a/opensand_st/code/component_playbook.yaml +++ b/opensand_st/code/component_playbook.yaml @@ -40,7 +40,16 @@ ansible.builtin.add_host: hostname: opensand_st ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -54,7 +63,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/opensand_st/code/one/iac/opensand_st.tf.j2 b/opensand_st/code/one/iac/opensand_st.tf.j2 index dab9ac2e..0b30befc 100644 --- a/opensand_st/code/one/iac/opensand_st.tf.j2 +++ b/opensand_st/code/one/iac/opensand_st.tf.j2 @@ -14,7 +14,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } diff --git a/prometheus/code/component_playbook.yaml b/prometheus/code/component_playbook.yaml index 325527ce..06f0d01a 100644 --- a/prometheus/code/component_playbook.yaml +++ b/prometheus/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "prometheus" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -67,7 +76,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/prometheus/code/one/iac/prometheus.tf.j2 b/prometheus/code/one/iac/prometheus.tf.j2 index 6f0ba291..db0983b9 100644 --- a/prometheus/code/one/iac/prometheus.tf.j2 +++ b/prometheus/code/one/iac/prometheus.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_PROMETHEUS_VERSION = "{{ one_prometheus_version }}" } diff --git a/qosium_probe/code/component_playbook.yaml b/qosium_probe/code/component_playbook.yaml index b5be3f95..a74a2303 100644 --- a/qosium_probe/code/component_playbook.yaml +++ b/qosium_probe/code/component_playbook.yaml @@ -54,7 +54,16 @@ ansible.builtin.add_host: hostname: "qosium_probe" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -72,7 +81,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Load enviromental variables from different sources ansible.builtin.include_tasks: "{{ workspace }}/.global/cac/load_variables.yaml" diff --git a/qosium_probe/code/one/iac/qosium_probe.tf.j2 b/qosium_probe/code/one/iac/qosium_probe.tf.j2 index a013ec16..e790131e 100644 --- a/qosium_probe/code/one/iac/qosium_probe.tf.j2 +++ b/qosium_probe/code/one/iac/qosium_probe.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE= "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {# ### Disabled the possibility to modify VM's size due to a Terraform OpenNebula Provider's error diff --git a/tn_bastion/code/component_playbook.yaml b/tn_bastion/code/component_playbook.yaml index 6b8e1391..7e7e775c 100644 --- a/tn_bastion/code/component_playbook.yaml +++ b/tn_bastion/code/component_playbook.yaml @@ -56,7 +56,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Wait again until one-appliance contextualization scripts have finished become: true diff --git a/tn_bastion/code/one/iac/tn_bastion.tf.j2 b/tn_bastion/code/one/iac/tn_bastion.tf.j2 index 3476ee61..d23645b4 100644 --- a/tn_bastion/code/one/iac/tn_bastion.tf.j2 +++ b/tn_bastion/code/one/iac/tn_bastion.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "tn_bastion" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" TOKEN = "YES" ONEAPP_BASTION_DNS_PASSWORD = "" ONEAPP_BASTION_DNS_FORWARDERS = "{{ site_dns | default('8.8.8.8,1.1.1.1') }}" diff --git a/tn_init/code/component_playbook.yaml b/tn_init/code/component_playbook.yaml index 8a48cf12..83903847 100644 --- a/tn_init/code/component_playbook.yaml +++ b/tn_init/code/component_playbook.yaml @@ -56,7 +56,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Wait again until one-appliance contextualization scripts have finished become: true diff --git a/ueransim/code/component_playbook.yaml b/ueransim/code/component_playbook.yaml index 4dbed220..cb250760 100644 --- a/ueransim/code/component_playbook.yaml +++ b/ueransim/code/component_playbook.yaml @@ -53,7 +53,16 @@ ansible.builtin.add_host: hostname: "ueransim" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -70,7 +79,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Wait again until one-appliance contextualization scripts have finished become: true diff --git a/ueransim/code/one/iac/ueransim.tf.j2 b/ueransim/code/one/iac/ueransim.tf.j2 index 31c30cba..a527eadd 100644 --- a/ueransim/code/one/iac/ueransim.tf.j2 +++ b/ueransim/code/one/iac/ueransim.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" {% if one_ueransim_mode in ['gnb', 'both'] %} ONEAPP_UERANSIM_RUN_GNB = "{% if one_ueransim_run_gnb %}YES{% else %}NO{% endif %}" ONEAPP_UERANSIM_GNB_AMF_IP = "{{ one_ueransim_gnb_amf_n2_ip }}" diff --git a/ueransim/sample-la-mayora.yaml b/ueransim/sample-la-mayora.yaml new file mode 100644 index 00000000..040e103a --- /dev/null +++ b/ueransim/sample-la-mayora.yaml @@ -0,0 +1,38 @@ +trial_network: + tn_init: + type: "tn_init" + dependencies: [] + input: {} + vnet-n2: + type: "vnet" + name: "n2" + dependencies: + - "tn_init" + input: + one_vnet_first_ip: "10.10.10.1" + one_vnet_netmask: 24 + one_vnet_address_size: 100 + open5gs_vm-core: + type: "open5gs_vm" + name: "core" + dependencies: + - "vnet-n2" + input: + one_open5gs_vm_external_vnet: "tn_vxlan" + one_open5gs_vm_internal_vnet: + - "vnet-n2" + one_open5gs_vm_size: "small" + one_open5gs_vm_ue_subnet: "10.45.0.0/16" + one_open5gs_vm_amf_n2_ip: "10.10.10.200" + one_open5gs_vm_upf_n3_ip: "10.10.10.201" + one_open5gs_vm_s_nssai_sd: "000009" + ueransim-both: + type: "ueransim" + name: "both" + dependencies: + - "open5gs_vm-core" + input: + one_ueransim_networks: + - "tn_vxlan" + one_ueransim_mode: "both" + one_ueransim_gnb_linked_5gcore: "open5gs_vm-core" \ No newline at end of file diff --git a/upf_p4_sw/code/component_playbook.yaml b/upf_p4_sw/code/component_playbook.yaml index dc33dfb7..7bc7ef86 100644 --- a/upf_p4_sw/code/component_playbook.yaml +++ b/upf_p4_sw/code/component_playbook.yaml @@ -59,7 +59,16 @@ ansible.builtin.add_host: hostname: "upf_p4_sw" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Display host inventory information @@ -85,7 +94,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/upf_p4_sw/code/one/iac/upf_p4_sw.tf.j2 b/upf_p4_sw/code/one/iac/upf_p4_sw.tf.j2 index e101d0ab..2363cdf5 100644 --- a/upf_p4_sw/code/one/iac/upf_p4_sw.tf.j2 +++ b/upf_p4_sw/code/one/iac/upf_p4_sw.tf.j2 @@ -10,7 +10,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {% for network in one_upf_p4_sw_networks %} diff --git a/vm_kvm/code/component_playbook.yaml b/vm_kvm/code/component_playbook.yaml index ff61aed2..9cf9826e 100644 --- a/vm_kvm/code/component_playbook.yaml +++ b/vm_kvm/code/component_playbook.yaml @@ -53,7 +53,16 @@ ansible.builtin.add_host: hostname: "vm_kvm" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add new VM to SSH config file in the Jenkins-master for debugging purposes @@ -70,7 +79,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/vm_kvm/code/one/iac/vm_kvm.tf.j2 b/vm_kvm/code/one/iac/vm_kvm.tf.j2 index f91d78a0..bf489204 100644 --- a/vm_kvm/code/one/iac/vm_kvm.tf.j2 +++ b/vm_kvm/code/one/iac/vm_kvm.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" } {# ### Disabled the possibility to modify VM's size due to a problem with Terraform's OpenNebula Provider diff --git a/xrext/code/component_playbook.yaml b/xrext/code/component_playbook.yaml index e0f302ea..d0630cb2 100644 --- a/xrext/code/component_playbook.yaml +++ b/xrext/code/component_playbook.yaml @@ -50,7 +50,16 @@ ansible.builtin.add_host: hostname: "xrext" ansible_host: "{{ ips[access_vnet_id] }}" - ansible_ssh_common_args: "-J jenkins@{{ bastion_ip }}" + ansible_ssh_common_args: >- + -F /dev/null + -o ControlMaster=no + -o ServerAliveInterval=30 + -o ServerAliveCountMax=10 + -o ProxyCommand="ssh -i /var/lib/jenkins/.ssh/id_ed25519 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o KexAlgorithms=curve25519-sha256 -o BatchMode=yes -o ServerAliveInterval=30 -o ServerAliveCountMax=10 jenkins@{{ bastion_ip }} nc %h %p" + -o IdentityFile=/var/lib/jenkins/.ssh/id_ed25519 + -o KexAlgorithms=curve25519-sha256 + -o StrictHostKeyChecking=no + -o UserKnownHostsFile=/dev/null ansible_user: "jenkins" - name: Add the bastion to Ansible Inventory @@ -73,7 +82,7 @@ - name: Wait for system to become reachable ansible.builtin.wait_for_connection: connect_timeout: 5 - timeout: 200 + timeout: 600 - name: Set site ssh key as authorized in jenkins user ansible.posix.authorized_key: diff --git a/xrext/code/one/iac/xrext.tf.j2 b/xrext/code/one/iac/xrext.tf.j2 index cb1da15e..852fc413 100644 --- a/xrext/code/one/iac/xrext.tf.j2 +++ b/xrext/code/one/iac/xrext.tf.j2 @@ -12,7 +12,10 @@ resource "opennebula_virtual_machine" "{{ entity_name }}" { NETCFG_TYPE = "interfaces" SET_HOSTNAME = "$NAME" USERNAME = "jenkins" - SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" + SSH_PUBLIC_KEY = "{{ jenkins_ssh_public_key }}" + # Disable unattended-upgrades at first boot to prevent sshd restarts during Ansible provisioning + # Script: systemctl stop/mask unattended-upgrades apt-daily-upgrade apt-daily and their timers and their timers + START_SCRIPT_BASE64 = "IyEvYmluL2Jhc2gKc3lzdGVtY3RsIHN0b3AgdW5hdHRlbmRlZC11cGdyYWRlcyBhcHQtZGFpbHktdXBncmFkZSBhcHQtZGFpbHkgMj4vZGV2L251bGwgfHwgdHJ1ZQpzeXN0ZW1jdGwgbWFzayB1bmF0dGVuZGVkLXVwZ3JhZGVzIGFwdC1kYWlseS11cGdyYWRlIGFwdC1kYWlseSAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBzdG9wIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCnN5c3RlbWN0bCBtYXNrIGFwdC1kYWlseS50aW1lciBhcHQtZGFpbHktdXBncmFkZS50aW1lciAyPi9kZXYvbnVsbCB8fCB0cnVlCg==" ONEAPP_XR_CAPIF_API_NAME = "{{ one_xr_capif_api_name }}" ONEAPP_XR_CAPIF_HTTPS_HOST = "{{ one_xr_capif_https_host }}" ONEAPP_XR_CAPIF_HTTPS_PORT = "{{ one_xr_capif_https_port }}"