I am newbie to ansible. I am trying to perform some deployment task in 142.23.9.23 via help of ansible using jenkins. I am hitting below error FAILED! => {"msg": "The field 'become_pass' has an invalid value, which includes an undefined variable. The error was: 'tomcat_password' is undefined"}.
I am open to new suggestion as well.
Below is the details
Directory
ansible
|---- group_vars
|---- MAIN
|---- vault.yml
|---- hosts
|---- host-details.yml
|---- roles
|----- my-playbook.yml
my-playbook.yml
- hosts: app-server
tasks:
- name: Print message
debug: msg="test playbook version ansible_host = {{ ansible_host }}, ansible_ssh_user = {{ansible_ssh_user}}"
vars_files:
- group_vars/COMMON/vault.yml
host-details.yml
[app-server]
142.23.9.23 ansible_host=142.23.9.23 ansible_ssh_user=myuser ansible_become=yes ansible_become_user=myuser ansible_become_pass='{{ tomcat_password }}'
ansible-vault edit vault.yml
tomcat_password: password1
jenkins_password: password2