infra/roles/inventory/tasks/main.yml

44 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2018-10-02 09:12:23 +03:00
---
- name: generate ssh_config for bootstrap
template: src=ssh_config-bootstrap dest=.tmp/ssh_config
delegate_to: localhost
when: bootstrap is defined
- name: generate ssh_config for bootstrap
template: src=ssh_config-bootstrap dest=".tmp/ssh_config-{{stack.name}}"
delegate_to: localhost
when: bootstrap is defined
- name: generate ssh_config
template: src=ssh_config dest=.tmp/ssh_config
delegate_to: localhost
when: bootstrap is not defined
- name: generate ssh_config
template: src=ssh_config dest=".tmp/ssh_config-{{stack.name}}"
delegate_to: localhost
when: bootstrap is not defined
2023-02-21 15:14:32 +03:00
- name: populate dynamic inventory
2018-10-02 09:12:23 +03:00
add_host:
name: "{{tmp_node}}"
groups: "{{['stack'] + tmp_node|get_steps(stack.apps)}}"
ansible_ssh_host: "{{tmp_node}}.{{stack.domain}}"
ansible_ssh_port: 22
with_items: "{{stack.nodes}}"
loop_control:
loop_var: tmp_node
changed_when: false
2023-02-21 15:14:32 +03:00
- name: save inventory to file
2018-10-02 09:12:23 +03:00
template:
src: ansible_hosts.j2
dest: ".tmp/ansible_hosts"
delegate_to: localhost
- name: generate apps playbook
template:
src: apps.yml.j2
dest: "./{{env_name}}-{{stack_name}}-apps.yml"
delegate_to: localhost