Better to use ssh keys or store the details in ansible vault or something but 
if you need to prompt for the password you could potentially use vars_prompt: ?

something like

- hosts: all
  become: yes
  vars_prompt:
    - name: ansible_become_pass
      prompt: "Enter sudo password"
      private: yes

  tasks:
    - name: Install a package
      ansible.builtin.yum:
        name: vim
        state: present

From: [email protected] <[email protected]> On 
Behalf Of Dick Visser
Sent: Wednesday, February 21, 2024 9:53 AM
To: [email protected]
Subject: [ansible-project] trigger --ask-become-pass with playbook variable?

Caution: This email originated from outside of the organisation. Do not click 
links or open attachments unless you recognise the sender and know the content 
is safe

Hii,
I would like to have a playbook trigger the asking of the become password, but 
I couldn't find how to do it.
Is there perhaps some variable that can be set in a playbook (or play) to do 
this? I was thinking of something like "ask_become_pass: true" or something 
like that.

thx
Dick
--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZ4UY0tmtTXn%3DWHpLKf2icaRiGYPr7SmHqk0AsEGD53oQ%40mail.gmail.com<https://groups.google.com/d/msgid/ansible-project/CAF8BbLZ4UY0tmtTXn%3DWHpLKf2icaRiGYPr7SmHqk0AsEGD53oQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
---------------
[https://www.zen.co.uk/resources/images/default-source/image-library/icons/zen-logo_meeting.png]
Stuart Lowe He/Him
Zen Cloud Engineering - Team Leader
Zen Internet
Team: 01706 902009
www.zen.co.uk
<https://www.zen.co.uk/>

Proud to be a certified B Corporation

[https://www.zen.co.uk/resources/images/default-source/image-library/which232221-stacked-emailsig.tmb-0.png]

This message is private and confidential. If you have received this message in 
error, please notify us and remove it from your system.

Zen Internet Limited may monitor email traffic data to manage billing, to 
handle customer enquiries, and for the prevention and detection of fraud. We 
may also monitor the content of emails sent to and/or from Zen Internet Limited 
for the purposes of security, staff training and to monitor the quality of 
service.
Zen Internet Limited is registered in England and Wales, Sandbrook Park, 
Sandbrook Way, Rochdale, OL11 1RY Company No. 03101568 VAT Reg No. 686 0495 01

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/PA4PR01MB8994AFFF4F775456FE7BE457A8572%40PA4PR01MB8994.eurprd01.prod.exchangelabs.com.

Reply via email to