code-dumps/rs/ansible-create-home.sh

36 lines
780 B
Bash
Raw Normal View History

2022-04-08 14:23:45 +08:00
#!/bin/bash
mkdir -p ~/rs-ansible-home/keys
cd ~/rs-ansible-home
cat <<EOF > ansible.cfg
[defaults]
inventory=dyn-inventory.sh
gathering = smart
fact_caching = jsonfile
fact_caching_connection = facts-cache.json
fact_caching_timeout = 3600
host_key_checking = False
become = true
log_path = ansible.log
stdout_callback = full_skip
forks=10
retry_files_enabled = False
command_warnings = False
pipelining = True
interpreter_python = auto_silent
vault_password_file = keys/.vault-pass
EOF
cat <<EOF > dyn-inventory.sh
#!/bin/bash
2022-04-08 15:19:30 +08:00
ht6 --core-account \$COREACCOUNT --quiet ansible
2022-04-08 14:23:45 +08:00
EOF
chmod 755 dyn-inventory.sh
openssl rand -base64 32 > ~/rs-ansible-home/keys/.vault-pass
2022-04-08 14:30:59 +08:00
cat <<EOF > example-usage.md
# Run ansible through hammertime
COREACCOUNT=123456 ansible -m ping linux
EOF