[ansible-project] Re: General question about ansible CI/CD strategy

2022-12-29 Thread dmc...@gmail.com
Why do you you need to run constant playbook runs? are you looking to enforce OS state with Ansible? (I.E: CIS standards or is this more an application question?) CICD strategies are for pushing out updates only when there is an update to your code. This is great for applications, but will almo

Re: [ansible-project] To extract information from all hosts.

2022-12-29 Thread dmc...@gmail.com
I've tried ansible-cmdb but it doesn't work as well as I would like and it's not been updates for a long time. I did try and contact the author as i had some ideas to make it better but got no reply. I created this to solve the same problem but I store the results in a mongoDB. I created an an

[ansible-project] Re: How to get desired data from JSON

2022-03-25 Thread dmc...@gmail.com
I added a GitHub repo with a few examples showing how to parse your JSON file. I've already had a contribution extending my code and creating a loop to pull out all the matches. https://github.com/dmccuk/json_parsing_with_ansible On Tuesday, 22 March 2022 at 17:14:27 UTC dmc...@gmai

[ansible-project] Re: How to get desired data from JSON

2022-03-22 Thread dmc...@gmail.com
JSON isn't my strong point but I can pull out the individual elements and you wanted to create the msg. Hopefully this will help you to complete what you're trying to do. TASK [debug] ** ok: [lo

[ansible-project] Ansible: Can you register the Linux banner without logging in?

2022-03-22 Thread dmc...@gmail.com
I'm trying to capture the linux banner you see before you login to a Linux server - using Ansible. I don't want to login to the server, just get the banner. I was hoping to use register to save it, then use part of it's contents as a conditional for which tasks to run. Is this possible? I or

[ansible-project] Re: Unable to start kibana from ansible playbook

2022-03-04 Thread dmc...@gmail.com
Hi, For my ELK role I created a service each for elasticsearch, kibana and logstash. It just makes it easier to start and stop the ELK stack components and you can enable them at boot. You can see the role I created here with all the code: https://github.com/dmccuk/ansible_ELK/blob/master/roles

Re: [ansible-project] Retrieve facts from Ansible Setup module using JQ

2022-01-03 Thread dmc...@gmail.com
Thanks for that, It was exactly what I was looking for. I was so close... This is what I get: $ ansible localhost -m setup | sed '1 s/^.*$/{/' | jq '.ansible_facts | {hostname: .ansible_hostname, Disks: .ansible_devices | with_entries(.value |= .size), Partitions: [.ansible_devices[].partitio

[ansible-project] Retrieve facts from Ansible Setup module using JQ

2021-12-31 Thread dmc...@gmail.com
Is anyone good with ./JQ? I'm trying to pull out data from the setup output from Ansible. I can do most of what I need to but I'm stuck on something that is probably quite simple. I'm trying to generate a list of hosts including disks + sizes and partitions + sizes AND mount points. I can get

[ansible-project] Re: How to pass dynamic value of Ansible variable to Shell script variable and vice versa.

2021-12-22 Thread dmc...@gmail.com
Can you provide more detail with an example of a variable you are trying to pass? As I'm not sure what you need to set, this could help? Using set_fact: (example below), you can set a variable to be "something" based on a condition. So variable "DC" below, will become one of three variables "D

[ansible-project] Re: How to pass dynamic value of Ansible variable to Shell script variable and vice versa.

2021-12-22 Thread dmc...@gmail.com
Can you provide more detail with an example of a variable you are trying to pass? As I'm not sure what you need to set, this could help? Using set_fact: (example below), you can set a variable to be "something" based on a condition. So variable "DC" below, will become one of three variables "D

[ansible-project] Re: How to pass dynamic value of Ansible variable to Shell script variable and vice versa.

2021-12-22 Thread dmc...@gmail.com
Can you provide more detail with an example of a variable you are trying to pass? As I'm not sure what you need to set, this could help? Using set_fact: (example below), you can set a variable to be "something" based on a condition. So variable "DC" below, will become one of three variables "D

Re: [ansible-project] Print output of multiple host in a single file

2021-06-02 Thread dmc...@gmail.com
Have you tried Ansibledb? It seems a waste to only get one piece of information. AnsibleDB can take in the output of the setup module and store it so you can just run curl commands against the API and pull out the version you're after from all your cisco routers at once. in your case, you'd nee

[ansible-project] Re: Gathering facts from hosts

2021-04-13 Thread dmc...@gmail.com
If I'm understanding you correctly, you're creating facts, then you want to use the same just created facts in the same ansible run? If this is the case, you can reload the facts and use them in the playbook using something like this: - name: local facts debug: var=ansible_local notify: -

Re: [ansible-project] Issue creating a basic ansible dynamic inventory

2020-11-03 Thread dmc...@gmail.com
" }, "changed": false, "ping": "pong" } and it works? Is anyone able to tell me the difference? You help would be greatly appreciated. On Tuesday, 3 November 2020 at 10:19:24 UTC brae...@gmail.com wrote: > On 11/3/20 11:03 AM, dmc.

Re: [ansible-project] Issue creating a basic ansible dynamic inventory

2020-11-03 Thread dmc...@gmail.com
tput. Ansible cli will accept the file output being used with or without the last "," so it's odd for me. I'm supplying the list of hosts in a format that Ansible will run against based on the file (output of the script), but ansible won't take the same output from the scr

[ansible-project] Issue creating a basic ansible dynamic inventory

2020-11-03 Thread dmc...@gmail.com
I'm trying to create a basic dynamic inventory script for ansible based on json output. I'm new to jq but I've hit an issue where the dynamic script on ansible v2.9.14 & 2.9.15 doesn't like the output, but if I send the output to a file and then run Ansible against the output in the file, ansib

[ansible-project] Re: windows custom facts help

2020-09-17 Thread dmc...@gmail.com
"REGION": "eu-west-3", "Support_Team": "Win_Team", "cloud": "AWS", "environment": "DIT", "my_custom_fact": "value" }, On Friday, 18 Septe

[ansible-project] Re: windows custom facts help

2020-09-17 Thread dmc...@gmail.com
m >> wrote: >> >>> Just try it out and see for yourself. I have placed the following script >>> at C:\Windows\TEMP\facts\my_facts.ps1 with the contents >>> >>> @{ >>> my_custom_fact = 'value' >>> my_complex_custom_fa

[ansible-project] windows custom facts help

2020-09-16 Thread dmc...@gmail.com
Can anyone point me in the direction of how to setup custom/local facts on Windows please? not just use fact_path... Reading the docs I've found so far, it looks like you can't just have a file with key:value like Linux under the heading [local_facts] for example (unless you can? but setup does