diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 79cbc43d80..118a0198e4 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -121,7 +121,7 @@ def main(args): options.ask_vault_pass = options.ask_vault_pass or C.DEFAULT_ASK_VAULT_PASS if options.listhosts or options.syntax or options.listtasks or options.listtags: - (_, _, _, vault_pass) = utils.ask_passwords(ask_vault_pass=options.ask_vault_pass) + (_, _, vault_pass) = utils.ask_passwords(ask_vault_pass=options.ask_vault_pass) else: options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS # Never ask for an SSH password when we run with local connection diff --git a/docsite/rst/intro_dynamic_inventory.rst b/docsite/rst/intro_dynamic_inventory.rst index ddb452e775..6734efca19 100644 --- a/docsite/rst/intro_dynamic_inventory.rst +++ b/docsite/rst/intro_dynamic_inventory.rst @@ -24,7 +24,7 @@ For information about writing your own dynamic inventory source, see :doc:`devel Example: The Cobbler External Inventory Script `````````````````````````````````````````````` -It is expected that many Ansible users with a reasonable amount of physical hardware may also be `Cobbler `_ users. (note: Cobbler was originally written by Michael DeHaan and is now lead by James Cammarata, who also works for Ansible, Inc). +It is expected that many Ansible users with a reasonable amount of physical hardware may also be `Cobbler `_ users. (note: Cobbler was originally written by Michael DeHaan and is now led by James Cammarata, who also works for Ansible, Inc). While primarily used to kickoff OS installations and manage DHCP and DNS, Cobbler has a generic layer that allows it to represent data for multiple configuration management systems (even at the same time), and has diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 74c6998b22..babc059e65 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -583,29 +583,6 @@ class Play(object): included_become_vars[k] = become_vars[k] x[k] = become_vars[k] - ## backwards compat with old sudo/su directives - if 'sudo' in x or 'sudo_user' in x: - included_become_vars['become'] = x['sudo'] - x['become'] = x['sudo'] - x['become_method'] = 'sudo' - del x['sudo'] - - if x.get('sudo_user', False): - included_become_vars['become_user'] = x['sudo_user'] - x['become_user'] = x['sudo_user'] - del x['sudo_user'] - - elif 'su' in x or 'su_user' in x: - included_become_vars['become'] = x['su'] - x['become'] = x['su'] - x['become_method'] = 'su' - del x['su'] - - if x.get('su_user', False): - included_become_vars['become_user'] = x['su_user'] - x['become_user'] = x['su_user'] - del x['su_user'] - if 'meta' in x: if x['meta'] == 'flush_handlers': results.append(Task(self, x)) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index a43c2ab89d..77cb97e5c0 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -173,19 +173,34 @@ class Task(object): # set only if passed in current task data if 'sudo' in ds or 'sudo_user' in ds: - self.become=ds['sudo'] self.become_method='sudo' + + if 'sudo' in ds: + self.become=ds['sudo'] + del ds['sudo'] + else: + self.become=True if 'sudo_user' in ds: self.become_user = ds['sudo_user'] + del ds['sudo_user'] if 'sudo_pass' in ds: self.become_pass = ds['sudo_pass'] - if 'su' in ds or 'su_user' in ds: - self.become=ds['su'] + del ds['sudo_pass'] + + elif 'su' in ds or 'su_user' in ds: self.become_method='su' + + if 'su' in ds: + self.become=ds['su'] + else: + self.become=True + del ds['su'] if 'su_user' in ds: self.become_user = ds['su_user'] + del ds['su_user'] if 'su_pass' in ds: self.become_pass = ds['su_pass'] + del ds['su_pass'] # Both are defined if ('action' in ds) and ('local_action' in ds): diff --git a/lib/ansible/runner/action_plugins/template.py b/lib/ansible/runner/action_plugins/template.py index e6e33d354f..a824a6e4b8 100644 --- a/lib/ansible/runner/action_plugins/template.py +++ b/lib/ansible/runner/action_plugins/template.py @@ -133,7 +133,7 @@ class ActionModule(object): xfered = self.runner._transfer_str(conn, tmp, 'source', resultant) # fix file permissions when the copy is done as a different user - if self.runner.become and self.runner.become_user != 'root' or self.runner.su and self.runner.su_user != 'root': + if self.runner.become and self.runner.become_user != 'root': self.runner._remote_chmod(conn, 'a+r', xfered, tmp) # run the copy module diff --git a/lib/ansible/runner/connection_plugins/paramiko_ssh.py b/lib/ansible/runner/connection_plugins/paramiko_ssh.py index 2ba3d76d26..8eaf97c3f6 100644 --- a/lib/ansible/runner/connection_plugins/paramiko_ssh.py +++ b/lib/ansible/runner/connection_plugins/paramiko_ssh.py @@ -246,7 +246,7 @@ class Connection(object): if success_key in become_output or \ (prompt and become_output.endswith(prompt)) or \ - utils.su_prompts.check_su_prompt(become_output)): + utils.su_prompts.check_su_prompt(become_output): break chunk = chan.recv(bufsize)