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