49 lines
1.2 KiB
YAML
49 lines
1.2 KiB
YAML
---
|
|
- name: Install required system packages
|
|
ansible.builtin.apt:
|
|
name:
|
|
- vim
|
|
state: latest
|
|
update_cache: true
|
|
|
|
- name: Create SSHwifty configuration directory
|
|
file:
|
|
path: "{{ sshwifty_configuration_directory }}"
|
|
state: directory
|
|
|
|
- name: Scan SSH keys
|
|
shell: "ssh-keyscan -t ed25519 {{ hostvars[item]['ansible_facts']['default_ipv4']['address'] }} 2>/dev/null | ssh-keygen -lf - |cut -f2 -d' '"
|
|
register: "host_keys"
|
|
changed_when: false
|
|
with_items: "{{ groups['role_mongo'] }}"
|
|
|
|
- debug:
|
|
msg: "item.item={{ item.item }}, item.stdout={{ item.stdout }}"
|
|
with_items: "{{ host_keys.results }}"
|
|
|
|
- name: Deploy SSHwifty configuration
|
|
template:
|
|
src: templates/sshwifty.conf.j2
|
|
dest: "{{ sshwifty_configuration_directory }}/sshwifty.conf"
|
|
|
|
# - name: Debug
|
|
# fail: "msg=STOP"
|
|
# when: "True"
|
|
|
|
- name: Create SSHwifty directory
|
|
file:
|
|
path: "{{ sshwifty_work_directory }}"
|
|
state: directory
|
|
|
|
- name: Deploy SSHwifty configuration
|
|
template:
|
|
src: templates/docker-compose.yml.j2
|
|
dest: "{{ sshwifty_work_directory }}/docker-compose.yml"
|
|
|
|
- name: Run SSHwifty
|
|
community.docker.docker_compose:
|
|
project_src: "{{ sshwifty_work_directory }}"
|
|
recreate: smart
|
|
state: present
|
|
|
|
#
|