Re: [ansible-project] aws community edition and collection

2020-06-04 Thread 'Felix Fontein' via Ansible Project
Hi,

> Thank you Matt, that worked, eventhough the collection is behind the
> github repository.
> 
> Any recommendation or guidance on setting up development environment
> will be highly appreciated.
> I did follow below document to set up development environment, but
> considering changes in ansible repository structure, not applicable
> for community modules any more:
> https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#common-environment-setup

that documentation is for Ansible 2.9. Until 2.10 has been released,
the devel docs are usually more helpful.

You might also be interested in
https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html
whose last section describes how to set up collections for development.

Cheers,
Felix


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200605083200.2388e736%40rovaniemi.


Re: [ansible-project] ALv2 reports odd data in ansible_distribution and ansible_os_family

2020-06-04 Thread Abhijeet Kasurde
Hi Thomas,

Thanks for reporting this. Could you please raise an issue against
'ansible/ansible' repo with the required details? Also, it would be helpful
to provide the output of this
https://github.com/ansible/ansible/blob/598e3392a9597f0214d68882da4f4ca07314ce41/hacking/tests/gen_distribution_version_testcase.py
script along with issue.

Thanks,

On Thu, Jun 4, 2020 at 8:46 PM 'Thomas Kern' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> We have just begun to use Ansible to manage some ALv2 instances in AWS. We
> manage RHEL 6/7, CentOS 6/7, OEL 6/7 in our home networks without problems.
> We have a playbook that gathers facts from servers and updates a local
> MySQL database. When this playbook runs against an ALv2 instance in AWS, it
> gets two facts that cannot nice be used as data for a MySQL insert. The
> ansible_distribution and ansible_os_family both come back as
> "NAME=\"Amazon". The values for RHEL7, CentOS7 and OEL7 are properly
> formated single words.
>
> (@y)$ ansible adminaws,gtlxgmsd02,gtlxgmsd04,gtlxgmsd03 -b -m
> setup | grep 'ansible_distribution"'
> "ansible_distribution": "NAME=\"Amazon",
> "ansible_distribution": "CentOS",
> "ansible_distribution": "OracleLinux",
> "ansible_distribution": "RedHat",
>
> I will be looking to clean the output of 'setup' for ALv2, but I would
> prefer that ALv2 look more like a normal derivative of RHEL 7. Does anyone
> know if this can be cleaned up via a configuration change on the ALv2
> instance or ansible?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/7bcfff42-be88-436c-80ee-fd85f267%40googlegroups.com
> 
> .
>


-- 
Thanks,
Abhijeet Kasurde

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFwWkHrobeLjRRZw5KrNc8BcCjEsYELdttpqMiDTEu0MBxf0PQ%40mail.gmail.com.


Re: [ansible-project] Multi threading support in Ansible

2020-06-04 Thread Jagadeeshkumar Dittakavi
Thank you Matt for the detailed and quick reply.. Much appreciated the 
support from the community.

On Friday, June 5, 2020 at 12:29:30 AM UTC+5:30, Matt Martz wrote:
>
> Yes, it would utilize the threading library in Python.  The GIL is a 
> primary cause to the CPU restrictions.  Our main process that orchestrates 
> all of the task executions is already heavily CPU bound, so adding 
> additional threads to the same core can cause a decrease in performance.  
> Assuming we create a process model plugin type, other process models are 
> possible, such as using asyncio, concurrent.futures, gevent, etc.  But I 
> don't expect this work to be complete any time soon.
>
> So for now, consider forking the only process model for the near future.
>
> On Thu, Jun 4, 2020 at 1:51 PM Jagadeeshkumar Dittakavi <
> d.jagad...@gmail.com > wrote:
>
>> Thank you for the prompt reply.. Just a curious question: Is the 
>> threading work that is underway based on python threads or pthreads or any 
>> other threading mechanism? As you mentioned that the threading model is not 
>> going to be performant, was the reason being the python's GIL?
>>
>>
>> On Friday, June 5, 2020 at 12:01:14 AM UTC+5:30, Matt Martz wrote:
>>>
>>> The only current process model is forking.  There has been some work 
>>> done to add a threaded process model, but there are some large hurdles to 
>>> overcome.
>>>
>>> In practice, it is not necessarily more performant, and in many cases it 
>>> was less performant, as it causes more CPU contention on a single core that 
>>> is already resource constrained.
>>>
>>> On Thu, Jun 4, 2020 at 1:18 PM Jagadeeshkumar Dittakavi <
>>> d.jagad...@gmail.com> wrote:
>>>
 I am a newbie to ansible but I got to explore how to run a tasks in 
 parallel by spawing a thread for each task instead of a process. My 
 requirement is to run the playbook on my localhost and there is no remote 
 task execution needed.
 I also would like to wait for all threads to complete before I move on 
 to a task that has to be serialised.

 Can I chose thread vs process when it comes to parallel task execution?
 If it is possible to spawn threads from ansible, are they equivalent to 
 python greenthreads or pthreads or something else?

 Thank you in advance!


 -- 
 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...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/ansible-project/0d59cf96-b053-4390-8dbb-663c70403104o%40googlegroups.com
  
 
 .

>>>
>>>
>>> -- 
>>> Matt Martz
>>> @sivel
>>> sivel.net
>>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/48f0ed5f-83c7-4bf4-a991-94ec78ce832eo%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/04da1e45-01fc-4842-9a4e-b53d4073ca38o%40googlegroups.com.


Re: [ansible-project] aws community edition and collection

2020-06-04 Thread Jordan Borean

>
> You've identified one of the many annoying parts of collections. You need 
> a special directory structure and you can't install from git in an editable 
> manner.


Admittedly you are right about the special directory structure but it's 
pretty trivial to install it from git in an editable manner. I do this for 
the Windows collections;

# Usually I have this in my ~/.bashrc where the last segment is my dev 
location
export ANSIBLE_COLLECTIONS_PATHS=~/.ansible/collections:/usr/share/ansible/
collections:~/ansible-dev
git clone g...@github.com:ansible-collections/ansible.windows.git ~
/ansible-dev/ansible_collections/ansible/windows

I won't lie and say this is a perfect scenario but it's just 2 commands, 
one of which can be set automatically in your profile.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c3c6a188-ff2c-4d5c-be96-774ce225023fo%40googlegroups.com.


Re: [ansible-project] aws community edition and collection

2020-06-04 Thread James Cassell


On Thu, Jun 4, 2020, at 8:37 PM, Sydo Luciani wrote:
> The only option that I can think of:
> pip install https://github.com/ansible/ansible/archive/devel.tar.gz
> git clone https://github.com/ansible-collections/community.aws.git
> cp community.aws/plugins/modules/my_module.py ~/.ansible/plugins/modules/
> 
> edit ~/.ansible/plugins/modules/my_module.py and then copy it back to 
> git repository to commit and push.
> 
> Any elegant solution ?
> How you guys at ansible have setup the development environment to 
> develop amazon.aws ?
> 

You've identified one of the many annoying parts of collections. You need a 
special directory structure and you can't install from git in an editable 
manner. There's no equivalent to `ansible-galaxy install -gr requirements.yml` 
that gives you a git repo you can edit and push and pull. You'll further find 
it difficult to type `ansible -m community.general.my_module ...` using the 
very long name versus the short name you've always used before.

V/r,
James Cassell

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7a7db11-1c36-475d-a834-ac12a58a5bf1%40www.fastmail.com.


Re: [ansible-project] aws community edition and collection

2020-06-04 Thread Sydo Luciani
The only option that I can think of:
pip install https://github.com/ansible/ansible/archive/devel.tar.gz
git clone https://github.com/ansible-collections/community.aws.git
cp community.aws/plugins/modules/my_module.py ~/.ansible/plugins/modules/

edit  ~/.ansible/plugins/modules/my_module.py and then copy it back to git
repository to commit and push.

Any elegant solution ?
How you guys at ansible have setup the development environment to develop
amazon.aws ?

Thanks


On Thu, 4 Jun 2020 at 19:15, Sydo Luciani  wrote:

> Thank you Matt, that worked, eventhough the collection is behind the
> github repository.
>
> Any recommendation or guidance on setting up development environment will
> be highly appreciated.
> I did follow below document to set up development environment, but
> considering changes in ansible repository structure, not applicable for
> community modules any more:
>
> https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#common-environment-setup
>
>
>
>
>
> On Thu, 4 Jun 2020 at 16:35, Matt Martz  wrote:
>
>> Collections are not pip installable.
>>
>> Instead you want to do:
>>
>> pip install https://github.com/ansible/ansible/archive/devel.tar.gz
>> ansible-galaxy collection install amazon.aws
>>
>> On Thu, Jun 4, 2020 at 4:32 PM Sydo Luciani 
>> wrote:
>>
>>> Thank you for quick reply.
>>>
>>> What is the procedure to install Ansible version 10 along with
>>> amazon.aws and community.aws
>>>
>>> I was able to install Ansible version 10 from repository:
>>> pip install git+https://github.com/ansible/ansible.git
>>>
>>> but getting error installing modules from community.aws:
>>> pip install git+https://github.com/ansible-collections/community.aws.git
>>>
>>> community.aws.git does not have all required files to be installable by
>>> pip.
>>>
>>>
>>> Thanks
>>>
>>> On Wednesday, 3 June 2020 10:47:15 UTC-5, Matt Martz wrote:

 Largely the split was done between what was previously "core" supported
 and what was community supported.

 amazon.aws is supported by Red Hat/Ansible employees, and community.aws
 is technically supported by the community.

 New modules/plugins should almost definitely be submitted to
 community.aws, and if it is deemed it should be supported, it can be moved
 at a later date.

 On Wed, Jun 3, 2020 at 10:40 AM Sydo Luciani 
 wrote:

> aws modules have been redirected/moved to two different repositories,
> some to community.aws and some to amazon.aws
>
> https://github.com/ansible-collections/amazon.aws
> https://github.com/ansible-collections/community.aws
>
>
> My first question is, what was the criteria for moving each modules to
> different repositories ? so we know the correct place to submit future aws
> modules !!! is there a change log for this move ?
>
> My second question is for those with more experience with Ansible and
> github:
> isn't better to make the amazon.aws plugin directory be the sub
> repository/sub module/fork or mirror of community.aws plugin directory ?
> this way modules and plugins version and code stay the same in both, while
> one will be used as collection and one as module 
>
> Thanks
>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAJspodgXNZsv1BvE1GtTWPrLW_b9o-wAs%3Dt5np1-xa1kKJJ%3D2w%40mail.gmail.com
> 
> .
>


 --
 Matt Martz
 @sivel
 sivel.net

>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/8477201e-a72a-45a5-a610-1d795fe21199o%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAD8N0v8JdgJSqP7b8GFqnp7ViWnPDqXJHBQUyrz0hiDSmR1hvg%40mail.gmail.com
>> 

Re: [ansible-project] aws community edition and collection

2020-06-04 Thread Sydo Luciani
Thank you Matt, that worked, eventhough the collection is behind the github
repository.

Any recommendation or guidance on setting up development environment will
be highly appreciated.
I did follow below document to set up development environment, but
considering changes in ansible repository structure, not applicable for
community modules any more:
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#common-environment-setup





On Thu, 4 Jun 2020 at 16:35, Matt Martz  wrote:

> Collections are not pip installable.
>
> Instead you want to do:
>
> pip install https://github.com/ansible/ansible/archive/devel.tar.gz
> ansible-galaxy collection install amazon.aws
>
> On Thu, Jun 4, 2020 at 4:32 PM Sydo Luciani 
> wrote:
>
>> Thank you for quick reply.
>>
>> What is the procedure to install Ansible version 10 along with amazon.aws
>> and community.aws
>>
>> I was able to install Ansible version 10 from repository:
>> pip install git+https://github.com/ansible/ansible.git
>>
>> but getting error installing modules from community.aws:
>> pip install git+https://github.com/ansible-collections/community.aws.git
>>
>> community.aws.git does not have all required files to be installable by
>> pip.
>>
>>
>> Thanks
>>
>> On Wednesday, 3 June 2020 10:47:15 UTC-5, Matt Martz wrote:
>>>
>>> Largely the split was done between what was previously "core" supported
>>> and what was community supported.
>>>
>>> amazon.aws is supported by Red Hat/Ansible employees, and community.aws
>>> is technically supported by the community.
>>>
>>> New modules/plugins should almost definitely be submitted to
>>> community.aws, and if it is deemed it should be supported, it can be moved
>>> at a later date.
>>>
>>> On Wed, Jun 3, 2020 at 10:40 AM Sydo Luciani  wrote:
>>>
 aws modules have been redirected/moved to two different repositories,
 some to community.aws and some to amazon.aws

 https://github.com/ansible-collections/amazon.aws
 https://github.com/ansible-collections/community.aws


 My first question is, what was the criteria for moving each modules to
 different repositories ? so we know the correct place to submit future aws
 modules !!! is there a change log for this move ?

 My second question is for those with more experience with Ansible and
 github:
 isn't better to make the amazon.aws plugin directory be the sub
 repository/sub module/fork or mirror of community.aws plugin directory ?
 this way modules and plugins version and code stay the same in both, while
 one will be used as collection and one as module 

 Thanks

 --
 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...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/ansible-project/CAJspodgXNZsv1BvE1GtTWPrLW_b9o-wAs%3Dt5np1-xa1kKJJ%3D2w%40mail.gmail.com
 
 .

>>>
>>>
>>> --
>>> Matt Martz
>>> @sivel
>>> sivel.net
>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/8477201e-a72a-45a5-a610-1d795fe21199o%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAD8N0v8JdgJSqP7b8GFqnp7ViWnPDqXJHBQUyrz0hiDSmR1hvg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJspodjSC6An-ZiP_qk96p4tQUEnF_1jSPX%3Dd9ViGrKBig_C1A%40mail.gmail.com.


[ansible-project] Re: Use Ansible to Install SharePoint Server Updates

2020-06-04 Thread Jordan Borean
If the task is trying to install updates then you are typically restricted 
by Windows over a network logon like WinRM. The way around this that 
Ansible provides is the become [1]. This turns the logon type to an 
interactive logon which is allowed to install Windows updates just like you 
can when running it manually.

[1] - 
https://docs.ansible.com/ansible/latest/user_guide/become.html#become-and-windows

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d7ab32f3-52d0-4470-9f70-4508a8b9d0e4o%40googlegroups.com.


Re: [ansible-project] aws community edition and collection

2020-06-04 Thread Matt Martz
Collections are not pip installable.

Instead you want to do:

pip install https://github.com/ansible/ansible/archive/devel.tar.gz
ansible-galaxy collection install amazon.aws

On Thu, Jun 4, 2020 at 4:32 PM Sydo Luciani  wrote:

> Thank you for quick reply.
>
> What is the procedure to install Ansible version 10 along with amazon.aws
> and community.aws
>
> I was able to install Ansible version 10 from repository:
> pip install git+https://github.com/ansible/ansible.git
>
> but getting error installing modules from community.aws:
> pip install git+https://github.com/ansible-collections/community.aws.git
>
> community.aws.git does not have all required files to be installable by
> pip.
>
>
> Thanks
>
> On Wednesday, 3 June 2020 10:47:15 UTC-5, Matt Martz wrote:
>>
>> Largely the split was done between what was previously "core" supported
>> and what was community supported.
>>
>> amazon.aws is supported by Red Hat/Ansible employees, and community.aws
>> is technically supported by the community.
>>
>> New modules/plugins should almost definitely be submitted to
>> community.aws, and if it is deemed it should be supported, it can be moved
>> at a later date.
>>
>> On Wed, Jun 3, 2020 at 10:40 AM Sydo Luciani  wrote:
>>
>>> aws modules have been redirected/moved to two different repositories,
>>> some to community.aws and some to amazon.aws
>>>
>>> https://github.com/ansible-collections/amazon.aws
>>> https://github.com/ansible-collections/community.aws
>>>
>>>
>>> My first question is, what was the criteria for moving each modules to
>>> different repositories ? so we know the correct place to submit future aws
>>> modules !!! is there a change log for this move ?
>>>
>>> My second question is for those with more experience with Ansible and
>>> github:
>>> isn't better to make the amazon.aws plugin directory be the sub
>>> repository/sub module/fork or mirror of community.aws plugin directory ?
>>> this way modules and plugins version and code stay the same in both, while
>>> one will be used as collection and one as module 
>>>
>>> Thanks
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAJspodgXNZsv1BvE1GtTWPrLW_b9o-wAs%3Dt5np1-xa1kKJJ%3D2w%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8477201e-a72a-45a5-a610-1d795fe21199o%40googlegroups.com
> 
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8JdgJSqP7b8GFqnp7ViWnPDqXJHBQUyrz0hiDSmR1hvg%40mail.gmail.com.


Re: [ansible-project] aws community edition and collection

2020-06-04 Thread Sydo Luciani
Thank you for quick reply.

What is the procedure to install Ansible version 10 along with amazon.aws 
and community.aws

I was able to install Ansible version 10 from repository:
pip install git+https://github.com/ansible/ansible.git

but getting error installing modules from community.aws:
pip install git+https://github.com/ansible-collections/community.aws.git

community.aws.git does not have all required files to be installable by pip.


Thanks

On Wednesday, 3 June 2020 10:47:15 UTC-5, Matt Martz wrote:
>
> Largely the split was done between what was previously "core" supported 
> and what was community supported.
>
> amazon.aws is supported by Red Hat/Ansible employees, and community.aws is 
> technically supported by the community.
>
> New modules/plugins should almost definitely be submitted to 
> community.aws, and if it is deemed it should be supported, it can be moved 
> at a later date.
>
> On Wed, Jun 3, 2020 at 10:40 AM Sydo Luciani  > wrote:
>
>> aws modules have been redirected/moved to two different repositories, 
>> some to community.aws and some to amazon.aws
>>
>> https://github.com/ansible-collections/amazon.aws  
>> https://github.com/ansible-collections/community.aws 
>>
>>  
>> My first question is, what was the criteria for moving each modules to 
>> different repositories ? so we know the correct place to submit future aws 
>> modules !!! is there a change log for this move ?
>>
>> My second question is for those with more experience with Ansible and 
>> github:
>> isn't better to make the amazon.aws plugin directory be the sub 
>> repository/sub module/fork or mirror of community.aws plugin directory ? 
>> this way modules and plugins version and code stay the same in both, while 
>> one will be used as collection and one as module 
>>
>> Thanks
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAJspodgXNZsv1BvE1GtTWPrLW_b9o-wAs%3Dt5np1-xa1kKJJ%3D2w%40mail.gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8477201e-a72a-45a5-a610-1d795fe21199o%40googlegroups.com.


Re: [ansible-project] Syntax errors with Jinja2 control structures in tasks file

2020-06-04 Thread Brian Coca
That is because that is not a feature of Ansible.

Ansible parses the files using a YAML loader, then it does use jinja2
internally for templating, but only on SOME of the values in the data
structure returned by YAML.

--
Brian Coca

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACVha7ddKG2-6zGO0%2B7FF-jKBTwopKwx8axpNO2V1M172%3DnF9A%40mail.gmail.com.


[ansible-project] Syntax errors with Jinja2 control structures in tasks file

2020-06-04 Thread Alexander Z
Hi Ansible community,

I am observing syntax error on attempt to use Jinja2 control structures in 
the tasks file:

*Code*
/opt/ansible/roles/network/tasks/network.yml:

> {% if publicavailable|default(False) == False and public|default("") == "" 
> and datacenter != "XXX" and datacenter != "YYY" %}
> {% set private_interface = ansible_default_ipv4.interface %}
> {% else %}
> {% set private_interface = 
> ansible_default_ipv4.interface|regex_replace('\d+','')|string + 
> (ansible_default_ipv4.interface|regex_replace('\D+','')|int+1)|string %}
> {% endif %}
> - name: alias interface on private servers
>   template:
> src: if_internal_eth.j2
> dest: /etc/network/interfaces.d/if_{{ private_interface }}_0.cfg
> owner: root
> group: root
> mode: 0644
>   when: 'datacenter != "XXX" and datacenter != "YYY" and 
> vlan_prefix2|default("") != ""'


*Error*

> fatal: [host.domain.tld]: FAILED! => {"reason": "Syntax Error while 
> loading YAML.
>   found character that cannot start any token
> The error appears to have been in 
> /opt/ansible/roles/network/tasks/network.yml: line 52, column 2, but may
> be elsewhere in the file depending on the exact syntax problem.
> The offending line appears to be:
>
> {% if publicavailable|default(False) == False and public|default(\"\") == 
> \"\" and datacenter != \"XXX\" and datacenter != \"YYY\" %}
>  ^ here
> "}


*Versions*
ansible 2.5.10
python version = 2.7.12
Ubuntu 16.04.3 LTS


Kindly advise!
Thank you,
Alex

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a459b886-61a0-43af-a2e4-e77045adf756o%40googlegroups.com.


Re: [ansible-project] Need info on creating V2P through Ansible.

2020-06-04 Thread venkat ramu
We have few vm in hyper-v (win 10)and want those VM to convert and install
on laptops.

presently we are capturing it as a wim and then installing it on the
laptop. This is a manual process and I want to convert it to automation
using an orchestrator tool.

Thanks,
Venkat

On Thu, Jun 4, 2020 at 8:34 PM Dick Visser  wrote:

> What does this process look like?
>
> On Thu, 4 Jun 2020 at 15:35, venkat ramu  wrote:
> >
> > Please let me know is it possible to convert virtual machine (hyper-v)
> to physical using ansible?
> >
> > Thanks,
> > Venkat
> >
> > --
> > 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAAJ9_gZL90cJ9TcDAc00d4o%3Dp_-UBxUF173yqW%3D2Vt98UybTxA%40mail.gmail.com
> .
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwPMSuLi9xbOygezaw-f_yeXJXO5KOGi7cyA-d-4mrU_QQ%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAJ9_gbRme%2Bx%3DJRr5Di42CitXsa0FSokX3sEEZTTjPP81O0DTA%40mail.gmail.com.


Re: [ansible-project] Multi threading support in Ansible

2020-06-04 Thread Matt Martz
Yes, it would utilize the threading library in Python.  The GIL is a
primary cause to the CPU restrictions.  Our main process that orchestrates
all of the task executions is already heavily CPU bound, so adding
additional threads to the same core can cause a decrease in performance.
Assuming we create a process model plugin type, other process models are
possible, such as using asyncio, concurrent.futures, gevent, etc.  But I
don't expect this work to be complete any time soon.

So for now, consider forking the only process model for the near future.

On Thu, Jun 4, 2020 at 1:51 PM Jagadeeshkumar Dittakavi <
d.jagadeeshku...@gmail.com> wrote:

> Thank you for the prompt reply.. Just a curious question: Is the threading
> work that is underway based on python threads or pthreads or any other
> threading mechanism? As you mentioned that the threading model is not going
> to be performant, was the reason being the python's GIL?
>
>
> On Friday, June 5, 2020 at 12:01:14 AM UTC+5:30, Matt Martz wrote:
>>
>> The only current process model is forking.  There has been some work done
>> to add a threaded process model, but there are some large hurdles to
>> overcome.
>>
>> In practice, it is not necessarily more performant, and in many cases it
>> was less performant, as it causes more CPU contention on a single core that
>> is already resource constrained.
>>
>> On Thu, Jun 4, 2020 at 1:18 PM Jagadeeshkumar Dittakavi <
>> d.jagad...@gmail.com> wrote:
>>
>>> I am a newbie to ansible but I got to explore how to run a tasks in
>>> parallel by spawing a thread for each task instead of a process. My
>>> requirement is to run the playbook on my localhost and there is no remote
>>> task execution needed.
>>> I also would like to wait for all threads to complete before I move on
>>> to a task that has to be serialised.
>>>
>>> Can I chose thread vs process when it comes to parallel task execution?
>>> If it is possible to spawn threads from ansible, are they equivalent to
>>> python greenthreads or pthreads or something else?
>>>
>>> Thank you in advance!
>>>
>>>
>>> --
>>> 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...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/0d59cf96-b053-4390-8dbb-663c70403104o%40googlegroups.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Matt Martz
>> @sivel
>> sivel.net
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/48f0ed5f-83c7-4bf4-a991-94ec78ce832eo%40googlegroups.com
> 
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9LWHdjHK7KLP-AsJt1CuO0GBVzpdzJg6Ha8MiftgFvUQ%40mail.gmail.com.


Re: [ansible-project] Multi threading support in Ansible

2020-06-04 Thread Jagadeeshkumar Dittakavi
Thank you for the prompt reply.. Just a curious question: Is the threading 
work that is underway based on python threads or pthreads or any other 
threading mechanism? As you mentioned that the threading model is not going 
to be performant, was the reason being the python's GIL?


On Friday, June 5, 2020 at 12:01:14 AM UTC+5:30, Matt Martz wrote:
>
> The only current process model is forking.  There has been some work done 
> to add a threaded process model, but there are some large hurdles to 
> overcome.
>
> In practice, it is not necessarily more performant, and in many cases it 
> was less performant, as it causes more CPU contention on a single core that 
> is already resource constrained.
>
> On Thu, Jun 4, 2020 at 1:18 PM Jagadeeshkumar Dittakavi <
> d.jagad...@gmail.com > wrote:
>
>> I am a newbie to ansible but I got to explore how to run a tasks in 
>> parallel by spawing a thread for each task instead of a process. My 
>> requirement is to run the playbook on my localhost and there is no remote 
>> task execution needed.
>> I also would like to wait for all threads to complete before I move on to 
>> a task that has to be serialised.
>>
>> Can I chose thread vs process when it comes to parallel task execution?
>> If it is possible to spawn threads from ansible, are they equivalent to 
>> python greenthreads or pthreads or something else?
>>
>> Thank you in advance!
>>
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/0d59cf96-b053-4390-8dbb-663c70403104o%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Matt Martz
> @sivel
> sivel.net
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/48f0ed5f-83c7-4bf4-a991-94ec78ce832eo%40googlegroups.com.


Re: [ansible-project] Multi threading support in Ansible

2020-06-04 Thread Matt Martz
The only current process model is forking.  There has been some work done
to add a threaded process model, but there are some large hurdles to
overcome.

In practice, it is not necessarily more performant, and in many cases it
was less performant, as it causes more CPU contention on a single core that
is already resource constrained.

On Thu, Jun 4, 2020 at 1:18 PM Jagadeeshkumar Dittakavi <
d.jagadeeshku...@gmail.com> wrote:

> I am a newbie to ansible but I got to explore how to run a tasks in
> parallel by spawing a thread for each task instead of a process. My
> requirement is to run the playbook on my localhost and there is no remote
> task execution needed.
> I also would like to wait for all threads to complete before I move on to
> a task that has to be serialised.
>
> Can I chose thread vs process when it comes to parallel task execution?
> If it is possible to spawn threads from ansible, are they equivalent to
> python greenthreads or pthreads or something else?
>
> Thank you in advance!
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/0d59cf96-b053-4390-8dbb-663c70403104o%40googlegroups.com
> 
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9K-t60p4J%2B6jBWjs%3DQRXFPP0PYFh1NrMeOfZ8aJ_QcXw%40mail.gmail.com.


[ansible-project] Multi threading support in Ansible

2020-06-04 Thread Jagadeeshkumar Dittakavi
I am a newbie to ansible but I got to explore how to run a tasks in 
parallel by spawing a thread for each task instead of a process. My 
requirement is to run the playbook on my localhost and there is no remote 
task execution needed.
I also would like to wait for all threads to complete before I move on to a 
task that has to be serialised.

Can I chose thread vs process when it comes to parallel task execution?
If it is possible to spawn threads from ansible, are they equivalent to 
python greenthreads or pthreads or something else?

Thank you in advance!


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0d59cf96-b053-4390-8dbb-663c70403104o%40googlegroups.com.


[ansible-project] Sync module delete option not working

2020-06-04 Thread Ankit
Hello All,

I am trying to sync all files and directories between two directories 
however for some reason, *delete* option is not working. Following is my 
task, this works properly except when some directory is deleted fro source, 
the same is not deleted in destination even thought both *delete: yes* and 
*recursive: 
true* are set. Kindly suggest.

   - name: "STEP 4: Synchronization of Updates from Repo to deploymet_apps 
directory"
 synchronize:
   src: "{{ item }}"
   dest: "/home/DS/ads.anksharma/deployment-apps"
   delete: yes
   recursive: true
 with_items: "{{ Files }}"
 delegate_to: localhost


*Output:*
TASK [STEP 4: Synchronization of Updates from Repo to deployment_apps 
directory] 
*
ok: [localhost -> localhost] => (item=/root/13532/deployment-apps/
app_demoapp)
ok: [localhost -> localhost] => (item=/root/13532/deployment-apps/
app_SPLWindowsinstall)
ok: [localhost -> localhost] => (item=/root/13532/deployment-apps/app_test)
ok: [localhost -> localhost] => (item=/root/13532/deployment-apps/
app_SPLLinuxinstall)


PLAY RECAP 
**
localhost  : ok=4changed=1unreachable=0failed=0 
   skipped=0rescued=0ignored=0



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a2dc5f01-33c4-4715-b35c-933566c8bc5e%40googlegroups.com.


[ansible-project] ALv2 reports odd data in ansible_distribution and ansible_os_family

2020-06-04 Thread 'Thomas Kern' via Ansible Project
We have just begun to use Ansible to manage some ALv2 instances in AWS. We 
manage RHEL 6/7, CentOS 6/7, OEL 6/7 in our home networks without problems. 
We have a playbook that gathers facts from servers and updates a local 
MySQL database. When this playbook runs against an ALv2 instance in AWS, it 
gets two facts that cannot nice be used as data for a MySQL insert. The 
ansible_distribution and ansible_os_family both come back as 
"NAME=\"Amazon". The values for RHEL7, CentOS7 and OEL7 are properly 
formated single words.

(@y)$ ansible adminaws,gtlxgmsd02,gtlxgmsd04,gtlxgmsd03 -b -m setup 
| grep 'ansible_distribution"'
"ansible_distribution": "NAME=\"Amazon", 
"ansible_distribution": "CentOS", 
"ansible_distribution": "OracleLinux", 
"ansible_distribution": "RedHat",  

I will be looking to clean the output of 'setup' for ALv2, but I would 
prefer that ALv2 look more like a normal derivative of RHEL 7. Does anyone 
know if this can be cleaned up via a configuration change on the ALv2 
instance or ansible?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7bcfff42-be88-436c-80ee-fd85f267%40googlegroups.com.


Re: [ansible-project] Need info on creating V2P through Ansible.

2020-06-04 Thread Dick Visser
What does this process look like?

On Thu, 4 Jun 2020 at 15:35, venkat ramu  wrote:
>
> Please let me know is it possible to convert virtual machine (hyper-v) to 
> physical using ansible?
>
> Thanks,
> Venkat
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAAJ9_gZL90cJ9TcDAc00d4o%3Dp_-UBxUF173yqW%3D2Vt98UybTxA%40mail.gmail.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwPMSuLi9xbOygezaw-f_yeXJXO5KOGi7cyA-d-4mrU_QQ%40mail.gmail.com.


[ansible-project] Running Ruby 2.6 from /etc/profile.d via Ansible Playbook in RHEL 7

2020-06-04 Thread harry devine
I have a role I'm testing that will install Redmine (www.redmine.org) on to 
a RHEL 7.8 machine.  Redmine requires Ruby >= 2.3.  So I'm installing Ruby 
2.6.2 via the rhel-server-rhscl-7-rpms repository.  If I log into the 
machine manually and check the Ruby version, its 2.6.2.  However, when I 
connect via my Ansible playbook, Ruby is the default 2.0, so I can't get 
any of the Ruby Gems to install since the version is too old.

Here's the relevant plays/errors:
The /etc/profile.d/enableruby26.sh, as installed by another role i wrote 
that installs Ruby 2.6.2 and uploads this script to /etc/profile.d:

#!/bin/bash
source scl_source enable rh-ruby26

Play:
- name: Make sure to run the newer Ruby if necessary
  shell: source /etc/profile.d/enableruby26.sh
  when: ansible_os_family == 'RedHat' and 
ansible_distribution_major_version == '7'


Errors:
TASK [redmine : Verify Ruby version] 
***
changed: [role-test]

TASK [redmine : Print Ruby version] 

ok: [role-test] => {
"msg": "ruby 2.0.0p648 (2015-12-16) [x86_64-linux]"
}

TASK [redmine : Obtain gem path] 
***
changed: [role-test]

TASK [redmine : Print gem path] 

ok: [role-test] => {
"msg": "/bin/gem"
}

TASK [redmine : Install latest Bundler gem (RHEL 7)] 
***
fatal: [role-test]: FAILED! => {"changed": false, "cmd": 
"/opt/rh/rh-ruby26/root/usr/bin/gem query --remote -n '^bundler$'", "msg": 
"/opt/rh/rh-ruby26/root/usr/bin/ruby: error while loading shared libraries: 
libruby.so.2.6: cannot open shared object file: No such file or directory", 
"rc": 127, "stderr": "/opt/rh/rh-ruby26/root/usr/bin/ruby: error while 
loading shared libraries: libruby.so.2.6: cannot open shared object file: 
No such file or directory\n", "stderr_lines": 
["/opt/rh/rh-ruby26/root/usr/bin/ruby: error while loading shared 
libraries: libruby.so.2.6: cannot open shared object file: No such file or 
directory"], "stdout": "", "stdout_lines": []}

So, how do I get the /etc/profile.d/enableruby26.sh to run and have its 
variables available within my Ansible playbook?

Thanks,
Harry

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/d5eff318-a054-4109-88ef-2a3ebffa0eb7%40googlegroups.com.


[ansible-project] Need info on creating V2P through Ansible.

2020-06-04 Thread venkat ramu
Please let me know is it possible to convert virtual machine (hyper-v) to
physical using ansible?

Thanks,
Venkat

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAJ9_gZL90cJ9TcDAc00d4o%3Dp_-UBxUF173yqW%3D2Vt98UybTxA%40mail.gmail.com.


Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Dick Visser
On Thu, 4 Jun 2020 at 14:07, Shifa Shaikh  wrote:
>
> Dick Hi,
>
> That was a typo; however, the problem remains!! Writing to a file is all good 
> with newline while writing to email body does not translate "\n" as new line 
> !! Could this be a bug? Kindly suggest.

Just tried it out and it works fine here.
Can you show again the complete playbook? Including the task where the
body is generated?
That must be the issue I think.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwNouf6LhHh7EouUEFjtF3u47%2BOz70oxm2EL9-eaCoku5A%40mail.gmail.com.


Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
Dick Hi,

That was a typo; however, the problem remains!! Writing to a file is all
good with newline while writing to email body does not translate "\n" as
new line !! Could this be a bug? Kindly suggest.

On Thu, Jun 4, 2020 at 3:37 PM Dick Visser  wrote:

> On Thu, 4 Jun 2020 at 10:50, Shifa Shaikh  wrote:
> >
> > I see the problem is different than the direction we are debugging.
> >
> > When i write the variable to a file i see new lines but when the
> variable  assigned to email body it does not interpolate the new line
> instead prints '\n'
> >
> >- copy
> > content: "{{ mailbody }}"
> > dest: /tmp/write.log
> >
> >
> >
> > - name: Send mail
> >   mail:
> >   host: localhost:
>
> There is an extra ':' here?
>
> >   port: 25
> >   subject: :Hi"
>
> There is an extra ':' here?
>
> >   body: "{{ mailbody }}"
> >   from: m...@myshop.com
> >   to: y...@yourmail.com
>
>
> > Can you please suggest?
>
> You already put two errors in your task which prevent it from running
> correctly.
> So in that light, i'm wondering if your actual task does, in fact,
> contain more differences than what you've posted here.
>
> Also, "prints '\n'" indicates that you're echoing? and not mailing?
>
>
>
> >
> > On Thursday, June 4, 2020 at 1:26:56 PM UTC+5:30, Stefan Hornburg
> (Racke) wrote:
> >>
> >> On 6/4/20 8:54 AM, Shifa Shaikh wrote:
> >> > I tried multiline too as below, but that too fails
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}" + "\n"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >>
> >> Please try:
> >>
> >> mailbody: |
> >>   {{ mailbody | default('') }}PROFILE_NAME: {{ PROFILE_NAME }}
> >>   SERVER_NAME: + {{ SERVER_NAME }}
> >>
> >> Regards
> >>  Racke
> >>
> >> >
> >>
> >> > Output:
> >> > ['"PROFILE_NAME: SPROD01" + "[file://\\n"\n]\\n"\n"SERVER_NAME:
> SPROD01SRV01"\n', '"PROFILE_NAME: SPROD02" +
> >> > "[file://\\n"\n]\\n"\n"SERVER_NAME: SPROD02SRV02"\n']
> >> >
> >> > Also tried:
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >> > and
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}" + "\\n"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >> > On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke) <
> ra...@linuxia.de > wrote:
> >> >
> >> > On 6/4/20 7:21 AM, Shifa Shaikh wrote:
> >> > > Stephan Hi,
> >> > >
> >> > > The article does not discuss newline inside parenthesis `{{`
> inside a variable definition. That is where I have no
> >> > clue.
> >> >
> >> >
> >> > Hello Shifa,
> >> >
> >> > parenthesis are fine inside multiline YAML.
> >> >
> >> > Regards
> >> >  Racke
> >> >
> >> > >
> >> > > On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan
> Hornburg (Racke) wrote:
> >> > >
> >> > > On 6/4/20 6:41 AM, Shifa Shaikh wrote:
> >> > > > I tried all of these but have no clue to a solution.
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME + "\n" + 'SERVER_NAME:' + SERVER_NAME
> >> > + "\n" +
> >> > > > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}"
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME + '\n' + 'SERVER_NAME:' + SERVER_NAME
> >> > + '\n' +
> >> > > > 'NODE_NAME:' +  NODE_NAME + '\n\n\n\n\' }}"
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME ~ }} \n + {{ 'SERVER_NAME:' +
> >> > SERVER_NAME ~
> >> > > }} +
> >> > > > \n + {{ 'NODE_NAME:' +  NODE_NAME ~ }} \n\n\n\n\"
> >> > > >
> >> > > >
> >> > >
> >> > > Use multiline YAML: https://yaml-multiline.info/
> >> > >
> >> > > Regards
> >> > > Racke
> >> > >
> >> > >
> >> > > > On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa
> Shaikh wrote:
> >> > > >
> >> > > > @Dick VIsser Hi,
> >> > > >
> >> > > > Upon your suggestion, I tried something like this but
> it too does not work.
> >> > > >
> >> > > > |
> >> > > >-set_fact:
> >> > > >
> >> > > >mailbody:"{{ mailbody | default('') +
> 'PROFILE_NAME:' +  PROFILE_NAME ~ \"\n\n\"'SERVER_NAME:' +
> >> > > SERVER_NAME
> >> > > > ~ \"\n\n\"'NODE_NAME:' +  NODE_NAME ~ \"\n\n\n\n\" }}"
> >> > > > |
> >> > > >
> >> > > > Can someone please suggest?
> >> > > >
> >> > > > On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30,
> Dick Visser wrote:
> >> > 

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
@Dick Hi,

That was a typo the problem remains writing to a file is all good with
newlines while writing to email body does not translate "\n" as new line !!
Could this be a bug ?

On Thu, Jun 4, 2020 at 3:37 PM Dick Visser  wrote:

> On Thu, 4 Jun 2020 at 10:50, Shifa Shaikh  wrote:
> >
> > I see the problem is different than the direction we are debugging.
> >
> > When i write the variable to a file i see new lines but when the
> variable  assigned to email body it does not interpolate the new line
> instead prints '\n'
> >
> >- copy
> > content: "{{ mailbody }}"
> > dest: /tmp/write.log
> >
> >
> >
> > - name: Send mail
> >   mail:
> >   host: localhost:
>
> There is an extra ':' here?
>
> >   port: 25
> >   subject: :Hi"
>
> There is an extra ':' here?
>
> >   body: "{{ mailbody }}"
> >   from: m...@myshop.com
> >   to: y...@yourmail.com
>
>
> > Can you please suggest?
>
> You already put two errors in your task which prevent it from running
> correctly.
> So in that light, i'm wondering if your actual task does, in fact,
> contain more differences than what you've posted here.
>
> Also, "prints '\n'" indicates that you're echoing? and not mailing?
>
>
>
> >
> > On Thursday, June 4, 2020 at 1:26:56 PM UTC+5:30, Stefan Hornburg
> (Racke) wrote:
> >>
> >> On 6/4/20 8:54 AM, Shifa Shaikh wrote:
> >> > I tried multiline too as below, but that too fails
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}" + "\n"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >>
> >> Please try:
> >>
> >> mailbody: |
> >>   {{ mailbody | default('') }}PROFILE_NAME: {{ PROFILE_NAME }}
> >>   SERVER_NAME: + {{ SERVER_NAME }}
> >>
> >> Regards
> >>  Racke
> >>
> >> >
> >>
> >> > Output:
> >> > ['"PROFILE_NAME: SPROD01" + "[file://\\n"\n]\\n"\n"SERVER_NAME:
> SPROD01SRV01"\n', '"PROFILE_NAME: SPROD02" +
> >> > "[file://\\n"\n]\\n"\n"SERVER_NAME: SPROD02SRV02"\n']
> >> >
> >> > Also tried:
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >> > and
> >> >
> >> >mailbody: |
> >> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME
> }}" + "\\n"
> >> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> >> >
> >> > On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke) <
> ra...@linuxia.de > wrote:
> >> >
> >> > On 6/4/20 7:21 AM, Shifa Shaikh wrote:
> >> > > Stephan Hi,
> >> > >
> >> > > The article does not discuss newline inside parenthesis `{{`
> inside a variable definition. That is where I have no
> >> > clue.
> >> >
> >> >
> >> > Hello Shifa,
> >> >
> >> > parenthesis are fine inside multiline YAML.
> >> >
> >> > Regards
> >> >  Racke
> >> >
> >> > >
> >> > > On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan
> Hornburg (Racke) wrote:
> >> > >
> >> > > On 6/4/20 6:41 AM, Shifa Shaikh wrote:
> >> > > > I tried all of these but have no clue to a solution.
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME + "\n" + 'SERVER_NAME:' + SERVER_NAME
> >> > + "\n" +
> >> > > > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}"
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME + '\n' + 'SERVER_NAME:' + SERVER_NAME
> >> > + '\n' +
> >> > > > 'NODE_NAME:' +  NODE_NAME + '\n\n\n\n\' }}"
> >> > > >
> >> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +
> PROFILE_NAME ~ }} \n + {{ 'SERVER_NAME:' +
> >> > SERVER_NAME ~
> >> > > }} +
> >> > > > \n + {{ 'NODE_NAME:' +  NODE_NAME ~ }} \n\n\n\n\"
> >> > > >
> >> > > >
> >> > >
> >> > > Use multiline YAML: https://yaml-multiline.info/
> >> > >
> >> > > Regards
> >> > > Racke
> >> > >
> >> > >
> >> > > > On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa
> Shaikh wrote:
> >> > > >
> >> > > > @Dick VIsser Hi,
> >> > > >
> >> > > > Upon your suggestion, I tried something like this but
> it too does not work.
> >> > > >
> >> > > > |
> >> > > >-set_fact:
> >> > > >
> >> > > >mailbody:"{{ mailbody | default('') +
> 'PROFILE_NAME:' +  PROFILE_NAME ~ \"\n\n\"'SERVER_NAME:' +
> >> > > SERVER_NAME
> >> > > > ~ \"\n\n\"'NODE_NAME:' +  NODE_NAME ~ \"\n\n\n\n\" }}"
> >> > > > |
> >> > > >
> >> > > > Can someone please suggest?
> >> > > >
> >> > > > On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30,
> Dick Visser wrote:
> >> > > >
> >> > > 

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Dick Visser
On Thu, 4 Jun 2020 at 10:50, Shifa Shaikh  wrote:
>
> I see the problem is different than the direction we are debugging.
>
> When i write the variable to a file i see new lines but when the variable  
> assigned to email body it does not interpolate the new line instead prints 
> '\n'
>
>- copy
> content: "{{ mailbody }}"
> dest: /tmp/write.log
>
>
>
> - name: Send mail
>   mail:
>   host: localhost:

There is an extra ':' here?

>   port: 25
>   subject: :Hi"

There is an extra ':' here?

>   body: "{{ mailbody }}"
>   from: m...@myshop.com
>   to: y...@yourmail.com


> Can you please suggest?

You already put two errors in your task which prevent it from running correctly.
So in that light, i'm wondering if your actual task does, in fact,
contain more differences than what you've posted here.

Also, "prints '\n'" indicates that you're echoing? and not mailing?



>
> On Thursday, June 4, 2020 at 1:26:56 PM UTC+5:30, Stefan Hornburg (Racke) 
> wrote:
>>
>> On 6/4/20 8:54 AM, Shifa Shaikh wrote:
>> > I tried multiline too as below, but that too fails
>> >
>> >mailbody: |
>> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" 
>> > + "\n"
>> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
>> >
>>
>> Please try:
>>
>> mailbody: |
>>   {{ mailbody | default('') }}PROFILE_NAME: {{ PROFILE_NAME }}
>>   SERVER_NAME: + {{ SERVER_NAME }}
>>
>> Regards
>>  Racke
>>
>> >
>>
>> > Output:
>> > ['"PROFILE_NAME: SPROD01" + "[file://\\n"\n]\\n"\n"SERVER_NAME: 
>> > SPROD01SRV01"\n', '"PROFILE_NAME: SPROD02" +
>> > "[file://\\n"\n]\\n"\n"SERVER_NAME: SPROD02SRV02"\n']
>> >
>> > Also tried:
>> >
>> >mailbody: |
>> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}"
>> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
>> >
>> > and
>> >
>> >mailbody: |
>> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" 
>> > + "\\n"
>> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
>> >
>> > On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke) > > > wrote:
>> >
>> > On 6/4/20 7:21 AM, Shifa Shaikh wrote:
>> > > Stephan Hi,
>> > >
>> > > The article does not discuss newline inside parenthesis `{{` inside 
>> > a variable definition. That is where I have no
>> > clue.
>> >
>> >
>> > Hello Shifa,
>> >
>> > parenthesis are fine inside multiline YAML.
>> >
>> > Regards
>> >  Racke
>> >
>> > >
>> > > On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan Hornburg 
>> > (Racke) wrote:
>> > >
>> > > On 6/4/20 6:41 AM, Shifa Shaikh wrote:
>> > > > I tried all of these but have no clue to a solution.
>> > > >
>> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
>> > PROFILE_NAME + "\n" + 'SERVER_NAME:' + SERVER_NAME
>> > + "\n" +
>> > > > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}"
>> > > >
>> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
>> > PROFILE_NAME + '\n' + 'SERVER_NAME:' + SERVER_NAME
>> > + '\n' +
>> > > > 'NODE_NAME:' +  NODE_NAME + '\n\n\n\n\' }}"
>> > > >
>> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
>> > PROFILE_NAME ~ }} \n + {{ 'SERVER_NAME:' +
>> > SERVER_NAME ~
>> > > }} +
>> > > > \n + {{ 'NODE_NAME:' +  NODE_NAME ~ }} \n\n\n\n\"
>> > > >
>> > > >
>> > >
>> > > Use multiline YAML: https://yaml-multiline.info/
>> > >
>> > > Regards
>> > > Racke
>> > >
>> > >
>> > > > On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa Shaikh 
>> > wrote:
>> > > >
>> > > > @Dick VIsser Hi,
>> > > >
>> > > > Upon your suggestion, I tried something like this but it 
>> > too does not work.
>> > > >
>> > > > |
>> > > >-set_fact:
>> > > >
>> > > >mailbody:"{{ mailbody | default('') + 
>> > 'PROFILE_NAME:' +  PROFILE_NAME ~ \"\n\n\"'SERVER_NAME:' +
>> > > SERVER_NAME
>> > > > ~ \"\n\n\"'NODE_NAME:' +  NODE_NAME ~ \"\n\n\n\n\" }}"
>> > > > |
>> > > >
>> > > > Can someone please suggest?
>> > > >
>> > > > On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30, Dick 
>> > Visser wrote:
>> > > >
>> > > > I won't comment on whatever it is you're trying to do, 
>> > but in any case you need to use double quotes
>> > > around the
>> > > > newlines
>> > > >
>> > > > On Wed, 3 Jun 2020 at 20:12, Shifa Shaikh 
>> > mailto:shif...@gmail.com>> wrote:
>> > > >
>> > > > How can I add new line characters to Ansible 
>> > variable |mailbody. This mailbody variable is used
>> > for mai

Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Shifa Shaikh
I see the problem is different than the direction we are debugging. 

When i write the variable to a file i see new lines but when the variable  
assigned to email body it does not interpolate the new line instead prints 
'\n'

   - copy
content: "{{ mailbody }}"
dest: /tmp/write.log

 

- name: Send mail
  mail:
  host: localhost:
  port: 25
  subject: :Hi"
  body: "{{ mailbody }}"
  from: m...@myshop.com
  to: y...@yourmail.com

Can you please suggest?

On Thursday, June 4, 2020 at 1:26:56 PM UTC+5:30, Stefan Hornburg (Racke) 
wrote:
>
> On 6/4/20 8:54 AM, Shifa Shaikh wrote: 
> > I tried multiline too as below, but that too fails 
> > 
> >mailbody: | 
> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME 
> }}" + "\n" 
> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}" 
> > 
>
> Please try: 
>
> mailbody: | 
>   {{ mailbody | default('') }}PROFILE_NAME: {{ PROFILE_NAME }} 
>   SERVER_NAME: + {{ SERVER_NAME }} 
>
> Regards 
>  Racke 
>
> > 
>
> > Output: 
> > ['"PROFILE_NAME: SPROD01" + "[file://\\n"\n]\\n"\n"SERVER_NAME: 
> SPROD01SRV01"\n', '"PROFILE_NAME: SPROD02" + 
> > "[file://\\n"\n]\\n"\n"SERVER_NAME: SPROD02SRV02"\n'] 
> > 
> > Also tried: 
> > 
> >mailbody: | 
> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME 
> }}" 
> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}" 
> > 
> > and 
> > 
> >mailbody: | 
> >  "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME 
> }}" + "\\n" 
> >  "{{ 'SERVER_NAME: ' + SERVER_NAME }}" 
> > 
> > On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke) <
> ra...@linuxia.de  > 
> wrote: 
> > 
> > On 6/4/20 7:21 AM, Shifa Shaikh wrote: 
> > > Stephan Hi,  
> > > 
> > > The article does not discuss newline inside parenthesis `{{` 
> inside a variable definition. That is where I have no 
> > clue. 
> > 
> > 
> > Hello Shifa, 
> > 
> > parenthesis are fine inside multiline YAML. 
> > 
> > Regards 
> >  Racke 
> > 
> > > 
> > > On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan Hornburg 
> (Racke) wrote: 
> > > 
> > > On 6/4/20 6:41 AM, Shifa Shaikh wrote: 
> > > > I tried all of these but have no clue to a solution.  
> > > > 
> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + 
>  PROFILE_NAME + "\n" + 'SERVER_NAME:' + SERVER_NAME 
> > + "\n" + 
> > > > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}" 
> > > > 
> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + 
>  PROFILE_NAME + '\n' + 'SERVER_NAME:' + SERVER_NAME 
> > + '\n' + 
> > > > 'NODE_NAME:' +  NODE_NAME + '\n\n\n\n\' }}" 
> > > > 
> > > > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' + 
>  PROFILE_NAME ~ }} \n + {{ 'SERVER_NAME:' + 
> > SERVER_NAME ~ 
> > > }} + 
> > > > \n + {{ 'NODE_NAME:' +  NODE_NAME ~ }} \n\n\n\n\" 
> > > > 
> > > > 
> > > 
> > > Use multiline YAML: https://yaml-multiline.info/ 
> > > 
> > > Regards 
> > > Racke 
> > > 
> > > 
> > > > On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa 
> Shaikh wrote: 
> > > > 
> > > > @Dick VIsser Hi,  
> > > > 
> > > > Upon your suggestion, I tried something like this but it 
> too does not work. 
> > > > 
> > > > | 
> > > >-set_fact: 
> > > > 
> > > >mailbody:"{{ mailbody | default('') + 
> 'PROFILE_NAME:' +  PROFILE_NAME ~ \"\n\n\"'SERVER_NAME:' + 
> > > SERVER_NAME 
> > > > ~ \"\n\n\"'NODE_NAME:' +  NODE_NAME ~ \"\n\n\n\n\" }}" 
> > > > | 
> > > > 
> > > > Can someone please suggest? 
> > > > 
> > > > On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30, Dick 
> Visser wrote: 
> > > > 
> > > > I won't comment on whatever it is you're trying to 
> do, but in any case you need to use double quotes 
> > > around the 
> > > > newlines  
> > > > 
> > > > On Wed, 3 Jun 2020 at 20:12, Shifa Shaikh <
> shif...@gmail.com > wrote: 
> > > > 
> > > > How can I add new line characters to Ansible 
> variable |mailbody. This mailbody variable is used 
> > for mail 
> > > > module's body attribute.| 
> > > > 
> > > > | 
> > > > | 
> > > > 
> > > > I tried the below from suggestions but none of 
> them works.  
> > > > 
> > > > 
> > > > |1. | 
> > > > 
> > > > |- set_fact: mailbody: "{{ mailbody | 
> default('') + 'PROFILE_

[ansible-project] Use Ansible to Install SharePoint Server Updates

2020-06-04 Thread Raikhan Mussin
Hello!
My name is Raikhan.

Maybe someone used Ansible to install Microsoft updates?

We configured Ansible to install Microsoft updates, and this works 
successfully for all updates, except for *SharePoint Server 2013 updates*. 
When we run playbook to install SharePoint Server updates - nothing happens 
and there are no understandable errors. The server uses UAC, but we tried 
to work with elevated privileges and also added parameters to the playbook 
to temporarily disable and enable UAC in the registry. Nothing helps.

Maybe you have fresh thoughts and ideas?

Thanks!

[image: Ansible - SharePointUpdates.png] 



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3b6fc889-f0dc-4e53-b5b0-bebc557a706f%40googlegroups.com.


Re: [ansible-project] Add new line “\n” character to Ansible set_fact variable

2020-06-04 Thread Stefan Hornburg (Racke)
On 6/4/20 8:54 AM, Shifa Shaikh wrote:
> I tried multiline too as below, but that too fails
> 
>        mailbody: |
>          "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" + 
> "\n"
>          "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> 

Please try:

mailbody: |
  {{ mailbody | default('') }}PROFILE_NAME: {{ PROFILE_NAME }}
  SERVER_NAME: + {{ SERVER_NAME }}

Regards
 Racke

>

> Output:
> ['"PROFILE_NAME: SPROD01" + "[file://\\n"\n]\\n"\n"SERVER_NAME: 
> SPROD01SRV01"\n', '"PROFILE_NAME: SPROD02" +
> "[file://\\n"\n]\\n"\n"SERVER_NAME: SPROD02SRV02"\n']
> 
> Also tried:
> 
>        mailbody: |
>          "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}"
>          "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> 
> and
> 
>        mailbody: |
>          "{{ mailbody | default('') + 'PROFILE_NAME: ' + PROFILE_NAME }}" + 
> "\\n"
>          "{{ 'SERVER_NAME: ' + SERVER_NAME }}"
> 
> On Thu, Jun 4, 2020 at 11:38 AM Stefan Hornburg (Racke)  > wrote:
> 
> On 6/4/20 7:21 AM, Shifa Shaikh wrote:
> > Stephan Hi, 
> >
> > The article does not discuss newline inside parenthesis `{{` inside a 
> variable definition. That is where I have no
> clue.
> 
> 
> Hello Shifa,
> 
> parenthesis are fine inside multiline YAML.
> 
> Regards
>          Racke
> 
> >
> > On Thursday, June 4, 2020 at 10:31:41 AM UTC+5:30, Stefan Hornburg 
> (Racke) wrote:
> >
> >     On 6/4/20 6:41 AM, Shifa Shaikh wrote:
> >     > I tried all of these but have no clue to a solution. 
> >     >
> >     > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
> PROFILE_NAME + "\n" + 'SERVER_NAME:' + SERVER_NAME
> + "\n" +
> >     > 'NODE_NAME:' +  NODE_NAME + "\n\n\n\n\" }}"
> >     >
> >     > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
> PROFILE_NAME + '\n' + 'SERVER_NAME:' + SERVER_NAME
> + '\n' +
> >     > 'NODE_NAME:' +  NODE_NAME + '\n\n\n\n\' }}"
> >     >
> >     > mailbody: "{{ mailbody | default('') + 'PROFILE_NAME:' +  
> PROFILE_NAME ~ }} \n + {{ 'SERVER_NAME:' +
> SERVER_NAME ~
> >     }} +
> >     > \n + {{ 'NODE_NAME:' +  NODE_NAME ~ }} \n\n\n\n\"
> >     >
> >     >
> >
> >     Use multiline YAML: https://yaml-multiline.info/
> >
> >     Regards
> >             Racke
> >
> >
> >     > On Thursday, June 4, 2020 at 2:27:48 AM UTC+5:30, Shifa Shaikh 
> wrote:
> >     >
> >     >     @Dick VIsser Hi, 
> >     >
> >     >     Upon your suggestion, I tried something like this but it too 
> does not work.
> >     >
> >     >     |
> >     >        -set_fact:
> >     >
> >     >            mailbody:"{{ mailbody | default('') + 'PROFILE_NAME:' 
> +  PROFILE_NAME ~ \"\n\n\"'SERVER_NAME:' +
> >     SERVER_NAME
> >     >     ~ \"\n\n\"'NODE_NAME:' +  NODE_NAME ~ \"\n\n\n\n\" }}"
> >     >     |
> >     >
> >     >     Can someone please suggest?
> >     >
> >     >     On Wednesday, June 3, 2020 at 11:49:10 PM UTC+5:30, Dick 
> Visser wrote:
> >     >
> >     >         I won't comment on whatever it is you're trying to do, 
> but in any case you need to use double quotes
> >     around the
> >     >         newlines 
> >     >
> >     >         On Wed, 3 Jun 2020 at 20:12, Shifa Shaikh 
> mailto:shif...@gmail.com>> wrote:
> >     >
> >     >             How can I add new line characters to Ansible variable 
> |mailbody. This mailbody variable is used
> for mail
> >     >             module's body attribute.|
> >     >
> >     >             |
> >     >             |
> >     >
> >     >             I tried the below from suggestions but none of them 
> works. 
> >     >
> >     >
> >     >             |1. |
> >     >
> >     >             |- set_fact: mailbody: "{{ mailbody | default('') + 
> 'PROFILE_NAME:' + PROFILE_NAME ~
> '\n\nSERVER_NAME:' +
> >     >             SERVER_NAME ~ '\n\nNODE_NAME:' + NODE_NAME ~ 
> '\n\n\n\n' }}"|
> >     >
> >     >             |2.|
> >     >
> >     >                   mailbody: "{{ mailbody | default('') + 
> 'PROFILE_NAME:' +  PROFILE_NAME ~}} {{ 'SERVER_NAME:' +
> >     SERVER_NAME ~ }}\n\n{{'NODE_NAME:' +  NODE_NAME ~ }}\n\n\n\n"
> >     >
> >     >             3.
> >     >
> >     >             |mailbody: | "{{ mailbody | default('') + 
> 'PROFILE_NAME:' + PROFILE_NAME ~}}" "{{ 'SERVER_NAME:' +
> >     >             SERVER_NAME ~ }}" "{{'NODE_NAME:' + NODE_NAME ~ }}"|
> >     >
> >     >             In the mail body i see '\n' instead of the new line 
> charecter.
> >     >
> >     >             Can you please suggest ?
> >     >
> >     >
> >     >             |
> >     >             |
> >     >
> >     >             --
> >     >             You received 

Re: [ansible-project] Issue while parsing Complex Regular expression in YAML file

2020-06-04 Thread Vladimir Botka
The backslash must be escaped too (\\). For example,

- debug:
msg: OK
  loop: [' ', "'", '\', '"', '!', '}']

  when: item is match(context_regex)
  vars:
context_regex: '^[a-zA-Z0-9-+.#$%&~*/=?^_ ''\\"!]$'

gives

ok: [localhost] => (item= ) => {
"msg": "OK"
}
ok: [localhost] => (item=') => {
"msg": "OK"
}
ok: [localhost] => (item=\) => {
"msg": "OK"
}
ok: [localhost] => (item=") => {
"msg": "OK"
}
ok: [localhost] => (item=!) => {
"msg": "OK"
}
skipping: [localhost] => (item=})


HTH,

-vlado

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200604094602.678af4a0%40gmail.com.


pgpNwYdZ0Zjbu.pgp
Description: OpenPGP digital signature


Re: [ansible-project] Issue while parsing Complex Regular expression in YAML file

2020-06-04 Thread Vladimir Botka
On Wed, 3 Jun 2020 22:46:37 -0700 (PDT)
Pawan Kumar  wrote:

> '^[a-zA-Z0-9-+.#$%&~*\/=?^_ '\"\\!]{9,430}$'

Try this

  '^[a-zA-Z0-9-+.#$%&~*/=?^_''\"!]{9,430}$'

In "single-quoted style" only the single-quote must be escaped ('')
https://yaml.org/spec/1.2/spec.html#id2788097

For example (occurrences left out)

- debug:
msg: OK
  loop: ['a', '+', '}']
  when: item is match(context_regex)
  vars:
context_regex: '^[a-zA-Z0-9-+.#$%&~*/=?^_''\"!]$'

gives

ok: [localhost] => (item=a) => {
"msg": "OK"
}
ok: [localhost] => (item=+) => {
"msg": "OK"
}
skipping: [localhost] => (item=})

HTH,

-vlado

-- 
Vladimir Botka

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200604092648.5ef145dd%40gmail.com.


pgpyH76Pi3_hA.pgp
Description: OpenPGP digital signature