diff --git a/utils/ansible-ipa-client-install b/utils/ansible-ipa-client-install index 64f2974293eaa01023007472f17441812e0ad437..373d29f3ab7868b4eb2b0110f355d4d538227164 100755 --- a/utils/ansible-ipa-client-install +++ b/utils/ansible-ipa-client-install @@ -208,6 +208,12 @@ def parse_options(): help="If defined will be used as to create inventory " "file and playbook in. The files will not be removed " "after the playbook processing ended.") + parser.add_argument("--become-method", + dest="become_method", + default="sudo", + help="privilege escalation method to use " + "(default=sudo), use `ansible-doc -t become -l` to " + "list valid choices.") options, args = parser.parse_known_args() @@ -356,15 +362,16 @@ def main(options, args): state = "present" with open(playbook, 'w') as f: - f.write("""--- -- name: Playbook to configure IPA clients - hosts: ipaclients - become: true - - roles: - - role: ipaclient - state: %s -""" % state) + f.write("---\n") + f.write("- name: Playbook to configure IPA clients\n") + f.write(" hosts: ipaclients\n") + f.write(" become: true\n") + if options.become_method: + f.write(" become_method: %s\n" % options.become_method) + f.write("\n") + f.write(" roles:\n") + f.write(" - role: ipaclient\n") + f.write(" state: %s\n" % state) try: returncode = run_cmd(['ansible-playbook', '-i', inventory, playbook]) diff --git a/utils/ansible-ipa-replica-install b/utils/ansible-ipa-replica-install index 3c9f73288dd0d7a3586689ee8c221dd24498ce9c..68cbead63d90cbcdc9da048fba6083211fffeb5b 100755 --- a/utils/ansible-ipa-replica-install +++ b/utils/ansible-ipa-replica-install @@ -278,6 +278,12 @@ def parse_options(): help="If defined will be used as to create inventory " "file and playbook in. The files will not be removed " "after the playbook processing ended.") + parser.add_argument("--become-method", + dest="become_method", + default="sudo", + help="privilege escalation method to use " + "(default=sudo), use `ansible-doc -t become -l` to " + "list valid choices.") options, args = parser.parse_known_args() @@ -334,10 +340,10 @@ def main(options, args): for server in options.servers: f.write("%s\n" % server) f.write("\n") - f.write("[ipareplica]\n") + f.write("[ipareplicas]\n") f.write("%s\n" % args[0]) f.write("\n") - f.write("[ipareplica:vars]\n") + f.write("[ipareplicas:vars]\n") # basic if options.admin_password: f.write("ipaadmin_password=%s\n" % options.admin_password) @@ -472,15 +478,16 @@ def main(options, args): state = "present" with open(playbook, 'w') as f: - f.write("""--- -- name: Playbook to configure IPA replica - hosts: ipareplica - become: true - - roles: - - role: ipareplica - state: %s -""" % state) + f.write("---\n") + f.write("- name: Playbook to configure IPA replicas\n") + f.write(" hosts: ipareplicas\n") + f.write(" become: true\n") + if options.become_method: + f.write(" become_method: %s\n" % options.become_method) + f.write("\n") + f.write(" roles:\n") + f.write(" - role: ipareplica\n") + f.write(" state: %s\n" % state) try: returncode = run_cmd(['ansible-playbook', '-i', inventory, playbook]) diff --git a/utils/ansible-ipa-server-install b/utils/ansible-ipa-server-install index 65a9afc27d4b3294cbe60314fb5308430cfe09c9..3faf480c21e786b7bf60e779caaf26803a7f4927 100755 --- a/utils/ansible-ipa-server-install +++ b/utils/ansible-ipa-server-install @@ -314,6 +314,12 @@ def parse_options(): help="If defined will be used as to create inventory " "file and playbook in. The files will not be removed " "after the playbook processing ended.") + parser.add_argument("--become-method", + dest="become_method", + default="sudo", + help="privilege escalation method to use " + "(default=sudo), use `ansible-doc -t become -l` to " + "list valid choices.") options, args = parser.parse_known_args() @@ -529,15 +535,16 @@ def main(options, args): state = "present" with open(playbook, 'w') as f: - f.write("""--- -- name: Playbook to configure IPA server - hosts: ipaserver - become: true - - roles: - - role: ipaserver - state: %s -""" % state) + f.write("---\n") + f.write("- name: Playbook to configure IPA server\n") + f.write(" hosts: ipaserver\n") + f.write(" become: true\n") + if options.become_method: + f.write(" become_method: %s\n" % options.become_method) + f.write("\n") + f.write(" roles:\n") + f.write(" - role: ipaserver\n") + f.write(" state: %s\n" % state) try: returncode = run_cmd(['ansible-playbook', '-i', inventory, playbook])