We are trying to automate Vault creation(internal component) and 
initialization using ansible scripts but we are facing issue in expect 
module

 


expect module responses are not getting the inputs given. Below  is the 
script which I have tried and error I am facing. Please let me know if you 
know any solution for the same.

 

changed: [192.168.33.10] => {

    "changed": true,

    "cmd": "sh /opt/vcs/cegp/security-tools/bin/vaultsecurity.sh",

    "delta": "0:00:01.102558",

    "end": "2019-01-23 20:25:39.840327",

    "invocation": {

        "module_args": {

            "chdir": null,

            "command": "sh 
/opt/vcs/cegp/security-tools/bin/vaultsecurity.sh",

            "creates": null,

            "echo": false,

            "removes": null,

            "responses": {

                "Enter Attribute Name": "mongoPassword",

                "Enter Attribute value": "pwd",

                "Enter Attribute value again": "pwd ",

                "Enter Keystore Alias": "pdspKeystoreAlias",

                "Enter Keystore URL": 
"/opt/vcs/pds/ds-api-query/security/pdsp.keystore",

                "Enter Keystore password": "pdsp",

                "Enter Keystore password again": "pdsp",

                "Enter Vault Block": "pdspBlock",

                "Enter directory to store encrypted files": 
"/opt/vcs/pds/ds-api-query/security",

                "Please enter a Digit": "5",

                "Would you like to autogenerate the key value (Y/N)?": "N",

                "Would you like to create a new key file (Y/N)?": "y"

            },

            "timeout": 30

        }

    },

    "rc": 0,

    "start": "2019-01-23 20:25:38.737769",

    "stdout": 
"###############################################################################\r\n##################
  
Picket Box Security for CEGP Modules   #####################\r\n\r\nWould 
you like to create a new key file (Y/N)? Enter directory to store encrypted 
files:Enter Keystore URL:Enter Keystore 
passwo*********************\r\nPlease make note of the 
following:\r\n********************************************\r\nKEYSTORE_PASSWORD:{CMD}/cegp/cegp-security-too**\r\nEnter
 
Keystore Alias:pdspKeystoreAlias\r\nGetting Security Vault with 
implementation of org.picketbox.plugins.vault.PicketBoxSecurityVault\r\nJan 
23, 2PBOX00361: Default Security Vault Implementation Initialized and 
Ready\r\n\r\nPlease enter a Digit:: 1: Add key  2: Remove key  3: Rename 
key  4: List all ke

    "stdout_lines": [

        
"###############################################################################",

        "##################  Picket Box Security for CEGP Modules   
##################",

        
"###############################################################################",

        "",

        "Would you like to create a new key file (Y/N)? Enter directory to 
store encrypted files:Enter Keystore URL:Enter Keystore password:",

        "Enter Keystore password again:",

        "Values match",

        "********************************************",

        "Please make note of the following:",

        "********************************************",

        
"KEYSTORE_PASSWORD:{CMD}/cegp/cegp-security-tools/bin/vaultpass.sh,vaultMasterKey",

        "********************************************",

        "Enter Keystore Alias:pdspKeystoreAlias",

        "Getting Security Vault with implementation of 
org.picketbox.plugins.vault.PicketBoxSecurityVault",

        "Jan 23, 2019 8:25:39 PM 
com.verifone.cegp.security.vault.SecurityVaultImpl init",

        "INFO: PBOX00361: Default Security Vault Implementation Initialized 
and Ready",

        "",

        "Please enter a Digit:: 1: Add key  2: Remove key  3: Rename key  
4: List all keys  5: Exit",

        ":5"

    ]

}

 

 


actaully we need to automate below script


sh /opt/vcs/cegp/security-tools/bin/vaultsecurity.sh


##########################################################################

#####

################## Picket Box Security for CEGP Modules

##################

##########################################################################

#####

Would you like to create a new key file (Y/N)? Y

Enter directory to store encrypted files:/opt/vcs/pds/ds-api-query/security

Enter Keystore URL:/opt/vcs/pds/ds-api-query/security/pdsp.keystore

Enter Keystore password:

Enter Keystore password again:

Values match

********************************************

Please make note of the following:

********************************************

KEYSTORE_PASSWORD:{CMD}/cegp/cegp-security-tools/bin/vaultpass.sh,vaultMas

terKey

********************************************

Enter Keystore Alias:pdspKeystoreAlias

Getting Security Vault with implementation of

org.picketbox.plugins.vault.PicketBoxSecurityVault

Oct 26, 2018 2:11:53 PM com.verifone.cegp.security.vault.SecurityVaultImpl

init

INFO: PBOX00361: Default Security Vault Implementation Initialized and

Ready

Please enter a Digit:: 1: Add key 2: Remove key 3: Rename key 4: List

all keys 5: Exit

:1

Would you like to autogenerate the key value (Y/N)? N

Enter Attribute value:ver!f0ne

Enter Attribute value again:ver!f0ne

Values match

Enter Vault Block:pdspBlock

Enter Attribute Name:mongoPassword

********************************************

Please make note of the following:

********************************************

Key Vault:pdspBlock::mongoPassword

********************************************

Please enter a Digit:: 1: Add key 2: Remove key 3: Rename key 4: List

all keys 5: Exit

:4

********************************************

List of the keys contained in the file

key: [pdspBlock::mongoPassword], block: [pdspBlock], name: [mongoPassword]


but up to Enter Keystore 
URL:/opt/vcs/pds/ds-api-query/security/pdsp.keystore this line working fine 
after that password it is not taking script is shwoing sucessfully excuted 
but behind values are not taking  please help me out 



thanks

mahendra




 

 

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/daa4a647-fbae-474d-b782-ba608faca530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to