[ansible-project] how to run a shell command within a playbook repeatedly

2021-10-20 Thread Hareesh Vn
Hi Team Below is problem description on which i need help. I am adding single mongo db shards by running below shell command -- this is working fine to install on one server - name: "Creating the database" command: "sh /tmp/add_shard.sh {{item}} {{mongo_user}} {{mongo_password}}"

Re: [ansible-project] how to run a shell command within a playbook repeatedly

2021-10-20 Thread Jorge Rúa
You can define a data structure, a dict for example containing number of shards per server an individual shard settings etc. Then just use with_sequence to iterate from 1 to length of the aforementioned shards list. On Wed, Oct 20, 2021, 08:02 Hareesh Vn wrote: > Hi Team > > Below is problem des

[ansible-project] Ansible Galaxy down?

2021-10-20 Thread Romain Pelisse
Hi, It seems Ansible Galaxy is down (at least for me): https://galaxy.ansible.com/ Error 1016 Ray ID: 6a1137627e9ed463 • 2021-10-20 09:28:30 UTC Origin DNS error What happened? You've requested a page on a website (galaxy.ansible.com) that is on the Cloudflare network. Cloudflare is currently u

[ansible-project] Re: Ansible Galaxy down?

2021-10-20 Thread John Dough
I can access the website, but ansible-builder has been failing for me all morning ERROR! Error when getting the collection info for community.general from default (https://galaxy.ansible.com/api/) (HTTP Code: 530, Message: Code: Unknown) STEP 9: FROM quay.io/ansible/ansible-builder:latest AS b

Re: [ansible-project] how to run a shell command within a playbook repeatedly

2021-10-20 Thread Hareesh Vn
can you please help me changing below code as per your suggestion of with_sequence? - name: "Creating the database" command: "sh /tmp/add_shard.sh {{item}} {{mongo_user}} {{mongo_password}}" register: mongo_db_shard_add ignore_errors: true with_items: "{{P_NODE}}" when

Re: [ansible-project] Re: Ansible Galaxy down?

2021-10-20 Thread Romain Pelisse
Strange because I really can't access the website (I did several refresh). Is there a twitter account or something else we can follow update on Ansible Galaxy status? On Wed, Oct 20, 2021 at 11:36 AM John Dough wrote: > I can access the website, but ansible-builder has been failing for me all >

Re: [ansible-project] Re: Ansible Galaxy down?

2021-10-20 Thread John Dough
Location based possibly? Galaxy is working again for me now, hopefully for you too. On Wednesday, 20 October 2021 at 10:55:23 UTC+1 rpel...@redhat.com wrote: > Strange because I really can't access the website (I did several refresh). > > Is there a twitter account or something else we can foll

[ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread dulhaver via Ansible Project
* I have this TASK in a playbook https://pastebin.com/h83HqMn0 which should install a bunch of packages on my (rhel8) target rrequired for postgresql * I am shooting my playbok as a user with root priviledges via sudo * In earlier TASKS of the playbook I become a 'postgres' user, but would expect

Re: [ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread Stefan Hornburg (Racke)
On 20/10/2021 15:26, dulhaver via Ansible Project wrote: * I have this TASK in a playbook which should install a bunch of packages on my (rhel8) target rrequired for postgresql * I am shooting my playbok as a user with root priviledges via sudo Please sh

Re: [ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread dulhaver via Ansible Project
> On 10/20/2021 3:32 PM Stefan Hornburg (Racke) mailto:ra...@linuxia.de > wrote: > > > On 20/10/2021 15:26, dulhaver via Ansible Project wrote: > > > > > > * I have this TASK in a playbook > which should install a bunch of packages o

Re: [ansible-project] Generate docs from ansible argspec

2021-10-20 Thread 'Felix Fontein' via Ansible Project
Hi, > Is there any way to generate a markdown documentation from ansible > role argument spec? > > https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-argument-validation > > I could not find anything in ansible-doc, the format itself suggests > that there is a way

Re: [ansible-project] Re: Ansible Galaxy down?

2021-10-20 Thread Romain Pelisse
Yes, sorry, I meant to mention it, but instead I jumped back into my work! My bad. On Wed, Oct 20, 2021 at 2:48 PM John Dough wrote: > Location based possibly? > > Galaxy is working again for me now, hopefully for you too. > > On Wednesday, 20 October 2021 at 10:55:23 UTC+1 rpel...@redhat.com wr

Re: [ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread Stefan Hornburg (Racke)
On 20/10/2021 15:49, dulhaver via Ansible Project wrote: On 10/20/2021 3:32 PM Stefan Hornburg (Racke) mailto:ra...@linuxia.de>> wrote: On 20/10/2021 15:26, dulhaver via Ansible Project wrote: > * I have this TASK in a playbook >

Re: [ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread dulhaver via Ansible Project
> On 10/20/2021 4:07 PM Stefan Hornburg (Racke) mailto:ra...@linuxia.de > wrote: > > > On 20/10/2021 15:49, dulhaver via Ansible Project wrote: > > > > > > > > > > > On 10/20/2021 3:32 PM Stefan Hornburg (Racke) > > mailto:ra...@linuxia.de

Re: [ansible-project] package TASK ... 'should be run under the root user'

2021-10-20 Thread Stefan Hornburg (Racke)
On 20/10/2021 16:45, dulhaver via Ansible Project wrote: On 10/20/2021 4:07 PM Stefan Hornburg (Racke) mailto:ra...@linuxia.de>> wrote: On 20/10/2021 15:49, dulhaver via Ansible Project wrote: On 10/20/2021 3:32 PM Stefan Hornburg (Racke) mailto:ra...@linuxia.de>

[ansible-project] Playbook Variable and Jinja 2 -- Namespace Problem?

2021-10-20 Thread John-Paul Pagano
ansible-playbook [core 2.11.5] python version = 3.9.7 (default, Sep 3 2021, 12:45:31) [Clang 12.0.0 (clang-1200.0.32.29)] jinja version = 2.11.3 Hi, I'm trying to write a play that will connect to a managed Windows node, gather a list of Windows Updates that are available to be installed

[ansible-project] ansible email and template

2021-10-20 Thread Mahesh Nalavade
Hi All, I am trying to send email in html but email body display the same html file. Playbook: --- - name: Sending an e-mail mail: host: X port: 25 from: XX to: "{{ to }}" subject: Reports attach: "{{ attach }}" body: Hi, Hope you are doing well.

Re: [ansible-project] ansible email and template

2021-10-20 Thread Matt Martz
You would need to send a multipart mime email, to allow an email client to properly render the HTML content, which the mail module provides no assistance with. As such, you would have to build a multipart body manually in your playbook or template, which will likely require some learning and effor

Re: [ansible-project] Playbook Variable and Jinja 2 -- Namespace Problem?

2021-10-20 Thread Clint Denham
Can you post a little of update_results? Sometimes with this error you just need to include the list reference. 0 being the first list. update_results.0.updstes[k] Once we get the entire update_results we can see for sure. On Wed, Oct 20, 2021, 12:25 PM John-Paul Pagano wrote: > ansible-play

Re: [ansible-project] Playbook Variable and Jinja 2 -- Namespace Problem?

2021-10-20 Thread Ryan Caudle
I thought we were on Jinja 3? On Wed, Oct 20, 2021, 6:48 PM Clint Denham wrote: > Can you post a little of update_results? > > Sometimes with this error you just need to include the list reference. 0 > being the first list. > > update_results.0.updstes[k] > > Once we get the entire update_result

Re: [ansible-project] how to run a shell command within a playbook repeatedly

2021-10-20 Thread Jorge Rúa
I would not run a shell script with the command module. You should use the script module instead. But ideally if you have the option use the mongodb_shard module. This piece of code actually uses with_sequence to illustrate how to generate a sequence of numbers that will then used to populate port

Re: [ansible-project] Playbook Variable and Jinja 2 -- Namespace Problem?

2021-10-20 Thread John-Paul Pagano
Sorry, i probably should have done that. Here's the output from a managed node that was left behind on patches for the purpose of testing. ok: [MY_IP] => { "update_results.updates": [ { "categories": [ "Definition Updates", "Microsoft Defend

Re: [ansible-project] Playbook Variable and Jinja 2 -- Namespace Problem?

2021-10-20 Thread John-Paul Pagano
Do you recommend upgrading to Jinja2 3.x for my version of Ansible? On Wednesday, October 20, 2021 at 6:55:39 PM UTC-4 caud...@gmail.com wrote: > I thought we were on Jinja 3? > > On Wed, Oct 20, 2021, 6:48 PM Clint Denham wrote: > >> Can you post a little of update_results? >> >> Sometimes with