diff --git a/.gitmodules b/.gitmodules index 3419572..48c9950 100644 --- a/.gitmodules +++ b/.gitmodules @@ -67,3 +67,6 @@ [submodule "roles/do1jlr.i3wm"] path = roles/do1jlr.i3wm url = https://github.com/roles-ansible/ansible_role_i3wm.git +[submodule "roles/do1jlr.htop"] + path = roles/do1jlr.htop + url = https://github.com/roles-ansible/ansible_role_htop.git diff --git a/ansible.cfg b/ansible.cfg index 51c1513..4cdf9f4 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,11 +1,9 @@ [defaults] inventory = ./inventory.py -retry_files_enabled = False -nocows = True -ansible_connection = 'local' +retry_files_enabled = false +nocows = true +transport = local [privilege_escalation] become_method = sudo become_user = root -become_ask_pass = False - diff --git a/inventory.py b/inventory.py index 3f79ce5..bb6f34b 100755 --- a/inventory.py +++ b/inventory.py @@ -43,12 +43,19 @@ def empty_host_list(domain): return json.loads('{"_meta": {"comment": "' + comment + '", "hostvars": {}}, "instances": {"hosts": []}}') +def hostvars(host): + """ + set variables to local connection + """ + local = str('"' + host + '": {"ansible_connection": "local"}') + return local + def formated_host_group_list(host, group): """ build inventory and return it """ # pylint: disable=line-too-long - return json.loads('{"_meta": {"hostvars": {}},"' + str(group) + '": {"hosts": ["' + str(host) + '"]},"instances": {"children": ["' + str(group) + '"]}}') + return json.loads('{"_meta": {"hostvars": {' + str(hostvars(host)) + '}},"' + str(group) + '": {"hosts": ["' + str(host) + '"]},"instances": {"children": ["' + str(group) + '"]}}') def main(): """ diff --git a/roles/do1jlr.htop b/roles/do1jlr.htop new file mode 160000 index 0000000..b79f333 --- /dev/null +++ b/roles/do1jlr.htop @@ -0,0 +1 @@ +Subproject commit b79f3331976035cfe3a9c163ebe1ca32d85aee33