外围体育投注I'm looking into creating a playbook so a non-team member can run various "show" commands on a network switch/router. I was looking at the survey multiple choice options. This seems like it might work for me but i'm getting stuck on how to variablize these entries and properly/dynamically integrate them into my playbook. Has anyone worked on a similar problem and come up with an elegant solution?
外围体育投注For example, the survey could say -- select site, select command to run. Then my playbook would take these two variables and run a task based on this. I don't want to do something like a bunch of IF/WHEN statements. Could I use these vars as tags or skip-tags maybe?
外围体育投注I'm pretty new to Ansible and just getting started on writing some playbooks. One of the tasks I have is to perform some audits on our systems.
So one of the first ones I'm working on is just a simple list of the yum repositories. I can get the yum module to show them on an ad-hoc command just fine, so I'm good with the syntax of the yum module to list the repos.
However; I want to register the result - but with this playbook, it tells me that the variable is undefined.
- hosts: all become: yes tasks: - name: Section 1.1 - Check Yum Repos yum: list=repos register: section1 - debug: var=section1.stdout
外围体育投注Works, but with 'Variable Undefined' ^^
外围体育投注What am I doing wrong there? I can't indent the 'register' right under 'list=repos' or it will throw an error.
外围体育投注I'm trying to push haproxy config to our haproxy server. We currently have 3 haproxy and 3 nginx servers. Now we would like to append config to the haproxy.cfg file on the haproxy servers.
### Backends ### backend test1 balance roundrobin server test1_api nginx1_ip:8001 server test1_api2 nginx2_ip:8001 server test1_api3 nginx3_ip:8001 backend test2 balance roundrobin server test2_api nginx1_ip:8002 server test2_api2 nginx2_ip:8002 server test2_api3 nginx3_ip:8002
外围体育投注I'm trying to determine if this is possible.
I want to invoke a job template against Host A to collect facts (hostname & IP Address) of Host A and store them in a variable. I then want to execute a script on Host B passing in the variables from Host A.
Effectively, I am pulling the hostname & ip address from host A and then executing a script on host B to create a DNS record using the hostname & ip from Host A
Host A does not have the capability to interface with our DNS server API so I cannot create the record directly from host A hence needing to invoke host B to create the record
Thanks in advance