Skip to content

Instantly share code, notes, and snippets.

@msuzoagu
Created March 14, 2019 23:41
Show Gist options
  • Save msuzoagu/a8e3d46c174182e4fce997b576130155 to your computer and use it in GitHub Desktop.
Save msuzoagu/a8e3d46c174182e4fce997b576130155 to your computer and use it in GitHub Desktop.
for ansible issue concerning stacked SSH host key prompts
given this inventory.yaml file:
```
---
all:
children:
bastion:
hosts:
test-bastion-0:
swarm_cluster:
children:
managers:
hosts:
test-0:
workers:
hosts:
test-1:
```
this playbook:
```
---
- name: configure docker nodes
hosts: test_cluster
gather_facts: yes
remote_user: "{{ test_user.name }}"
become_method: sudo
become: True
# serial: 1
vars:
ansible_become_pass: "{{ test_user.password }}"
ansible_ssh_private_key_file: "{{ test_privatekey }}"
roles:
- docker
```
this role:
```
---
- name: stop netfilter service
service:
name: netfilter-persistent
state: stopped
- name: disable tcp forwarding & disable root login (sshd rules)
template:
src: sshd_no_tcp_forwarding_config.jinja2
dest: /etc/ssh/sshd_config
owner: root
group: root
mode: 0600
validate: "/usr/sbin/sshd -f %s -t"
backup: yes
```
and this ansible.cfg file:
```
[defaults]
vault_password_file = ~/.vault_pass.txt
roles_path = ./roles
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment