Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Being prompted twice for password and sudo-password when they are the same value is annoying #1425

Closed
lucywyman opened this issue Nov 18, 2019 · 2 comments · Fixed by #1469
Closed
Assignees
Labels
Feature New features and improvements.

Comments

@lucywyman
Copy link
Contributor

lucywyman commented Nov 18, 2019

Use Case

Users often want to use the same value for password and sudo-password, and want to use the prompt plugin to get the value. Right now that means using the prompt plugin in 2 places, and having to enter the same value twice, which is annoying.

Describe the Solution You Would Like

I have a few idea for how we could solve this:

  1. Provide a config option to use the password value for sudo-password, if sudo-password is needed.
  2. Create a new plugin or sigil that will load another config value as the value for that option:
password:
  _plugin: prompt
  message: Please enter your password:
sudo-password:
  _plugin: reuse
  config_option: password
  1. Add a name attribute to the prompt plugin and only prompt once for each named prompt. This would mean that a prompt could be used throughout the inventory.

Additional Context

Slack convos: 1, 2, 3

Solution

The sudo-password should default to the value for password in all cases. This should be gated on future.

@lucywyman lucywyman added the Feature New features and improvements. label Nov 18, 2019
@adreyer
Copy link
Contributor

adreyer commented Nov 18, 2019

I don't think it's possible to create a new plugin that references other values without opening up a lot of unwanted complexity to the plugin API.

I do think we could allow named references as a general extension to the resolve_reference functionality. Given that references are lazy and can be recursive it would be easy for users to create broken inventories that are difficult to debug but it should be possible.

I'm open to suggestions but the best way I can think to implement this is probably a new _reference(bikeshed) special key.

- config:
   password:
     _plugin: prompt
     _reference: password
    message: "enter passworf
  sudopassword:
    _reference: password
  • A better interface for this would allow users to define references outside any section of the inventory and then use them anywhere.
  • It makes sense intuitively for references to be scopeable to a section but I suspect this will make the error cases too opaque so references probably need to be global.

@nmaludy
Copy link
Contributor

nmaludy commented Nov 19, 2019

It would be really nice to reference other config values, without it we have a lot of copy/paste in our inventory files:

groups:
  - name: windows
    config:
      transport: winrm
      winrm:
        user: patching_svc@domain.tld
        password: xxx
        ssl: true
        ssl-verify: false
    groups:
      - name: windows_servers_a
        vars:
          patching_order: 1
        targets:
          - _plugin: wsus_inventory
            host: 'sql01.domain.tld'
            database: 'SUSDB'
            username: 'DOMAIN\bolt_sql_svc'
            password: 'xxx'
            group: Servers_A

      - name: windows_servers_b
        vars:
          patching_order: 2
        targets:
          - _plugin: wsus_inventory
            host: 'sql01.domain.tld'
            database: 'SUSDB'
            username: 'DOMAIN\bolt_sql_svc'
            password: 'xxx'
            group: Servers_B

      - name: windows_servers_c
        vars:
          patching_order: 3
        targets:
          - _plugin: wsus_inventory
            host: 'sql01.domain.tld'
            database: 'SUSDB'
            username: 'DOMAIN\bolt_sql_svc'
            password: 'xxx'
            group: Servers_C

So, if this service account password changes, i now have 3x places i need to update it.

@beechtom beechtom self-assigned this Dec 6, 2019
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password`. This feature is gated by `future`.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
beechtom added a commit to beechtom/bolt that referenced this issue Dec 6, 2019
…password

This sets the default value for `sudo-password` to the same value as
`password` when using the SSH transport and `run-as`. This feature
is gated by the `future` config value.
nicklewis added a commit that referenced this issue Dec 6, 2019
(GH-1425) Set default value for sudo-password to value for password
@beechtom beechtom closed this as completed Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New features and improvements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants