summaryrefslogtreecommitdiff
path: root/examples/playbooks/prompts.yml
blob: 6b020072491635683311810c92a2247639f026db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---

# it is possible to ask for variables from the user at the start
# of a playbook run, for example, as part of a release script.

- hosts: all
  user: root

# regular variables are a dictionary of keys and values

  vars:
     this_is_a_regular_var: 'moo'
     so_is_this: 'quack'

# alternatively, they can ALSO be passed in from the outside:
#    ansible-playbook foo.yml --extra-vars="foo=100 bar=101"
# or through external inventory scripts (see online API docs)

# here's basic mode prompting.  Specify a hash of variable names and a prompt for
# each.
#
# vars_prompt:
#   release_version: "product release version"

# prompts can also be specified like this, allowing for hiding the prompt as
# entered.  In the future, this may also be used to support crypted variables

  vars_prompt:
    - name: "some_password"
      prompt: "Enter password"
      private: yes
    - name: "release_version"
      prompt: "Product release version"
      private: no
   
    - name: "my_password2"
      prompt: "Enter password2"
      private: yes
      encrypt: "md5_crypt" 
      confirm: yes
      salt_size: 7
      salt: "foo" 

# this is just a simple example to show that vars_prompt works, but
# you might ask for a tag to use with the git module or perhaps
# a package version to use with the yum module.

  tasks:

  - name: imagine this did something interesting with $release_version
    action: shell echo foo >> /tmp/$release_version-$alpha

  - name: look we crypted a password
    action: shell echo my password is $my_password2