Skip to content

Commit

Permalink
address lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Jun 19, 2024
1 parent 61484ff commit a8fadae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions tasks/load_balancer.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
- name: Create a load balancer
hetzner.hcloud.hcloud_load_balancer:
hetzner.hcloud.load_balancer:
name: "{{ load_balancer.name }}"
load_balancer_type: "{{ load_balancer.type }}"
location: "{{ load_balancer.location | default(hcloud__location) }}"
labels: "{{ load_balancer.labels | default(hcloud__labels) }}"
api_token: "{{ hcloud__api_token }}"

- name: Create load balancer services
hetzner.hcloud.hcloud_load_balancer_service:
hetzner.hcloud.load_balancer_service:
load_balancer: "{{ load_balancer.name }}"
protocol: "{{ service.protocol }}"
listen_port: "{{ service.port }}"
Expand All @@ -22,7 +22,7 @@
loop_var: service

- name: Create load balancer targets
hetzner.hcloud.hcloud_load_balancer_target:
hetzner.hcloud.load_balancer_target:
load_balancer: "{{ load_balancer.name }}"
type: "{{ target.type }}"
ip: "{{ target.ip | default(omit) }}"
Expand Down
22 changes: 11 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
run_once: true

- name: Create placement groups
hetzner.hcloud.hcloud_placement_group:
hetzner.hcloud.placement_group:
name: "{{ item.name }}"
type: "{{ item.type | default('spread') }}"
labels: "{{ item.labels | default(hcloud__labels | default(omit)) }}"
Expand All @@ -16,30 +16,30 @@
run_once: true

- name: Create firewalls
hetzner.hcloud.hcloud_firewall:
hetzner.hcloud.firewall:
name: "{{ item.name }}"
rules: "{{ item.rules | default([]) }}"
api_token: "{{ hcloud__api_token }}"
with_items: "{{ hcloud__firewalls }}"
run_once: true

- name: Ensure SSH key exists
hetzner.hcloud.hcloud_ssh_key:
hetzner.hcloud.ssh_key:
name: "{{ hcloud__ssh_key_name }}"
public_key: "{{ hcloud__ssh_public_key }}"
api_token: "{{ hcloud__api_token }}"
run_once: true

- name: Create networks
hetzner.hcloud.hcloud_network:
hetzner.hcloud.network:
name: "{{ item.name }}"
ip_range: "{{ item.network }}"
api_token: "{{ hcloud__api_token }}"
with_items: "{{ hcloud__networks }}"
run_once: true

- name: Ensure server is created
hetzner.hcloud.hcloud_server:
hetzner.hcloud.server:
name: "{{ hcloud__server_name }}"
server_type: "{{ hcloud__server_type }}"
image: "{{ hcloud__server_image }}"
Expand All @@ -55,7 +55,7 @@
register: server

- name: Ensure volume is created and formatted
hetzner.hcloud.hcloud_volume:
hetzner.hcloud.volume:
name: "{{ item.name }}"
server: "{{ hcloud__server_name }}"
automount: true
Expand All @@ -65,15 +65,15 @@
with_items: "{{ hcloud__server_volumes }}"

- name: Assign server to networks
hetzner.hcloud.hcloud_server_network:
hetzner.hcloud.server_network:
network: "{{ item.name }}"
server: "{{ hcloud__server_name }}"
alias_ips: "{{ item.alias_ips | default(omit) }}"
api_token: "{{ hcloud__api_token }}"
with_items: "{{ hcloud__server_networks }}"

- name: Assign server to load balancer
hetzner.hcloud.hcloud_load_balancer_target:
hetzner.hcloud.load_balancer_target:
type: server
load_balancer: "{{ hcloud__server_loadbalancer_name }}"
server: "{{ hcloud__server_name }}"
Expand All @@ -82,12 +82,12 @@
when: hcloud__server_loadbalancer_name is not none

- name: Show server infos
when: server.hcloud_server.name is defined
when: server.server.name is defined
block:
- name: Show server infos
ansible.builtin.debug:
msg: "Server: {{ server.hcloud_server.name }} --> {{ server.hcloud_server.ipv4_address }}"
msg: "Server: {{ server.server.name }} --> {{ server.server.ipv4_address }}"

- name: Assing default IP to ansible_host
ansible.builtin.set_fact:
ansible_host: "{{ server.hcloud_server.ipv4_address }}"
ansible_host: "{{ server.server.ipv4_address }}"

0 comments on commit a8fadae

Please sign in to comment.