ソースを参照

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'

読み込み中…
キャンセル
保存