Переглянути джерело

installed the do ansible inventory command into the delete and create ansible script, since the actualy inventory plugin does not fucking work

master
Erin Sims 2 роки тому
джерело
коміт
4d77b60ce4
4 змінених файлів з 5 додано та 53 видалено
  1. +2
    -0
      playbooks/create_droplet.yml
  2. +3
    -1
      playbooks/delete_droplet.yml
  3. +0
    -26
      playbooks/digitalocean.yaml
  4. +0
    -26
      playbooks/do_hosts.yml

+ 2
- 0
playbooks/create_droplet.yml Переглянути файл

@@ -102,6 +102,8 @@
destinations:
addresses: ["0.0.0.0/0", "::/0"]
tags: ["mpdb"]
- name: update inventory
ansible.builtin.command: "do-ansible-inventory --access-token {{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }} > /etc/ansible/hosts"
- name: mpdb
ansible.builtin.import_playbook: mpdb.yaml
- name: mpdf


+ 3
- 1
playbooks/delete_droplet.yml Переглянути файл

@@ -42,4 +42,6 @@
- 'mpdb'
register: deleted_droplets
loop: "{{ range(1,count|int + 1) }}"
- name: update inventory
ansible.builtin.command: "do-ansible-inventory --access-token {{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }} > /etc/ansible/hosts"


+ 0
- 26
playbooks/digitalocean.yaml Переглянути файл

@@ -1,26 +0,0 @@
# 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'

+ 0
- 26
playbooks/do_hosts.yml Переглянути файл

@@ -1,26 +0,0 @@
# 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'

Завантаження…
Відмінити
Зберегти