feat: bootstrap and harden Railiance01 at HostEurope
- Extend base role with fail2ban, UFW k3s/Flannel rules, HISTCONTROL - Add handlers dir for fail2ban restart - Fix inventory script to emit correct dynamic inventory JSON format - Add roles_path to ansible.cfg so playbook finds roles - Add Railiance01 (92.205.62.239) to inventory/servers.yaml - Mark workplan T03/T04/T05 as done Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
5187e63504
commit
679d0d67b1
6 changed files with 68 additions and 6 deletions
11
ansible/inventory_from_yaml.py
Normal file → Executable file
11
ansible/inventory_from_yaml.py
Normal file → Executable file
|
|
@ -20,14 +20,19 @@ def load_tf_outputs():
|
|||
def main():
|
||||
server_list = load_servers()
|
||||
tf = load_tf_outputs()
|
||||
hosts = {}
|
||||
host_names = []
|
||||
hostvars = {}
|
||||
for s in server_list:
|
||||
name = s['name']
|
||||
hosts[name] = {
|
||||
host_names.append(name)
|
||||
hostvars[name] = {
|
||||
"ansible_host": tf.get(name) or s.get('ip'),
|
||||
"ansible_user": s.get('ssh_user', 'admin')
|
||||
}
|
||||
inv = {"all": {"hosts": hosts}}
|
||||
inv = {
|
||||
"all": {"hosts": host_names},
|
||||
"_meta": {"hostvars": hostvars}
|
||||
}
|
||||
print(json.dumps(inv))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue