Undefined variable when trying to pass username and password through Ansible Git Module
up vote
0
down vote
favorite
I have a follow up question to the thread in here:
How do I pass username and password while using Ansible Git module?
I am trying to achieve a similar task where I am passing a username and password to GitHub through Ansible. Here is what I am using for my playbook:
- name: ANSIBLE - Shop Installation
hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
- hosts: host_list
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
After running through this, I get the following error message:
fatal: : FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'githubuser' is undefinednnThe error appears to have been in 'playbook.yml'
Any ideas where I may have gone wrong here?
I am running Ansible 2.7.1
ansible
add a comment |
up vote
0
down vote
favorite
I have a follow up question to the thread in here:
How do I pass username and password while using Ansible Git module?
I am trying to achieve a similar task where I am passing a username and password to GitHub through Ansible. Here is what I am using for my playbook:
- name: ANSIBLE - Shop Installation
hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
- hosts: host_list
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
After running through this, I get the following error message:
fatal: : FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'githubuser' is undefinednnThe error appears to have been in 'playbook.yml'
Any ideas where I may have gone wrong here?
I am running Ansible 2.7.1
ansible
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a follow up question to the thread in here:
How do I pass username and password while using Ansible Git module?
I am trying to achieve a similar task where I am passing a username and password to GitHub through Ansible. Here is what I am using for my playbook:
- name: ANSIBLE - Shop Installation
hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
- hosts: host_list
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
After running through this, I get the following error message:
fatal: : FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'githubuser' is undefinednnThe error appears to have been in 'playbook.yml'
Any ideas where I may have gone wrong here?
I am running Ansible 2.7.1
ansible
I have a follow up question to the thread in here:
How do I pass username and password while using Ansible Git module?
I am trying to achieve a similar task where I am passing a username and password to GitHub through Ansible. Here is what I am using for my playbook:
- name: ANSIBLE - Shop Installation
hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
- hosts: host_list
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
After running through this, I get the following error message:
fatal: : FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'githubuser' is undefinednnThe error appears to have been in 'playbook.yml'
Any ideas where I may have gone wrong here?
I am running Ansible 2.7.1
ansible
ansible
asked Nov 10 at 1:16
TheOrangeRemix
41238
41238
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
I think the structure of your playbook is wrong. Try this:
---
- hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
add a comment |
up vote
0
down vote
Scope of vars_prompt is a playbook.
Variable githubuser is defined in the first play. Second play knows nothing about it.
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
An option would be to configure fact_caching. For example with Redis
[defaults]
fact_caching=redis
In the first play store the variables with set_fact cacheable: yes
In the second play fetch data from Redis
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
I think the structure of your playbook is wrong. Try this:
---
- hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
add a comment |
up vote
1
down vote
accepted
I think the structure of your playbook is wrong. Try this:
---
- hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
I think the structure of your playbook is wrong. Try this:
---
- hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
I think the structure of your playbook is wrong. Try this:
---
- hosts: host_list
vars_prompt:
- name: "githubuser"
prompt: "Enter your github username"
private: no
- name: "githubpassword"
prompt: "Enter your github password"
private: yes
tasks:
- name: Get the latest version through Git
git:
repo: 'https://{{ githubuser }}:{{ githubpassword }}@github.com/foo/bar.git'
dest: /tmp
answered Nov 10 at 6:54
JGK
876311
876311
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
add a comment |
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
Yup, you're right; my structure was incorrect. Your suggestion fixed it. Thanks!
– TheOrangeRemix
Nov 12 at 16:26
add a comment |
up vote
0
down vote
Scope of vars_prompt is a playbook.
Variable githubuser is defined in the first play. Second play knows nothing about it.
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
An option would be to configure fact_caching. For example with Redis
[defaults]
fact_caching=redis
In the first play store the variables with set_fact cacheable: yes
In the second play fetch data from Redis
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
add a comment |
up vote
0
down vote
Scope of vars_prompt is a playbook.
Variable githubuser is defined in the first play. Second play knows nothing about it.
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
An option would be to configure fact_caching. For example with Redis
[defaults]
fact_caching=redis
In the first play store the variables with set_fact cacheable: yes
In the second play fetch data from Redis
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
add a comment |
up vote
0
down vote
up vote
0
down vote
Scope of vars_prompt is a playbook.
Variable githubuser is defined in the first play. Second play knows nothing about it.
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
An option would be to configure fact_caching. For example with Redis
[defaults]
fact_caching=redis
In the first play store the variables with set_fact cacheable: yes
In the second play fetch data from Redis
Scope of vars_prompt is a playbook.
Variable githubuser is defined in the first play. Second play knows nothing about it.
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
An option would be to configure fact_caching. For example with Redis
[defaults]
fact_caching=redis
In the first play store the variables with set_fact cacheable: yes
In the second play fetch data from Redis
edited Nov 11 at 21:33
answered Nov 10 at 8:35
Vladimir Botka
72938
72938
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
add a comment |
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
Would I have to pass the variable value from the first play to the second? What's the correct way of doing that in this context?
– TheOrangeRemix
Nov 11 at 17:42
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235196%2fundefined-variable-when-trying-to-pass-username-and-password-through-ansible-git%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown