From d69fb9268c6a562b9ae4583f0d7d95be353b3115 Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Mon, 11 Dec 2023 21:23:26 +0100 Subject: [PATCH 1/2] Update to use the lates Ansible Equinix module --- scripts/ansible/site.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/ansible/site.yml b/scripts/ansible/site.yml index 7f8f13147..29217f246 100644 --- a/scripts/ansible/site.yml +++ b/scripts/ansible/site.yml @@ -3,27 +3,29 @@ - hosts: localhost tasks: - - equinix.metal.device: - hostnames: [dkron01, dkron02, dkron03] + - equinix.cloud.metal_device: + hostname: "{{ item }}" operating_system: ubuntu_22_04 plan: c3.small.x86 - facility: am6 - wait_for_public_IPv: 4 + metro: am project_id: 904af849-79ff-4847-90f7-dfa02367ae72 tags: - server register: newhosts + loop: + - dkron01 + - dkron02 + - dkron03 - - equinix.metal.device: + - equinix.cloud.metal_device: hostnames: [dkron04] operating_system: ubuntu_22_04 plan: c3.small.x86 - facility: am6 - wait_for_public_IPv: 4 + metro: am project_id: 904af849-79ff-4847-90f7-dfa02367ae72 tags: - agent - register: newhosts + register: anotherhost - debug: var=newhosts @@ -34,7 +36,7 @@ port: 22 state: started timeout: 500 - loop: "{{ newhosts.devices }}" + loop: "{{ newhosts.results }}" - hosts: equinix_metal user: root @@ -42,7 +44,7 @@ become_method: sudo vars: - version: 3.2.2 + version: 3.2.7 datadog_api_key: "{{ lookup('ansible.builtin.env', 'DKRON_DD_API_KEY') }}" datadog_checks: openmetrics: @@ -130,7 +132,7 @@ become_method: sudo vars: - version: 3.2.0 + version: 3.2.7 dkron_log_level: debug dkron_bootstrap_expect: 3 dkron_data_dir: /var/lib/dkron From 17806f7ef40aee446b30d02edddee5c7fb3e55fc Mon Sep 17 00:00:00 2001 From: Victor Castell <0x@vcastellm.xyz> Date: Thu, 4 Jan 2024 00:42:38 +0100 Subject: [PATCH 2/2] Fix ansible --- .../{equinix_metal.yaml => equinix.yaml} | 2 +- scripts/ansible/site.yml | 28 ++++++------------- 2 files changed, 10 insertions(+), 20 deletions(-) rename scripts/ansible/{equinix_metal.yaml => equinix.yaml} (90%) diff --git a/scripts/ansible/equinix_metal.yaml b/scripts/ansible/equinix.yaml similarity index 90% rename from scripts/ansible/equinix_metal.yaml rename to scripts/ansible/equinix.yaml index 26b705f54..2eb7dfefe 100644 --- a/scripts/ansible/equinix_metal.yaml +++ b/scripts/ansible/equinix.yaml @@ -1,5 +1,5 @@ # Minimal example using environment var credentials -plugin: equinix.metal.device +plugin: equinix.cloud.metal_device keyed_groups: # Add hosts to tag_Name groups for each tag diff --git a/scripts/ansible/site.yml b/scripts/ansible/site.yml index 29217f246..403824345 100644 --- a/scripts/ansible/site.yml +++ b/scripts/ansible/site.yml @@ -2,43 +2,33 @@ # Install Dkron beta on a clean instance - hosts: localhost + vars: + project_id: 904af849-79ff-4847-90f7-dfa02367ae72 + tasks: - equinix.cloud.metal_device: hostname: "{{ item }}" operating_system: ubuntu_22_04 plan: c3.small.x86 metro: am - project_id: 904af849-79ff-4847-90f7-dfa02367ae72 + project_id: "{{ project_id }}" tags: - server - register: newhosts loop: - dkron01 - dkron02 - dkron03 - equinix.cloud.metal_device: - hostnames: [dkron04] + hostname: dkron04 operating_system: ubuntu_22_04 plan: c3.small.x86 metro: am - project_id: 904af849-79ff-4847-90f7-dfa02367ae72 + project_id: "{{ project_id }}" tags: - agent - register: anotherhost - - - debug: var=newhosts - - - name: wait for ssh - wait_for: - delay: 1 - host: "{{ item.public_ipv4 }}" - port: 22 - state: started - timeout: 500 - loop: "{{ newhosts.results }}" - -- hosts: equinix_metal + +- hosts: all user: root become: true become_method: sudo @@ -57,7 +47,7 @@ roles: - role: datadog.datadog - become: yes + become: true tags: datadog tasks: