ansible: add become_pass.sh, persistent connections

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2025-01-22 16:00:21 +01:00
parent e518982349
commit f41b4af98a
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 9 additions and 2 deletions

View File

@ -5,8 +5,10 @@ remote_user = admin
inventory = ./ansible/terraform.py
callback_plugins = ./ansible/callback_plugins
lookup_plugins = ./ansible/lookup_plugins
become_password_file = ./ansible/become_pass.sh
module_name = shell
host_key_checking = false
use_persistent_connections = true
# human-readable stdout/stderr results display
stdout_callback = debug
# Avoid default Python warnings
@ -21,6 +23,9 @@ become_user = root
[ssh_connection]
# this should speed up exection but might cause issues with sudo
pipelining = True
control_path = /tmp/ansible-ssh-%%h-%%p-%%r
# necessary for cloning private git repos
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes -o ConnectTimeout=360
[persistent_connection]
command_timeout = 60
connect_retry_timeout = 30

3
ansible/become_pass.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Used via BECOME_PASSWORD_FILE to avoid re-evaluation on every task.
pass hosts/admin-pass

View File

@ -1,6 +1,5 @@
---
# Passwords
ansible_become_password: '{{lookup("passwordstore", "hosts/admin-pass")}}'
bootstrap__active_users_passwords: '{{ bootstrap__active_users | get_user_passwords }}'
bootstrap__admin_pass: '{{lookup("vault", "users", field="admin", env="all", stage="all")}}'
bootstrap__root_pass: '{{lookup("vault", "users", field="root", env="all", stage="all")}}'