feat: connect to servers using nat as jumphost
This commit is contained in:
@@ -4,6 +4,7 @@ tasks:
|
|||||||
vault: ansible-vault edit vault.yml {{.CLI_ARGS}}
|
vault: ansible-vault edit vault.yml {{.CLI_ARGS}}
|
||||||
tf:apply: ansible-playbook playbooks/provision.yml {{.CLI_ARGS}}
|
tf:apply: ansible-playbook playbooks/provision.yml {{.CLI_ARGS}}
|
||||||
tf:destroy: ansible-playbook playbooks/destroy.yml {{.CLI_ARGS}}
|
tf:destroy: ansible-playbook playbooks/destroy.yml {{.CLI_ARGS}}
|
||||||
|
configure-nat: ansible-playbook playbooks/configure_nat.yml {{.CLI_ARGS}}
|
||||||
|
|
||||||
enter:
|
enter:
|
||||||
cmd: ssh -i {{.KEY}} -p 22 root@{{.IP}}
|
cmd: ssh -i {{.KEY}} -p 22 root@{{.IP}}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
callbacks_enabled = profile_tasks
|
callbacks_enabled = profile_tasks
|
||||||
|
inventory = inventory.cfg
|
||||||
localhost_warning = False
|
localhost_warning = False
|
||||||
vault_password_file = vault.key
|
vault_password_file = vault.key
|
||||||
interpreter_python = /usr/bin/python3.11
|
interpreter_python = /usr/bin/python3.11
|
||||||
@@ -8,6 +9,6 @@ interpreter_python = /usr/bin/python3.11
|
|||||||
inventory_unparsed_warning = False
|
inventory_unparsed_warning = False
|
||||||
|
|
||||||
[ssh_connection]
|
[ssh_connection]
|
||||||
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o IdentityAgent=none
|
ssh_args = -F secrets/ssh.cfg -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o IdentityAgent=none
|
||||||
pipelining = True
|
pipelining = True
|
||||||
retries = 2
|
retries = 2
|
||||||
6
inventory.cfg
Normal file
6
inventory.cfg
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[gateways]
|
||||||
|
nat
|
||||||
|
|
||||||
|
[servers]
|
||||||
|
node-a
|
||||||
|
node-b
|
||||||
5
playbooks/configure_nat.yml
Normal file
5
playbooks/configure_nat.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
- name: Configure NAT
|
||||||
|
hosts: gateways
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- ansible.builtin.raw: hostname -I
|
||||||
Reference in New Issue
Block a user