Re: [ansible-project] Variables between playbooks
Thanks I guess I will put it into a new file. W dniu czwartek, 10 sierpnia 2017 19:35:04 UTC+2 użytkownik Kai Stian Olstad napisał: > > On 09. aug. 2017 22:56, marta.a...@gmail.com wrote: > > I have some problem and I can't figure out the answear to it. I'm > > relatively new to Ansible so I'm still learning. I have to separate > > playbooks and I want to set a variable value in one, and use it in the > > other. So for example in playbook 1 I want to start ec2 instance and I > want > > to safe its instance_id and in the next playbook run some time after > that > > first I want to delete this instance so I want to get the instance_id > value > > from the variable. Is this possible, and if so how? If someone knows the > > answear please provide some simple example, because I have found some > > ideas, but nothing seems to work. And if the first problem could be > solved, > > would it be possible to save this variable in the first playbook with > parameterized > > variable name? > > It's not possible to share variables between playbooks, you can share > between play in the same playbook. > > What you could do is store the values in a file that you read in > playbook number two. > > -- > Kai Stian Olstad > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7e84566b-83d6-4386-93ee-dd7e5f96678d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Variables between playbooks
Well, aside from a thread on vars_files I just posted, you can use facts that seem to span imports of playbooks. see the set_facts documentation. You can also set variables in inventory files On Thursday, August 10, 2017 at 10:35:04 AM UTC-7, Kai Stian Olstad wrote: > > On 09. aug. 2017 22:56, marta.a...@gmail.com wrote: > > I have some problem and I can't figure out the answear to it. I'm > > relatively new to Ansible so I'm still learning. I have to separate > > playbooks and I want to set a variable value in one, and use it in the > > other. So for example in playbook 1 I want to start ec2 instance and I > want > > to safe its instance_id and in the next playbook run some time after > that > > first I want to delete this instance so I want to get the instance_id > value > > from the variable. Is this possible, and if so how? If someone knows the > > answear please provide some simple example, because I have found some > > ideas, but nothing seems to work. And if the first problem could be > solved, > > would it be possible to save this variable in the first playbook with > parameterized > > variable name? > > It's not possible to share variables between playbooks, you can share > between play in the same playbook. > > What you could do is store the values in a file that you read in > playbook number two. > > -- > Kai Stian Olstad > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/784fe326-641b-4135-a81e-f8dca0bfe2d9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ansible-project] Variables between playbooks
On 09. aug. 2017 22:56, marta.albec...@gmail.com wrote: I have some problem and I can't figure out the answear to it. I'm relatively new to Ansible so I'm still learning. I have to separate playbooks and I want to set a variable value in one, and use it in the other. So for example in playbook 1 I want to start ec2 instance and I want to safe its instance_id and in the next playbook run some time after that first I want to delete this instance so I want to get the instance_id value from the variable. Is this possible, and if so how? If someone knows the answear please provide some simple example, because I have found some ideas, but nothing seems to work. And if the first problem could be solved, would it be possible to save this variable in the first playbook with parameterized variable name? It's not possible to share variables between playbooks, you can share between play in the same playbook. What you could do is store the values in a file that you read in playbook number two. -- Kai Stian Olstad -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e56fef76-ccab-15d9-f123-89776cb3447a%40olstad.com. For more options, visit https://groups.google.com/d/optout.
[ansible-project] Variables between playbooks
Hi! I have some problem and I can't figure out the answear to it. I'm relatively new to Ansible so I'm still learning. I have to separate playbooks and I want to set a variable value in one, and use it in the other. So for example in playbook 1 I want to start ec2 instance and I want to safe its instance_id and in the next playbook run some time after that first I want to delete this instance so I want to get the instance_id value from the variable. Is this possible, and if so how? If someone knows the answear please provide some simple example, because I have found some ideas, but nothing seems to work. And if the first problem could be solved, would it be possible to save this variable in the first playbook with parameterized variable name? Marta -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6659e8b7-a74a-4bc7-aa1e-fdf2d78f65b1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.