Skip to content

Commit

Permalink
Improve "Group hosts based on configuration" task (#460)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <berendt@osism.tech>
  • Loading branch information
berendt authored Jul 12, 2023
1 parent 9877837 commit 9912efe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions files/scripts/split-kolla-ansible-site.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import copy
import os
import re

import ruamel.yaml

Expand Down Expand Up @@ -60,17 +61,23 @@
print("ROLE %s IS NOT SUPPORTED" % name)

else:
play["gather_facts"] = "no"
play["gather_facts"] = "false"
dump = ruamel.yaml.dump(
[play], Dumper=ruamel.yaml.RoundTripDumper, indent=4, block_seq_indent=2
)
if name == "rabbitmq(outward)":
name = "rabbitmq-outward"

local_group_hosts_based_on_configuration = copy.deepcopy(
group_hosts_based_on_configuration
)

local_group_hosts_based_on_configuration["hosts"] = play["hosts"]

with open(os.path.join(DSTPATH, "kolla-%s.yml" % name), "w+") as fp:
fp.write("---\n")

for key, value in group_hosts_based_on_configuration.items():
for key, value in local_group_hosts_based_on_configuration.items():
if key == "tasks" and type(value) == list:
for task in [
x
Expand All @@ -84,7 +91,7 @@
task["with_items"] = v

dump_group_hosts_based_on_configuration = ruamel.yaml.dump(
[group_hosts_based_on_configuration],
[local_group_hosts_based_on_configuration],
Dumper=ruamel.yaml.RoundTripDumper,
indent=4,
block_seq_indent=2,
Expand Down

0 comments on commit 9912efe

Please sign in to comment.