feat: add task to attach host to local networks
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2021-03-28 13:02:30 +02:00
parent 10815baadf
commit cc424171f7
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
2 changed files with 25 additions and 5 deletions

View File

@ -22,6 +22,14 @@ hcloud_server_default_ssh_keys: []
# @var hcloud_server_default_api_token: $ "_unset_" # @var hcloud_server_default_api_token: $ "_unset_"
hcloud_server_networks: []
# @var hcloud_server_networks:example: >
# hcloud_server_networks:
# - name: network-1
# ip: 10.0.0.1
# state: present
# @end
hcloud_server_volumes: [] hcloud_server_volumes: []
# @var hcloud_server_volumes:example: > # @var hcloud_server_volumes:example: >
# hcloud_server_volumes: # hcloud_server_volumes:

View File

@ -28,11 +28,23 @@
- name: Populate instance config - name: Populate instance config
set_fact: set_fact:
hcloud_instance: { hcloud_instance:
'instance': "{{ __hcloud_job.hcloud_server.name }}", {
'ipv4': "{{ __hcloud_job.hcloud_server.ipv4_address }}", "instance": "{{ __hcloud_job.hcloud_server.name }}",
'ipv6': "{{ __hcloud_job.hcloud_server.ipv6 }}", "ipv4": "{{ __hcloud_job.hcloud_server.ipv4_address }}",
} "ipv6": "{{ __hcloud_job.hcloud_server.ipv6 }}",
}
delegate_to: localhost
- name: Attach server to local networks
hcloud_server_network:
network: "{{ item.name }}"
server: "{{ hcloud_server.name }}"
ip: "{{ item.ip }}"
state: "{{ item.state | default('present') }}"
loop: "{{ hcloud_server_networks }}"
loop_control:
label: "{{ hcloud_server.name }}:{{ item.name }}"
delegate_to: localhost delegate_to: localhost
- name: Create volumes - name: Create volumes