diff --git a/hosts b/hosts deleted file mode 100644 index b9b90a1..0000000 --- a/hosts +++ /dev/null @@ -1,109 +0,0 @@ -athena ansible_host=167.71.188.165 -Zeus ansible_host=68.183.50.72 -Hades ansible_host=104.131.0.100 -Atreyu ansible_host=159.65.178.119 -mpdf1 ansible_host=159.203.118.212 -mpdf2 ansible_host=45.55.57.172 -mpdb1 ansible_host=142.93.181.29 -mpdb2 ansible_host=134.209.37.25 - -[ams1] - -[ams2] - -[ams3] - -[blr1] - -[fra1] - -[lon1] - -[nyc1] - -[nyc2] - -[nyc3] -athena -Zeus -Hades -Atreyu -mpdf1 -mpdf2 -mpdb1 -mpdb2 - -[sfo1] - -[sfo2] - -[sfo3] - -[sgp1] - -[tor1] - -[salt_minon] -Hades - -[mpdb] -mpdb1 -mpdb2 - -[consul] -athena -Hades - -[prometheus] -athena - -[matrix] -athena - -[synapse] -athena - -[Saltmaster] -Zeus - -[nextcloud] -Zeus - -[alertmanager] -athena - -[ansible] -athena -Atreyu -mpdf1 -mpdf2 -mpdb1 -mpdb2 - -[www_apache] -Zeus - -[controller] -Atreyu - -[mpdf] -mpdf1 -mpdf2 - -[salt_minion] -athena -Zeus - -[Git] -Zeus - -[Thrace_Test] -mpdb2 -mpdb1 -mpdf2 -mpdf1 -Atreyu -Hades -Zeus -athena - diff --git a/playbooks/digitalocean.yaml b/playbooks/digitalocean.yaml index e173f69..7ec0dc9 100644 --- a/playbooks/digitalocean.yaml +++ b/playbooks/digitalocean.yaml @@ -14,10 +14,7 @@ attributes: - tags - region keyed_groups: - - key: do_region.slug - prefix: 'region' - separator: '_' - - key: do_tags | lower + - key: do_tags | lower prefix: '' separator: '' compose: @@ -27,4 +24,3 @@ compose: distro: do_image.distribution | lower filters: - '"ansible" in do_tags' - - 'do_region.slug == "nyc1"' diff --git a/playbooks/do_hosts.yml b/playbooks/do_hosts.yml new file mode 100644 index 0000000..7ec0dc9 --- /dev/null +++ b/playbooks/do_hosts.yml @@ -0,0 +1,26 @@ +# Using keyed groups and compose for hostvars +plugin: community.digitalocean.digitalocean +api_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}" +attributes: + - id + - name + - memory + - vcpus + - disk + - size + - image + - networks + - volume_ids + - tags + - region +keyed_groups: + - key: do_tags | lower + prefix: '' + separator: '' +compose: + ansible_host: do_networks.v4 | selectattr('type','eq','public') + | map(attribute='ip_address') | first + class: do_size.description | lower + distro: do_image.distribution | lower +filters: + - '"ansible" in do_tags'