diff --git a/applications.yml b/applications.yml index 2a369d7..7915307 100644 --- a/applications.yml +++ b/applications.yml @@ -2,7 +2,7 @@ --- - name: Haproxy Control LB hosts: - - control_lb_nodes + - kubernetes_control_lb roles: - role: haproxy_control_lb tags: diff --git a/dci_hardware.yml b/dci_hardware.yml new file mode 100644 index 0000000..c66546f --- /dev/null +++ b/dci_hardware.yml @@ -0,0 +1,8 @@ +--- + +- name: Execute dci_hostname role + gather_facts: false + hosts: + - talos_hardware_nodes + roles: + - role: dci_hostname diff --git a/hostbill.yml b/hostbill.yml index 9ec0aaf..e76a79f 100644 --- a/hostbill.yml +++ b/hostbill.yml @@ -4,7 +4,7 @@ become: false gather_facts: false hosts: - - control_lb_nodes + - kubernetes_control_lb - talos roles: - role: hostbill_machine_name diff --git a/k8s_services.yml b/k8s_services.yml index 4b673ab..2ed9870 100644 --- a/k8s_services.yml +++ b/k8s_services.yml @@ -45,9 +45,6 @@ - role: k8s_rancher_monitoring tags: - rancher_monitoring - - role: k8s_velero - tags: - - velero - role: k8s_node_problem_detector tags: - k8s_node_problem_detector diff --git a/playbook.yml b/playbook.yml index aa65034..d52fc15 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,4 +1,9 @@ --- +- name: Include dci_hardware.yml + ansible.builtin.import_playbook: dci_hardware.yml + tags: + - dci_hardware + - name: Include playbook hostbill ansible.builtin.import_playbook: hostbill.yml tags: diff --git a/roles/dci_hostname/meta/main.yml b/roles/dci_hostname/meta/main.yml new file mode 100644 index 0000000..393ae22 --- /dev/null +++ b/roles/dci_hostname/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: common + - role: dci_login diff --git a/roles/dci_hostname/tasks/main.yml b/roles/dci_hostname/tasks/main.yml new file mode 100644 index 0000000..6e37668 --- /dev/null +++ b/roles/dci_hostname/tasks/main.yml @@ -0,0 +1,15 @@ +--- + +- name: Set hostname using DCI Manager API + delegate_to: "{{ dci_manager_access_host }}" + become: false + ansible.builtin.uri: + url: "{{ dci_manager_protocol }}://{{ dci_manager_host }}:{{ dci_manager_port }}/dci/v3/server/{{ dci_server_info.id }}" + method: POST + headers: + X-Xsrf-Token: "{{ dci_token }}" + body_format: json + body: "{ \"domain\": \"{{ inventory_hostname }}\" }" + register: _dci_hostname + until: _dci_hostname.status != 503 + changed_when: true diff --git a/roles/haproxy_control_lb/tasks/firewall.yml b/roles/haproxy_control_lb/tasks/firewall.yml index 1f81e31..ea17839 100644 --- a/roles/haproxy_control_lb/tasks/firewall.yml +++ b/roles/haproxy_control_lb/tasks/firewall.yml @@ -15,7 +15,7 @@ rule: allow port: "50000" src: "{{ hostvars[talos_node].ansible_host }}" - loop: "{{ groups['customer_' + cluster_name_short] }}" + loop: "{{ groups['cluster_' + cluster_name_short] }}" loop_control: loop_var: talos_node @@ -24,7 +24,7 @@ rule: allow port: "50001" src: "{{ hostvars[talos_node].ansible_host }}" - loop: "{{ groups['customer_' + cluster_name_short] }}" + loop: "{{ groups['cluster_' + cluster_name_short] }}" loop_control: loop_var: talos_node diff --git a/roles/haproxy_control_lb/templates/haproxy_control_lb.cfg.j2 b/roles/haproxy_control_lb/templates/haproxy_control_lb.cfg.j2 index 9abb754..b55f38b 100644 --- a/roles/haproxy_control_lb/templates/haproxy_control_lb.cfg.j2 +++ b/roles/haproxy_control_lb/templates/haproxy_control_lb.cfg.j2 @@ -7,7 +7,7 @@ frontend tcp_talosapi backend bk_talosapi mode tcp balance leastconn -{% for talos_node in groups['customer_' + cluster_name_short] %} +{% for talos_node in groups['cluster_' + cluster_name_short] %} {% if talos_node in groups['talos_control_nodes'] %} server {{ talos_node }} {{ hostvars[talos_node].ansible_host }}:50000 {% endif %} @@ -24,7 +24,7 @@ frontend tcp_talostrustd backend bk_talostrustd mode tcp balance leastconn -{% for talos_node in groups['customer_' + cluster_name_short] %} +{% for talos_node in groups['cluster_' + cluster_name_short] %} {% if talos_node in groups['talos_control_nodes'] %} server {{ talos_node }} {{ hostvars[talos_node].ansible_host }}:50001 {% endif %} @@ -41,7 +41,7 @@ frontend tcp_kubeapi backend bk_kubeapi mode tcp balance leastconn -{% for talos_node in groups['customer_' + cluster_name_short] %} +{% for talos_node in groups['cluster_' + cluster_name_short] %} {% if talos_node in groups['talos_control_nodes'] %} server {{ talos_node }} {{ hostvars[talos_node].ansible_host }}:6443 check {% endif %} diff --git a/roles/os_debian/tasks/local-ssh.yml b/roles/os_debian/tasks/local-ssh.yml index 2a46125..5e6343b 100644 --- a/roles/os_debian/tasks/local-ssh.yml +++ b/roles/os_debian/tasks/local-ssh.yml @@ -1,5 +1,12 @@ --- +- name: Stat local .ssh/config.d + delegate_to: localhost + ansible.builtin.stat: + path: ~/.ssh/config.d + register: _stat_ssh_configd + - name: Add SSH config on ansible host + when: _stat_ssh_configd.stat.isdir delegate_to: localhost ansible.builtin.copy: dest: ~/.ssh/config.d/{{ inventory_hostname }}.conf